Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "docker-composer.yml" file during the build #406

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

tests:
name: "Tests (PHP ${{ matrix.php }}, Selenium ${{ matrix.selenium_version }})${{ matrix.with_coverage == true && ' with coverage' || ''}}"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
selenium_version: [ '2.53.1' ]
Expand Down Expand Up @@ -74,24 +74,27 @@ jobs:
composer update --no-interaction --prefer-dist

- name: Setup Mink test server
env:
MINK_HOST: 0.0.0.0:8002
aik099 marked this conversation as resolved.
Show resolved Hide resolved
run: |
mkdir ./logs
./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &

- name: Start Selenium
run: |
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 &
SELENIUM_IMAGE=selenium/standalone-firefox:${{ matrix.selenium_version }} docker compose up --wait

- name: Wait for browser & PHP to start
run: |
while ! nc -z localhost 4444 </dev/null; do echo Waiting for remote driver to start...; sleep 1; done
while ! nc -z localhost 8002 </dev/null; do echo Waiting for PHP server to start...; sleep 1; done
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:8002/index.html

- name: Run tests with Coverage
if: "${{ matrix.with_coverage == true }}"
env:
SELENIUM_VERSION: ${{ matrix.selenium_version }}
DRIVER_URL: http://localhost:4444/wd/hub
WEB_FIXTURES_HOST: http://host.docker.internal:8002
WEB_FIXTURES_BROWSER: firefox
DRIVER_MACHINE_BASE_PATH: /fixtures/
run: |
Expand All @@ -102,6 +105,7 @@ jobs:
env:
SELENIUM_VERSION: ${{ matrix.selenium_version }}
DRIVER_URL: http://localhost:4444/wd/hub
WEB_FIXTURES_HOST: http://host.docker.internal:8002
WEB_FIXTURES_BROWSER: firefox
DRIVER_MACHINE_BASE_PATH: /fixtures/
run: |
Expand All @@ -120,6 +124,11 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Extract docker logs
if: ${{ failure() }}
run: |
docker compose logs --no-color &> ./logs/selenium.log

- name: Archive logs artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
selenium:
image: ${SELENIUM_IMAGE:-selenium/standalone-chrome:4}
hostname: selenium
shm_size: 2g
environment:
VNC_NO_PASSWORD: 1
SCREEN_WIDTH: 1024
SCREEN_HEIGHT: 768
volumes:
- /dev/shm:/dev/shm
- ./vendor/mink/driver-testsuite/web-fixtures:/fixtures
ports:
- "4444:4444"
# VNC Web Viewer port (new images)
- "7900:7900"
# VNC Server port (old "-debug" images)
- "5900:5900"
extra_hosts:
- host.docker.internal:host-gateway
Loading