start_sf5_project/app/.github/workflows/ci.yaml

81 lines
2.8 KiB
YAML

name: "CI"
on:
pull_request:
push:
branches:
- 'master'
env:
fail-fast: true
PHPUNIT_FLAGS: "-v"
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
SYMFONY_REQUIRE: ">=4.4"
# 40x: Since symfony/monolog-bridge 5.2:
# Passing an actionLevel (int|string) as constructor's 3rd argument of
# "Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy"
# is deprecated, "Monolog\Handler\FingersCrossed\ActivationStrategyInterface" expected.
SYMFONY_DEPRECATIONS_HELPER: 40
jobs:
test:
name: "${{ matrix.operating-system }} / PHP ${{ matrix.php-version }}"
runs-on: ${{ matrix.operating-system }}
continue-on-error: false
strategy:
matrix:
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
php-version: ['7.2.9', '7.3', '7.4', '8.0']
steps:
- name: "Checkout code"
uses: actions/checkout@v2.3.3
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@2.7.0
with:
coverage: "none"
extensions: "intl, mbstring, pdo_sqlite"
php-version: ${{ matrix.php-version }}
tools: composer:v2
- name: "Add PHPUnit matcher"
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: "Set composer cache directory"
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache composer"
uses: actions/cache@v2.1.2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-
- name: "Require symfony/flex"
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-main
- if: matrix.php-version != '8.0'
run: composer update
- if: matrix.php-version == '8.0'
run: composer update --ignore-platform-req=php
- if: matrix.php-version != '8.0'
name: "Install PHPUnit"
run: vendor/bin/simple-phpunit install
- if: matrix.php-version == '8.0'
name: "Install PHPUnit for PHP 8"
run: |
echo 'SYMFONY_PHPUNIT_VERSION=9.4' >> $GITHUB_ENV
vendor/bin/simple-phpunit install
- name: "PHPUnit version"
run: vendor/bin/simple-phpunit --version
- name: "Run tests"
run: vendor/bin/simple-phpunit ${{ env.PHPUNIT_FLAGS }}