Skip to content

Commit 93152d9

Browse files
committed
Use "docker-composer.yml" file during the build
1 parent bedccba commit 93152d9

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

.github/workflows/tests.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
tests:
4141
name: "Tests (PHP ${{ matrix.php }}, Selenium ${{ matrix.selenium_version }})${{ matrix.with_coverage == true && ' with coverage' || ''}}"
42-
runs-on: ubuntu-20.04
42+
runs-on: ubuntu-latest
4343
strategy:
4444
matrix:
4545
selenium_version: [ '2.53.1' ]
@@ -74,24 +74,27 @@ jobs:
7474
composer update --no-interaction --prefer-dist
7575
7676
- name: Setup Mink test server
77+
env:
78+
MINK_HOST: 0.0.0.0:8002
7779
run: |
7880
mkdir ./logs
7981
./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &
8082
8183
- name: Start Selenium
8284
run: |
83-
docker run --net host --name selenium --volume /dev/shm:/dev/shm --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures --shm-size 2g selenium/standalone-firefox:${{ matrix.selenium_version }} &> ./logs/selenium.log &
85+
SELENIUM_IMAGE=selenium/standalone-firefox:${{ matrix.selenium_version }} docker compose up --wait
8486
8587
- name: Wait for browser & PHP to start
8688
run: |
87-
while ! nc -z localhost 4444 </dev/null; do echo Waiting for remote driver to start...; sleep 1; done
88-
while ! nc -z localhost 8002 </dev/null; do echo Waiting for PHP server to start...; sleep 1; done
89+
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status
90+
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:8002/index.html
8991
9092
- name: Run tests with Coverage
9193
if: "${{ matrix.with_coverage == true }}"
9294
env:
9395
SELENIUM_VERSION: ${{ matrix.selenium_version }}
9496
DRIVER_URL: http://localhost:4444/wd/hub
97+
WEB_FIXTURES_HOST: http://host.docker.internal:8002
9598
WEB_FIXTURES_BROWSER: firefox
9699
DRIVER_MACHINE_BASE_PATH: /fixtures/
97100
run: |
@@ -102,6 +105,7 @@ jobs:
102105
env:
103106
SELENIUM_VERSION: ${{ matrix.selenium_version }}
104107
DRIVER_URL: http://localhost:4444/wd/hub
108+
WEB_FIXTURES_HOST: http://host.docker.internal:8002
105109
WEB_FIXTURES_BROWSER: firefox
106110
DRIVER_MACHINE_BASE_PATH: /fixtures/
107111
run: |
@@ -120,6 +124,11 @@ jobs:
120124
with:
121125
token: ${{ secrets.CODECOV_TOKEN }}
122126

127+
- name: Extract docker logs
128+
if: ${{ failure() }}
129+
run: |
130+
docker compose logs --no-color &> ./logs/selenium.log
131+
123132
- name: Archive logs artifacts
124133
if: ${{ failure() }}
125134
uses: actions/upload-artifact@v4

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
selenium:
3+
image: ${SELENIUM_IMAGE:-selenium/standalone-chrome:4}
4+
hostname: selenium
5+
shm_size: 2g
6+
environment:
7+
VNC_NO_PASSWORD: 1
8+
SCREEN_WIDTH: 1024
9+
SCREEN_HEIGHT: 768
10+
volumes:
11+
- /dev/shm:/dev/shm
12+
- ./vendor/mink/driver-testsuite/web-fixtures:/fixtures
13+
ports:
14+
- "4444:4444"
15+
# VNC Web Viewer port (new images)
16+
- "7900:7900"
17+
# VNC Server port (old "-debug" images)
18+
- "5900:5900"
19+
extra_hosts:
20+
- host.docker.internal:host-gateway

0 commit comments

Comments
 (0)