Skip to content

Tests and linting #1169

Tests and linting

Tests and linting #1169

Workflow file for this run

name: Tests and linting
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 3 * * *'
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
dependencies: ['']
include:
- { php-version: '7.3', dependencies: '--prefer-lowest --prefer-stable' }
name: Unit tests - PHP ${{ matrix.php-version }} ${{ matrix.dependencies }}
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, zip
coverage: xdebug
- name: Install dependencies
run: composer update --no-interaction ${{ matrix.dependencies }}
- name: Run tests
env:
COLUMNS: 120
run: |
./vendor/bin/phpunit --configuration ./src-tests/phpunit.xml --exclude-group integration --coverage-clover ./src-tests/logs/clover.xml
- name: Submit coverage to Coveralls
if: ${{ matrix.php-version < 8.0 }} # Code coverage on PHP 8 is not supported with PHPUnit 8
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=./src-tests/logs/clover.xml --json_path=./src-tests/logs/coveralls-upload.json -v
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
selenium-version: ['3.141.59', '4.10.0']
name: Integration tests (Selenium ${{ matrix.selenium-version }})
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4' # Code coverage on PHP 8 is not supported with PHPUnit 8
extensions: mbstring, intl, zip
coverage: xdebug
- name: Install dependencies
run: composer update --no-interaction
- name: Start Selenium server and Xvfb
env:
SELENIUM_EXTRA_PARAMS: "${{ matrix.selenium-version != '3.141.59' && 'standalone' || '' }}"
run: |
google-chrome --version
chromedriver --version
SELENIUM_JAR=$(bin/steward install --no-interaction --no-ansi ${{ matrix.selenium-version }})
xvfb-run --server-args="-screen 0, 1280x720x24" --auto-servernum java -jar $SELENIUM_JAR $SELENIUM_EXTRA_PARAMS >selenium-server.log &
while ! nc -z localhost 4444 </dev/null; do echo Waiting for Selenium server to start...; sleep 1; done
- name: Run tests
env:
COLUMNS: 120
SELENIUM_SERVER_URL: http://127.0.0.1:4444/wd/hub
run: |
./vendor/bin/phpunit --configuration ./src-tests/phpunit.xml --group integration --coverage-clover ./src-tests/logs/clover.xml
- name: Submit coverage to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ github.job }}-selenium-${{ matrix.selenium-version }}
NO_COLOR: 'true'
run: |
composer global require php-coveralls/php-coveralls
~/.composer/vendor/bin/php-coveralls --coverage_clover=./src-tests/logs/clover.xml --coverage_clover=./src-tests/FunctionalTests/logs/clover.xml --json_path=./src-tests/logs/coveralls-upload.json -v
- name: Dump logs
if: ${{ always() }}
run: |
[ -r selenium-server.log ] && cat selenium-server.log
finish-tests:
name: Tests finished
needs: [unit-tests, integration-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@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl
- name: Install dependencies
run: composer update --no-progress
- name: Lint
run: composer lint
- name: Run checks
run: composer analyze
markdown-link-check:
name: "Markdown link check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'yes'
config-file: '.github/mlc_config.json'