Merge branch 'main' into develop #577
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit tests | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['7.3', '7.4', '7.2'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Check PHP Version | |
run: php -v | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-build-${{ matrix.php-versions }}-${{ hashFiles('composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ matrix.php-versions }}- | |
- name: Install dependencies | |
env: | |
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{secrets.COMPOSER_AUTH}}"} }' | |
if: steps.cache.outputs.cache-hit != 'true' | |
# We run `--no-scripts` to avoid using Strauss during unit tests | |
run: composer install --prefer-dist --no-progress --no-scripts | |
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" | |
# Docs: https://getcomposer.org/doc/articles/scripts.md | |
- name: Run linter | |
run: composer run-script linter | |
- name: Run PHPStan | |
run: composer run-script analyse | |
- name: Run test suite | |
run: composer run-script test |