Skip to content

Unit Tests

Unit Tests #338

Workflow file for this run

name: Unit Tests
on:
schedule:
- cron: '0 0 * * *'
pull_request:
push:
branches:
- 1.x
paths:
- .github/workflows/unit-tests.yml
- src/**
- tests/**
- composer.json
- phpunit.dist.xml
concurrency:
group: unit-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
tests:
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
php-version:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
name: Unit Tests
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
ini-values: display_errors=On, display_startup_errors=On, error_reporting=-1, zend.assertions=1, assert.exception=1, memory_limit=2048M
- name: Setup global variables
id: globals
shell: bash
run: |
echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.globals.outputs.COMPOSER_CACHE_DIR }}
key: ${{ github.workflow }}-PHP_${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ github.workflow }}-PHP_${{ matrix.php-version }}-
- name: Install dependencies
run: composer update --ansi
- name: Run Unit Tests
run: composer test:unit
env:
TACHYCARDIA_MONITOR_GA: enabled
- name: Upload coverage to Coveralls
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
file: build/phpunit/clover.xml
flag-name: ${{ format('PHP_{0}_coverage', matrix.php-version) }}
parallel: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
coveralls-finish:
name: Notify Coveralls API
runs-on: ubuntu-24.04
needs: tests
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Complete parallel builds
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
parallel-finished: true