Skip to content

Tests and Linting

Tests and Linting #389

Workflow file for this run

name: Tests and Linting
on:
push:
pull_request:
schedule:
- cron: '0 3 * * *'
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
dependencies: ['']
include:
- { php-version: '8.1', dependencies: '--prefer-lowest --prefer-stable' }
name: Unit tests - PHP ${{ matrix.php-version }} ${{ matrix.dependencies }}
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: json, mbstring
coverage: xdebug
- name: Install dependencies
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}
- name: Run tests
run: |
composer phpunit:coverage
# Publish code coverage after the code is public
- name: Submit coverage to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ github.job }}-PHP-${{ matrix.php-version }} ${{ matrix.dependencies }}
run: |
composer global require php-coveralls/php-coveralls
~/.composer/vendor/bin/php-coveralls --coverage_clover=coverage/clover.xml --json_path=coverage/coveralls-upload.json -v
finish-tests:
name: Tests finished
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- name: Notify Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
codestyle:
name: "Code style and static analysis"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: json, mbstring
- name: Install dependencies
run: composer update --no-progress
- name: Run checks
run: composer analyze