Skip to content

build

build #825

Workflow file for this run

name: build
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**.php'
- .github/workflows/build.yml
- composer.json
pull_request:
paths:
- '**.php'
- .github/workflows/build.yml
- composer.json
jobs:
main:
name: Build [PHP ${{ matrix.php-version }}][PHPUnit ${{ matrix.phpunit-version }}]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
phpunit-version:
- '^10.5'
php-version:
- '8.1'
- '8.2'
- '8.3'
include:
- phpunit-version: '^11.0'
php-version: '8.2'
- phpunit-version: '^11.0'
php-version: '8.3'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php-version}}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version}}
extensions: xdebug
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_FILES_DIR }}
key: composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ matrix.php-version }}-
composer-
- name: Setup Composer's GitHub OAuth access
run: composer config --global github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer update --ansi --with-all-dependencies
- name: Run PHP-CS-Fixer
run: vendor/bin/php-cs-fixer check --ansi --verbose --diff
- name: Run PHPStan Static Analysis Check
run: vendor/bin/phpstan analyse --ansi
- name: Tests on PHPUnit ^10.5
if: matrix.phpunit-version == '^10.5'
run: |
vendor/bin/phpunit --color=always
env:
TACHYCARDIA_MONITOR_GA: enabled
- name: Tests on PHPUnit ^11.0
if: matrix.phpunit-version == '^11.0'
run: |
composer remove friendsofphp/php-cs-fixer nexusphp/cs-config --dev --ansi --update-with-all-dependencies
composer update --ansi --with-all-dependencies
vendor/bin/phpunit --color=always
env:
TACHYCARDIA_MONITOR_GA: enabled
- name: Run Coveralls
run: |
composer global require --ansi php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml --verbose
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-version }} - PHPUnit ${{ matrix.phpunit-version }}
coveralls-finish:
name: Coveralls Finished
needs: [main]
runs-on: ubuntu-latest
steps:
- name: Upload to Coveralls API
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true