Tests #1445
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: "Tests" | |
on: | |
push: | |
# Prevent duplicating jobs on PR-s from local branches | |
branches: | |
- "master" | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
env: | |
MIN_COVERED_MSI: 88 | |
MIN_MSI: 86 | |
REQUIRED_PHP_EXTENSIONS: "json" | |
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} | |
jobs: | |
coding-standards: | |
name: "Coding Standards" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.0] | |
dependencies: [locked] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v2" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
php-version: "${{ matrix.php }}" | |
# - name: "Validate composer.json and composer.lock" | |
# run: "composer validate --strict" | |
- name: "Determine composer cache directory" | |
id: "determine-composer-cache-directory" | |
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/[email protected]" | |
with: | |
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | |
key: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | |
restore-keys: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-" | |
- name: "Install lowest dependencies from composer.json" | |
if: "matrix.dependencies == 'lowest'" | |
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" | |
- name: "Install locked dependencies from composer.lock" | |
if: "matrix.dependencies == 'locked'" | |
run: "composer install --no-interaction --no-progress --no-suggest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress --no-suggest" | |
- name: "Run ergebnis/composer-normalize" | |
run: "composer normalize --dry-run" | |
- name: "Run phpcs" | |
run: "composer codestyle" | |
static-code-analysis: | |
name: "Static Code Analysis" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.0, 8.1] | |
dependencies: [locked] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v2" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
php-version: "${{ matrix.php }}" | |
- name: "Determine composer cache directory" | |
id: "determine-composer-cache-directory" | |
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/[email protected]" | |
with: | |
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | |
key: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | |
restore-keys: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-" | |
- name: "Install lowest dependencies from composer.json" | |
if: "matrix.dependencies == 'lowest'" | |
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" | |
- name: "Install locked dependencies from composer.lock" | |
if: "matrix.dependencies == 'locked'" | |
run: "composer install --no-interaction --no-progress --no-suggest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress --no-suggest" | |
- name: "Create cache directory for phpstan/phpstan" | |
run: "mkdir -p .build/phpstan" | |
- name: "Cache cache directory for phpstan/phpstan" | |
uses: "actions/[email protected]" | |
with: | |
path: ".build/phpstan" | |
key: "php-${{ matrix.php }}-phpstan-${{ github.sha }}" | |
restore-keys: "php-${{ matrix.php }}-phpstan-" | |
- name: "Run phpstan/phpstan" | |
run: "composer phpstan" | |
tests: | |
name: "Tests" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.0, 8.1, 8.2] | |
dependencies: | |
- "lowest" | |
- "locked" | |
- "highest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v2" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
php-version: "${{ matrix.php }}" | |
- name: "Determine composer cache directory" | |
id: "determine-composer-cache-directory" | |
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/[email protected]" | |
with: | |
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | |
key: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | |
restore-keys: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-" | |
- name: "Install lowest dependencies from composer.json" | |
if: "matrix.dependencies == 'lowest'" | |
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" | |
- name: "Install locked dependencies from composer.lock" | |
if: "matrix.dependencies == 'locked'" | |
run: "composer install --no-interaction --no-progress --no-suggest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress --no-suggest" | |
- name: "Run all tests" | |
run: "composer test" | |
code-coverage: | |
name: "Code Coverage" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.0, 8.1] | |
dependencies: | |
- "locked" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v2" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "pcov" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
php-version: "${{ matrix.php }}" | |
- name: "Determine composer cache directory" | |
id: "determine-composer-cache-directory" | |
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/[email protected]" | |
with: | |
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | |
key: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | |
restore-keys: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-" | |
- name: "Install lowest dependencies from composer.json" | |
if: "matrix.dependencies == 'lowest'" | |
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" | |
- name: "Install locked dependencies from composer.lock" | |
if: "matrix.dependencies == 'locked'" | |
run: "composer install --no-interaction --no-progress --no-suggest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress --no-suggest" | |
- name: "Collect code coverage with pcov and phpunit/phpunit" | |
run: "composer test-coverage" | |
- name: "Send code coverage report to Codecov.io" | |
env: | |
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" | |
run: "bash <(curl -s https://codecov.io/bash)" | |
mutation-tests: | |
name: "Mutation Tests" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.0] | |
dependencies: | |
- "locked" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v2" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "pcov" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
php-version: "${{ matrix.php }}" | |
- name: "Determine composer cache directory" | |
id: "determine-composer-cache-directory" | |
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/[email protected]" | |
with: | |
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | |
key: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | |
restore-keys: "php-${{ matrix.php }}-composer-${{ matrix.dependencies }}-" | |
- name: "Install lowest dependencies from composer.json" | |
if: "matrix.dependencies == 'lowest'" | |
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" | |
- name: "Install locked dependencies from composer.lock" | |
if: "matrix.dependencies == 'locked'" | |
run: "composer install --no-interaction --no-progress --no-suggest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress --no-suggest" | |
- name: "Run mutation tests with pcov and infection/infection" | |
run: "vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=${{ env.MIN_COVERED_MSI }} --min-msi=${{ env.MIN_MSI }}" |