Skip to content

Commit d868dd1

Browse files
committed
Various fixes; merge workflows
1 parent 719d090 commit d868dd1

File tree

3 files changed

+182
-116
lines changed

3 files changed

+182
-116
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,113 @@ jobs:
1919
with:
2020
coverage: none
2121
php-version: '8.2'
22-
- run: composer validate --strict --no-check-lock
22+
- run: composer validate --strict --no-check-lock --ansi
2323

2424
static_analysis:
25-
name: Static analysis
26-
runs-on: ubuntu-latest
27-
steps:
28-
- uses: actions/checkout@v4
29-
- uses: shivammathur/setup-php@v2
30-
with:
31-
coverage: none
32-
php-version: '8.2'
33-
- name: Install dependencies
34-
run: composer update --ansi --no-progress --prefer-dist --no-interaction
35-
- run: vendor/bin/phpstan analyze
25+
name: Static analysis
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: shivammathur/setup-php@v2
30+
with:
31+
coverage: none
32+
php-version: '8.2'
33+
- run: composer update --ansi --no-progress --prefer-dist --no-interaction
34+
- run: vendor/bin/phpstan analyze --ansi --no-progress
35+
36+
Official:
37+
name: "🛡️ ${{ matrix.name }}"
38+
uses: "./.github/workflows/test.yml"
39+
with:
40+
name: ${{ matrix.name }}
41+
driverRepoUrl: ${{ matrix.driverRepoUrl }}
42+
php: ${{ matrix.php }}
43+
setUpCmd: ${{ matrix.setUpCmd }}
44+
testCmd: ${{ matrix.testCmd }}
45+
tearDownCmd: ${{ matrix.tearDownCmd }}
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
include:
50+
- name: "BrowserKit (http client)"
51+
driverRepoUrl: "https://github.com/minkphp/MinkBrowserKitDriver.git"
52+
php: "7.2"
53+
# language=bash
54+
testCmd: ./vendor/bin/phpunit --colors=always --testdox --configuration ./phpunit.http_client.xml
55+
56+
- name: "BrowserKit (http kernel)"
57+
driverRepoUrl: "https://github.com/minkphp/MinkBrowserKitDriver.git"
58+
php: "7.2"
59+
# language=bash
60+
testCmd: ./vendor/bin/phpunit --colors=always --testdox
61+
62+
- name: "Selenium2"
63+
driverRepoUrl: "https://github.com/minkphp/MinkSelenium2Driver.git"
64+
php: "7.2"
65+
# language=bash
66+
setUpCmd: |
67+
export SELENIUM_IMAGE=selenium/standalone-firefox:2.53.1
68+
docker compose up --wait --quiet-pull
69+
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status
70+
# language=bash
71+
testCmd: |
72+
export WEB_FIXTURES_BROWSER=firefox
73+
export DRIVER_MACHINE_BASE_PATH=/fixtures/
74+
export WEB_FIXTURES_HOST=http://host.docker.internal:8002
75+
./vendor/bin/phpunit --colors=always --testdox
76+
# language=bash
77+
tearDownCmd: |
78+
docker compose logs --no-color --no-log-prefix --timestamps selenium > ./logs/selenium.docker.log
79+
80+
- name: "WebDriver-Classic"
81+
driverRepoUrl: "https://github.com/minkphp/webdriver-classic-driver.git"
82+
php: "7.4"
83+
# language=bash
84+
setUpCmd: |
85+
export SELENIUM_IMAGE=selenium/standalone-firefox:4
86+
docker compose up --wait --quiet-pull
87+
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status
88+
# language=bash
89+
testCmd: |
90+
export WEB_FIXTURES_BROWSER=firefox
91+
export DRIVER_MACHINE_BASE_PATH=/fixtures/
92+
export WEB_FIXTURES_HOST=http://host.docker.internal:8002
93+
./vendor/bin/phpunit --colors=always --testdox
94+
# language=bash
95+
tearDownCmd: |
96+
docker compose logs --no-color --no-log-prefix --timestamps selenium > ./logs/selenium.docker.log
97+
98+
Unofficial:
99+
name: "✨️ ${{ matrix.name }}"
100+
uses: "./.github/workflows/test.yml"
101+
if: ${{ github.event_name == 'workflow_dispatch' }}
102+
with:
103+
name: ${{ matrix.name }}
104+
driverRepoUrl: ${{ matrix.driverRepoUrl }}
105+
php: ${{ matrix.php }}
106+
setUpCmd: ${{ matrix.setUpCmd }}
107+
testCmd: ${{ matrix.testCmd }}
108+
tearDownCmd: ${{ matrix.tearDownCmd }}
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
include:
113+
- name: "Chrome"
114+
driverRepoUrl: "https://gitlab.com/behat-chrome/chrome-mink-driver.git"
115+
php: "7.4"
116+
# language=bash
117+
setUpCmd: |
118+
docker run --detach --quiet --net host --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures \
119+
--name chrome zenika/alpine-chrome:latest \
120+
"--remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 --disable-gpu --headless=new --disable-extensions --no-sandbox --use-gl=swiftshader --disable-software-rasterizer --disable-dev-shm-usage"
121+
sed "s#http://localhost/#http://localhost:8002/#" phpunit.xml.dist > phpunit.xml
122+
while ! nc -z localhost 9222 </dev/null; do echo Waiting for chrome to start...; sleep 1; done
123+
# language=bash
124+
testCmd: |
125+
export WEB_FIXTURES_BROWSER=chrome
126+
export DRIVER_MACHINE_BASE_PATH=/fixtures/
127+
./vendor/bin/phpunit --colors=always --testdox
128+
# language=bash
129+
tearDownCmd: |
130+
docker logs chrome > ./logs/chrome.docker.log
131+

