Skip to content

Unit Tests

Unit Tests #469

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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
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@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
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@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
with:
parallel-finished: true