Skip to content

Allow skipping custom tests (copy/paste from "driver-testsuite") #245

Allow skipping custom tests (copy/paste from "driver-testsuite")

Allow skipping custom tests (copy/paste from "driver-testsuite") #245

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
defaults:
name: Set up defaults
runs-on: ubuntu-latest
outputs:
php: ${{ steps.defaults.outputs.php }}
browser: ${{ steps.defaults.outputs.browser }}
selenium: ${{ steps.defaults.outputs.selenium }}
steps:
- id: defaults
run: |
echo 'php="8.3"' >> "$GITHUB_OUTPUT"
echo 'browser="chrome"' >> "$GITHUB_OUTPUT"
echo 'selenium="4"' >> "$GITHUB_OUTPUT"
check_composer:
name: Check composer.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.1'
- run: composer validate --strict --no-check-lock
static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.2'
- name: Install dependencies
run: composer update --ansi --no-progress --prefer-dist --no-interaction
- run: vendor/bin/phpstan analyze
tests:
name: Tests
runs-on: ubuntu-latest
needs: defaults
strategy:
matrix:
# Check different Selenium versions for common browsers
php:
- ${{ fromJSON(needs.defaults.outputs.php) }}
browser:
- 'firefox'
- 'chrome'
selenium:
- '2.53.1'
- '3'
- '4'
include:
# Check on different PHP versions
- php: '7.4'
browser: ${{ fromJSON(needs.defaults.outputs.browser) }}
selenium: ${{ fromJSON(needs.defaults.outputs.selenium) }}
- php: '8.0'
browser: ${{ fromJSON(needs.defaults.outputs.browser) }}
selenium: ${{ fromJSON(needs.defaults.outputs.selenium) }}
- php: '8.1'
browser: ${{ fromJSON(needs.defaults.outputs.browser) }}
selenium: ${{ fromJSON(needs.defaults.outputs.selenium) }}
- php: '8.2'
browser: ${{ fromJSON(needs.defaults.outputs.browser) }}
selenium: ${{ fromJSON(needs.defaults.outputs.selenium) }}
- php: '8.3'
browser: ${{ fromJSON(needs.defaults.outputs.browser) }}
selenium: ${{ fromJSON(needs.defaults.outputs.selenium) }}
# Check less-common browsers
- php: ${{ fromJSON(needs.defaults.outputs.php) }}
browser: 'edge'
selenium: ${{ fromJSON(needs.defaults.outputs.selenium) }}
- php: ${{ fromJSON(needs.defaults.outputs.php) }}
browser: 'chromium'
selenium: ${{ fromJSON(needs.defaults.outputs.selenium) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "xdebug"
php-version: "${{ matrix.php }}"
ini-file: development
- name: Install dependencies
run: |
composer update --no-interaction --prefer-dist --ansi --no-progress
- name: Start Selenium
run: |
SELENIUM_IMAGE=selenium/standalone-${{ matrix.browser }}:${{ matrix.selenium }} docker compose up --wait
- name: Wait for selenium to start
run: |
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status
- name: Run tests
env:
SELENIUM_VERSION: ${{ matrix.selenium }}
DRIVER_URL: http://localhost:4444/wd/hub
WEB_FIXTURES_HOST: http://host.docker.internal:8002
WEB_FIXTURES_BROWSER: ${{ matrix.browser }}
DRIVER_MACHINE_BASE_PATH: /fixtures/
run: |
vendor/bin/phpunit -v --coverage-clover=coverage.xml --colors=always --testdox
- name: Upload coverage
uses: codecov/codecov-action@v4
# See https://github.com/nektos/act#skipping-steps
if: ${{ !env.ACT }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
- name: Extract docker logs
if: ${{ failure() }}
run: |
mkdir -p ./logs
docker compose logs --no-color &> ./logs/selenium.log
- name: Archive logs artifacts
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: logs_php-${{ matrix.php }}_selenium-${{ matrix.selenium }}_${{ matrix.browser }}
path: logs