.github/workflows/smoke.yml

Lines changed: 0 additions & 104 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
name:
5+
description: Name of the driver test
6+
required: true
7+
type: string
8+
driverRepoUrl:
9+
description: Git URL of the driver repository
10+
required: true
11+
type: string
12+
php:
13+
description: PHP version for running tests
14+
required: true
15+
type: string
16+
setUpCmd:
17+
description: Command to run before test
18+
required: false
19+
type: string
20+
testCmd:
21+
description: Command that runs the test
22+
required: true
23+
type: string
24+
tearDownCmd:
25+
description: Command to run after test
26+
required: false
27+
type: string
28+
29+
jobs:
30+
Test:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Set up workspace for driver repo
34+
# language=bash
35+
run: git clone ${{ inputs.driverRepoUrl }} .
36+
37+
- uses: shivammathur/setup-php@v2
38+
with:
39+
coverage: none
40+
php-version: ${{ inputs.php }}
41+
42+
- name: Install driver dependencies
43+
# language=bash
44+
run: composer install --no-interaction --ansi --no-progress
45+
46+
- name: Set up driver test suite as composer dependency
47+
# This is instead of `composer require "mink/driver-testsuite:dev-master#${{ github.sha }}"`, which works with forks
48+
uses: actions/checkout@v4
49+
with:
50+
path: ./vendor/mink/driver-testsuite
51+
52+
- name: Set up
53+
# language=bash
54+
run: |
55+
mkdir ./logs
56+
MINK_HOST=0.0.0.0:8002 ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &
57+
eval "${{ inputs.setUpCmd }}"
58+
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:8002/
59+
60+
- name: Run tests
61+
# language=bash
62+
run: eval "${{ inputs.testCmd }}"
63+
64+
- name: Tear down
65+
# language=bash
66+
run: |
67+
eval "${{ inputs.tearDownCmd }}"
68+
69+
- name: Upload logs as artifact
70+
uses: actions/upload-artifact@v4
71+
if: always()
72+
with:
73+
name: ${{ inputs.name }}-logs
74+
path: ./logs

0 commit comments

Comments
 (0)