Skip to content

Unit Tests

Unit Tests #67

Workflow file for this run

name: Unit Tests
on:
push:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2', '8.3' ]
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: bcmath, simplexml, libxml, curl, json, sodium
coverage: pcov
- name: Mitigate Composer lock issues
run: composer update
- name: PHP ${{ matrix.php }} - Validate composer.json and composer.lock
run: composer validate
- name: PHP ${{ matrix.php }} - Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: PHP ${{ matrix.php }} - Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install
- name: PHP ${{ matrix.php }} - Run coverage test suite
env:
apiKey: ${{ secrets.STEAM_API_KEY }}
run: composer run-script test
- name: Publish Test Coverage
uses: paambaati/codeclimate-action@v6
if: ${{ matrix.php }} == '8.1' && ${{ github.ref }} == 'master'
env:
apiKey: ${{ secrets.STEAM_API_KEY }}
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
XDEBUG_MODE: coverage
with:
coverageCommand: composer run-script coverage
coverageLocations: ${{github.workspace}}/coverage.clover:clover
debug: true
- uses: sarisia/actions-status-discord@v1
if: ${{ failure() }}
with:
status: ${{ job.status }}
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "${{ matrix.php }}: Tests failed."
color: 'red'