Skip to content

Implement Nexus Suppression #305

Implement Nexus Suppression

Implement Nexus Suppression #305

Workflow file for this run

name: Unit Tests
on:
schedule:
- cron: '0 0 * * *'
pull_request:
push:
branches:
- 1.x
concurrency:
group: unit-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
tests:
strategy:
fail-fast: false
matrix:
php-version:
- '8.3'
- '8.4'
os:
- ubuntu-22.04
- windows-2022
name: Unit Tests
runs-on: ${{ matrix.os }}
steps:
- name: Setup Git for Windows
if: matrix.os == 'windows-2022'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
- name: Setup global variables
id: globals
shell: bash
run: |
echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_OUTPUT
echo "EXPERIMENTAL_FLAG=${{ matrix.php-version == '8.4' && '--ignore-platform-req=php' || '' }}" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.globals.outputs.COMPOSER_CACHE_DIR }}
key: ${{ github.workflow }}-PHP_${{ matrix.php-version }}-${{ matrix.os }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ github.workflow }}-PHP_${{ matrix.php-version }}-${{ matrix.os }}-
${{ github.workflow }}-PHP_${{ matrix.php-version }}-
- name: Install dependencies
run: composer update --ansi ${{ steps.globals.outputs.EXPERIMENTAL_FLAG }}
- name: Run Unit Tests
shell: bash
continue-on-error: ${{ matrix.php-version == 8.4 }}
run: |
bin/parallel-phpunit ${{ env.COVERAGE_OPTION }}
env:
COVERAGE_OPTION: ${{ matrix.os != 'windows-2022' && '--coverage' || '' }}
TACHYCARDIA_MONITOR_GA: enabled
- name: Run Mutation Testing
if: matrix.os != 'windows-2022'
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch --depth=1 origin $GITHUB_BASE_REF
composer mutation:filter
else
composer mutation:check
fi
env:
INFECTION_DASHBOARD_API_KEY: ${{ secrets.INFECTION_DASHBOARD_API_KEY }}
- name: Display structure of coverage files
if: matrix.os != 'windows-2022'
run: ls -la
working-directory: build/cov
- name: Merge coverage files into Clover
if: matrix.os != 'windows-2022'
run: |
composer global require phpunit/phpcov --ansi ${{ steps.globals.outputs.EXPERIMENTAL_FLAG }}
phpcov merge --clover build/phpunit/clover.xml build/cov
- name: Upload coverage to Coveralls
if: matrix.os != 'windows-2022'
run: |
composer global require php-coveralls/php-coveralls --ansi ${{ steps.globals.outputs.EXPERIMENTAL_FLAG }}
php-coveralls --verbose --exclude-no-stmt --ansi --coverage_clover build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ format('PHP_{0}-{1}', matrix.php-version, matrix.os) }}
coveralls-finish:
name: Notify Coveralls API
runs-on: ubuntu-22.04
needs: tests
steps:
- name: Complete parallel builds
uses: coverallsapp/github-action@v2
with:
parallel-finished: true