Laravel 11 #32
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
jobs: | |
tests: | |
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} | |
runs-on: ubuntu-latest | |
env: | |
CC_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [ '8.1','8.2', '8.3' ] | |
stability: [ prefer-lowest, prefer-stable ] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:v2 | |
coverage: pcov | |
- name: Setup Problem Matchers | |
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 | |
if: ${{ !env.ACT }} | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ matrix.stability }}-${{ matrix.php }} }} | |
restore-keys: ${{ runner.os }}-composer-${{ matrix.stability }}-${{ matrix.php }} | |
if: ${{ !env.ACT }} | |
- name: Install PHP Dependencies | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --quiet | |
- name: Execute PHPUnit | |
run: vendor/bin/phpunit --coverage-clover=coverage.xml | |
- name: Upload coverage to codeclimate | |
uses: paambaati/codeclimate-action@v3.1.1 | |
continue-on-error: true | |
env: | |
CC_TEST_REPORTER_ID: ${{ env.CC_TOKEN }} | |
with: | |
coverageCommand: '' | |
coverageLocations: ./coverage.xml:clover | |
if: ${{ !env.ACT && env.CC_TOKEN && matrix.stability == 'prefer-stable' && matrix.php == '8.2' }} |