Skip to content

Use PHPUnit TeamCity matcher instead of test reports #53

Use PHPUnit TeamCity matcher instead of test reports

Use PHPUnit TeamCity matcher instead of test reports #53

Workflow file for this run

name: 🏗 Build
on:
pull_request:
types: [ synchronize, opened, reopened, ready_for_review ]
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
prefer_lowest: ["", "--prefer-lowest"]
php: ["8.2", "8.5"]
container:
image: skpr/php-cli:${{ matrix.php }}-dev-v2-stable
options:
--pull always
--user 1001:1001
steps:
- name: Checkout
uses: actions/checkout@v6
with:
show-progress: false
- name: 📦 Composer Update
run: composer update --with-all-dependencies --prefer-dist --no-progress --no-interaction ${{ matrix.prefer_lowest }}
- name: 🧹 PHPCS
if: matrix.php != '8.5'
run: ./bin/phpcs --report=checkstyle -q | ./bin/cs2pr
- name: 🧹 PHPStan
run: ./bin/phpstan --error-format=github analyse
- name: ➕ Add PHPUnit matcher
run: |
cat << 'EOF' > .github/phpunit-failure.json
{"problemMatcher":[{"owner":"phpunit-failure","severity":"error","pattern":[{"regexp":"##teamcity\\[testFailed[^\\]]*message='([^']*)'[^\\]]*details='/data/([^:]+):(\\d+)","message":1,"file":2,"line":3}]}]}
EOF
echo "::add-matcher::.github/phpunit-failure.json"
- name: ⚡ Run Tests
run: ./bin/phpunit --teamcity
- name: ➖ Remove PHPUnit matcher
if: always()
run: echo "::remove-matcher owner=phpunit-failure::"