Skip to content

Add exception message assertion #332

Add exception message assertion

Add exception message assertion #332

Workflow file for this run

name: PHP Composer
on:
push:
branches:
- develop
- v*
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
experimental: [false]
env:
code-coverage-version: '8.3' # Most recent stable PHP version.
name: PHP ${{ matrix.php-versions }}
steps:
- uses: actions/checkout@v3
- name: Setup PHP ${{ matrix.php-versions }} without code coverage
if: matrix.php-versions != env.code-coverage-version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
tools: cs2pr
- name: Setup PHP ${{ matrix.php-versions }} with code coverage
if: matrix.php-versions == env.code-coverage-version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
tools: cs2pr
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
composer-${{ matrix.php-versions }}-
composer-
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install PHP dependencies
if: matrix.experimental == false
run: composer update --prefer-dist --no-progress
# Ignore platform requirements for experimental branches.
- name: Install PHP experimental dependencies
if: matrix.experimental
run: composer update --ignore-platform-reqs --prefer-dist --no-progress
- name: Run PHPUnit tests
run: composer run-script phpunit
- name: Run PHPStan
if: matrix.php-versions == env.code-coverage-version
run: composer run-script phpstan -- --no-progress
- name: Check code style
if: matrix.php-versions == env.code-coverage-version
run: composer run-script phpcs -- --report=checkstyle | cs2pr
# Ensure the next test run fetches the latest test ruleset.
- name: Cleanup composer cache
if: steps.cache.outputs.cache-hit != 'true'
run: rm -rf $(composer config cache-files-dir)/httpwg
- name: Upload code coverage report
if: matrix.php-versions == env.code-coverage-version
uses: actions/upload-artifact@v1
with:
name: code-coverage
path: tmp/code-coverage
- name: Upload code coverage to codecov
if: matrix.php-versions == env.code-coverage-version
uses: codecov/codecov-action@v3
with:
files: ./tmp/code-coverage/clover.xml
flags: phpunit