Skip to content

CI

CI #130

Workflow file for this run

# https://docs.github.com/en/actions
on:
pull_request: null
push: null
schedule:
- cron: "15 0 * * *"
name: CI
env:
PHP_VERSION: 8.4
permissions:
contents: read
jobs:
dependency-validation:
name: Dependency Validation
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
tools: none
- name: Ensure that composer.json is valid
run: ./tools/composer validate --no-ansi --strict composer.json
- name: Ensure that dependencies can be installed
run: ./tools/composer install --no-ansi --dry-run
coding-guidelines:
name: Coding Guidelines
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
tools: none
- name: Run PHP-CS-Fixer
run: ./tools/php-cs-fixer check --show-progress=dots --using-cache=no --verbose
static-analysis:
name: Static Analysis
if: github.event_name != 'schedule'
needs:
- dependency-validation
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
tools: none
- name: Install dependencies with Composer
run: ./tools/composer install --no-interaction --no-ansi --no-progress
- name: Run PHPStan
run: ./tools/phpstan analyse --no-progress --error-format=github
unit-tests:
name: Unit Tests
needs:
- dependency-validation
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: none
- name: Install dependencies with Composer
run: tools/composer install --no-ansi --no-interaction --no-progress
- name: Run tests with PHPUnit
run: tools/phpunit --order-by depends,random
- name: Run tests with Infection
run: tools/infection --min-msi=84 --min-covered-msi=84
code-coverage:
name: Code Coverage
needs:
- unit-tests
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Use local branch
shell: bash
run: |
BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
git branch -D $BRANCH 2>/dev/null || true
git branch $BRANCH HEAD
git checkout $BRANCH
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: xdebug
tools: none
- name: Install dependencies with Composer
run: ./tools/composer install --no-ansi --no-interaction --no-progress
- name: Collect code coverage with PHPUnit
run: tools/phpunit --log-junit test-results.xml --coverage-openclover=code-coverage.xml
- name: Upload test results to Codecov.io
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
files: ./test-results.xml
- name: Upload code coverage data to Codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
files: ./code-coverage.xml