Merge pull request #65 from youvo/dependency-updates #169
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP Code Analysis & Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
phpanalysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install PHP_CodeSniffer and PHPStan | |
run: | | |
composer require --dev dealerdirect/phpcodesniffer-composer-installer | |
composer require --dev drupal/coder | |
- name: Check coding standards | |
run: | | |
vendor/bin/phpcs --report=summary | |
- name: Static code analysis | |
run: | | |
vendor/bin/phpstan analyze web/modules/custom | |
phptests: | |
needs: phpanalysis | |
runs-on: ubuntu-latest | |
env: | |
extensions: gd | |
key: cache | |
services: | |
db: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: db | |
MYSQL_PASSWORD: db | |
MYSQL_DATABASE: db | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Check out | |
uses: actions/checkout@v2 | |
- name: Set up cache environment | |
id: extcache | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: 8.1 | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.extcache.outputs.dir }} | |
key: ${{ steps.extcache.outputs.key }} | |
restore-keys: ${{ steps.extcache.outputs.key }} | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
extensions: ${{ env.extensions }} | |
coverage: none | |
- name: Install dependencies | |
run: | | |
sudo apt-get install patch | |
composer validate | |
composer install --no-interaction --no-progress | |
- name: Run PHPUnit tests | |
run: | | |
vendor/bin/phpunit |