From a08f93c18877661026c95dc33d8874f3263728eb Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 4 Sep 2020 21:39:02 +0100 Subject: [PATCH] Run PHPCS and PHPStan in GitHub Actions Fixes #76 --- .github/workflows/coding-standards.yml | 39 ++++++++++++++++++++++ .github/workflows/static-code-analysis.yml | 39 ++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/coding-standards.yml create mode 100644 .github/workflows/static-code-analysis.yml diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..b081a8b --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,39 @@ +name: Run coding standards checks + +on: + push: + branches: + - production + pull_request: + +jobs: + phpunit: + runs-on: ubuntu-latest + + name: "Run coding standards checks" + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: | + ~/.composer/cache/files + web/core + web/modules/constrib + web/themes/contrib + vendor + key: dependencies-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-suggest + + - name: Run checks + run: make phpcs diff --git a/.github/workflows/static-code-analysis.yml b/.github/workflows/static-code-analysis.yml new file mode 100644 index 0000000..1b69067 --- /dev/null +++ b/.github/workflows/static-code-analysis.yml @@ -0,0 +1,39 @@ +name: Static analysis with PHPStan + +on: + push: + branches: + - production + pull_request: + +jobs: + phpunit: + runs-on: ubuntu-latest + + name: Static analysis with PHPStan + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: | + ~/.composer/cache/files + web/core + web/modules/constrib + web/themes/contrib + vendor + key: dependencies-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-suggest + + - name: Run checks + run: make phpstan