Bump actions/cache from 2 to 4 #61
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: PHPUnit | |
on: | |
pull_request: | |
branches: | |
- develop | |
push: | |
branches: | |
- develop | |
jobs: | |
main: | |
name: PHP ${{ matrix.php-versions }} Unit Tests | |
strategy: | |
matrix: | |
php-versions: ['7.3', '7.4', '8.0'] | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
tools: composer, infection, pecl, phive, phpunit | |
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3 | |
coverage: xdebug | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies (limited) | |
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }} | |
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader | |
- name: Install dependencies (authenticated) | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} | |
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader | |
env: | |
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | |
- name: Test with PHPUnit | |
run: vendor/bin/phpunit --verbose --coverage-text | |
env: | |
TERM: xterm-256color | |
TACHYCARDIA_MONITOR_GA: enabled | |
- if: matrix.php-versions == '8.0' | |
name: Mutate with Infection | |
run: | | |
git fetch --depth=1 origin $GITHUB_BASE_REF | |
infection --threads=2 --skip-initial-tests --coverage=build/phpunit --git-diff-base=origin/$GITHUB_BASE_REF --git-diff-filter=AM --logger-github --ignore-msi-with-no-mutations | |
- if: matrix.php-versions == '8.0' | |
name: Run Coveralls | |
continue-on-error: true | |
run: | | |
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls | |
php-coveralls --verbose --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: PHP ${{ matrix.php-versions }} | |
coveralls: | |
needs: [main] | |
name: Coveralls Finished | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload Coveralls results | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |