Merge pull request #223 from aik099/use-static-in-doc-blocks #107
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: CI | |
on: | |
push: | |
paths-ignore: ['docs/**', '.github/workflows/docs.yml', '.readthedocs.yaml'] | |
pull_request: | |
paths-ignore: ['docs/**', '.github/workflows/docs.yml', '.readthedocs.yaml'] | |
# Cancels all previous workflow runs for the same branch that have not yet completed. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
tests: | |
name: "PHP ${{ matrix.php }}${{ matrix.with_coverage == true && ' with coverage' || ''}}" | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
php: [ '5.6', '7.0', '7.1', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] | |
with_coverage: [ false ] | |
include: | |
- php: '7.2' | |
with_coverage: true | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "xdebug" | |
php-version: "${{ matrix.php }}" | |
tools: composer | |
# PHP 7.1 development web server segfaults if timezone not set. | |
ini-values: date.timezone=Europe/Paris, error_reporting=-1, display_errors=On | |
- name: Configure for PHP >= 7.1 | |
if: "${{ matrix.php >= '7.1' }}" | |
run: | | |
composer require --no-update --dev symfony/error-handler "^4.4 || ^5.0" | |
- name: Configure for PHP >= 8.0 | |
if: "${{ matrix.php >= '8.0' }}" | |
run: | | |
composer require --no-update --dev scrutinizer/ocular | |
- name: Install dependencies | |
uses: "ramsey/composer-install@v2" | |
with: | |
dependency-versions: "highest" | |
- name: Setup web server | |
run: | | |
php -S localhost:8002 -t $(pwd) > /dev/null 2> /tmp/webserver_output.txt & | |
while ! nc -z localhost 8002 </dev/null; do echo Waiting for PHP server to start...; sleep 1; done | |
sed -i -e "s,http://localhost,http://localhost:8002,g" phpunit.xml.dist | |
sed -i -e "s,firefox,chrome,g" phpunit.xml.dist | |
- name: Setup Chrome | |
uses: browser-actions/setup-chrome@latest | |
with: | |
chrome-version: "stable" | |
- name: Setup ChromeDriver | |
uses: nanasess/setup-chromedriver@master | |
- name: Start virtual frame buffer and Selenium server | |
run: | | |
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 & | |
export DISPLAY=:99 | |
sleep 3 | |
tests/run_selenium.sh | |
- name: Run tests with Coverage | |
if: "${{ matrix.with_coverage == true }}" | |
run: | | |
vendor/bin/phpunit -v --coverage-clover=coverage.clover | |
- name: Run tests without Coverage | |
if: "${{ matrix.with_coverage == false }}" | |
run: | | |
vendor/bin/phpunit -v | |
- name: Upload Coverage to CodeCov | |
if: "${{ matrix.with_coverage == true }}" | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload Coverage to Scrutinizer CI (PHP < 8.0) | |
if: "${{ matrix.php < '8.0' && matrix.with_coverage == true }}" | |
run: | | |
wget https://scrutinizer-ci.com/ocular.phar | |
php ocular.phar code-coverage:upload --repository=g/qa-tools/qa-tools --format=php-clover coverage.clover | |
- name: Upload Coverage to Scrutinizer CI (PHP >= 8.0) | |
if: "${{ matrix.php >= '8.0' && matrix.with_coverage == true }}" | |
run: | | |
vendor/bin/ocular code-coverage:upload --repository=g/qa-tools/qa-tools --format=php-clover coverage.clover |