Tests #1495
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: | |
- "*.x" # run for release branches | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
coding-standards: | |
name: "Coding Standards" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.1] | |
dependencies: [lowest] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- 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 \"directory=$(composer config cache-dir)\" >> $GITHUB_OUTPUT" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/cache@v4" | |
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 --prefer-lowest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress" | |
- name: "Run phpcs" | |
run: "composer codestyle" | |
static-code-analysis: | |
name: "Static Code Analysis" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.1] | |
dependencies: [lowest] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- 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 \"directory=$(composer config cache-dir)\" >> $GITHUB_OUTPUT" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/cache@v4" | |
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 --prefer-lowest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress" | |
- name: "Create cache directory for phpstan/phpstan" | |
run: "mkdir -p .build/phpstan" | |
- name: "Cache cache directory for phpstan/phpstan" | |
uses: "actions/cache@v4" | |
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.1, 8.2, 8.3, 8.4 ] | |
orchestra: [ "^7.47", "^8.13", "^9.0" ] | |
dependencies: [ lowest, highest ] | |
exclude: | |
- php: "8.1" | |
orchestra: "^9.0" | |
dependencies: "highest" | |
- php: "8.1" | |
orchestra: "^9.0" | |
dependencies: "lowest" | |
- php: "8.4" | |
orchestra: "^7.47" | |
dependencies: "highest" | |
- php: "8.4" | |
orchestra: "^7.47" | |
dependencies: "lowest" | |
- php: "8.4" | |
orchestra: "^8.13" | |
dependencies: "highest" | |
- php: "8.4" | |
orchestra: "^8.13" | |
dependencies: "lowest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- 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 \"directory=$(composer config cache-dir)\" >> $GITHUB_OUTPUT" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/cache@v4" | |
with: | |
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | |
key: "php-${{ matrix.php }}-${{ matrix.orchestra }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | |
restore-keys: "php-${{ matrix.php }}-${{ matrix.orchestra }}-composer-${{ matrix.dependencies }}-" | |
- name: "Install lowest dependencies from composer.json" | |
if: "matrix.dependencies == 'lowest'" | |
run: "composer update --with='orchestra/testbench:${{ matrix.orchestra }}' --no-interaction --no-progress --prefer-lowest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --with='orchestra/testbench:${{ matrix.orchestra }}' --no-interaction --no-progress" | |
- name: "Run all tests" | |
run: "composer test" | |
code-coverage: | |
name: "Code Coverage" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php: [8.1] | |
dependencies: | |
- "lowest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- 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 \"directory=$(composer config cache-dir)\" >> $GITHUB_OUTPUT" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/cache@v4" | |
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 --prefer-lowest" | |
- name: "Install highest dependencies from composer.json" | |
if: "matrix.dependencies == 'highest'" | |
run: "composer update --no-interaction --no-progress" | |
- 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)" |