-
Notifications
You must be signed in to change notification settings - Fork 5
106 lines (92 loc) · 2.89 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
push:
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
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
strategy:
matrix:
php: [ '7.4', '8.0', '8.1', '8.2' ]
browser: [ 'firefox', 'chrome' ]
selenium: [ '2.53.1', '3', '4' ]
include:
- php: '7.4'
browser: 'edge'
selenium: '4'
- php: '8.2'
browser: 'chromium'
selenium: '4'
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@v3
if: ${{ failure() }}
with:
name: logs_php-${{ matrix.php }}_selenium-${{ matrix.selenium }}_${{ matrix.browser }}
path: logs