.github/workflows/test.yml
name: Build
on:
push:
pull_request:
jobs:
tests:
name: Test & Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php: '8.2'
publish: true
exclude:
- php: '8.2'
publish: false
php:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
publish:
- false
env:
PHP_VERSION: ${{ matrix.php }}
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
- name: Install dependencies
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-reqs --prefer-dist --prefer-stable"
- name: Run tests
run: |
composer test-coverage
- name: Publish code coverage to codeclimate
if: matrix.publish == true && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}