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

Add smoke-test workflow #103

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
103 changes: 103 additions & 0 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Smoke Test

on:
workflow_dispatch:
pull_request: # TODO Temporary, but maybe we might keep it

jobs:
test:
name: ${{ matrix.driver.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
driver:
- name: BrowserKit (http client)
repo: https://github.com/minkphp/MinkBrowserKitDriver.git
php: 7.2
setup: |
mkdir ./logs
uuf6429 marked this conversation as resolved.
Show resolved Hide resolved
./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &
while ! nc -z localhost 8002 </dev/null; do echo Waiting for PHP server to start...; sleep 1; done
test: ./vendor/bin/phpunit --colors=always --testdox --configuration ./phpunit.http_client.xml

- name: BrowserKit (http kernel)
repo: https://github.com/minkphp/MinkBrowserKitDriver.git
php: 7.2
setup:
test: ./vendor/bin/phpunit --colors=always --testdox

- name: Chrome
repo: https://gitlab.com/behat-chrome/chrome-mink-driver.git
php: 7.4
setup: |
mkdir ./logs
./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &
docker run --net host --name chrome --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures zenika/alpine-chrome:latest \
"--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" &> ./logs/chrome.log &
sed "s#http://localhost/#http://localhost:8002/#" phpunit.xml.dist > phpunit.xml
while ! nc -z localhost 9222 </dev/null; do echo Waiting for chrome to start...; sleep 1; done
while ! nc -z localhost 8002 </dev/null; do echo Waiting for PHP server to start...; sleep 1; done
test: |
export WEB_FIXTURES_BROWSER=chrome
export DRIVER_MACHINE_BASE_PATH=/fixtures/
./vendor/bin/phpunit --colors=always --testdox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we even test the 3rd party drivers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's listed in our documentation.. (just as zombie and sahi), so I added it. This is in line with the "testing active drivers" comment from earlier.


- name: Selenium2
repo: https://github.com/minkphp/MinkSelenium2Driver.git
php: 7.2
setup: |
mkdir ./logs
./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &
docker run --net host --name selenium --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures selenium/standalone-firefox:3 &> ./logs/selenium.log &
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
test: |
export WEB_FIXTURES_BROWSER=firefox
export DRIVER_MACHINE_BASE_PATH=/fixtures/
./vendor/bin/phpunit --colors=always --testdox

- name: WebDriver-Classic
repo: https://github.com/minkphp/webdriver-classic-driver.git
php: 7.4
setup: |
export SELENIUM_IMAGE=selenium/standalone-firefox:4
docker compose up --wait --quiet-pull
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status
test: |
export WEB_FIXTURES_BROWSER=firefox
export DRIVER_MACHINE_BASE_PATH=/fixtures/
./vendor/bin/phpunit --colors=always --testdox

# TODO Goutte, Sahi and Selenium PHP packages seem deprecated/abandoned without alternative - so nothing to test, right?
uuf6429 marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Set up workspace for driver repo
run: git clone ${{ matrix.driver.repo }} .

- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.driver.php }}

- name: Install driver dependencies
run: composer install --no-interaction --ansi --no-progress

# This is instead of `composer require "mink/driver-testsuite:dev-master#${{ github.sha }}"`, which works with forks
- name: Set up driver test suite as composer dependency
uses: actions/checkout@v4
with:
path: ./vendor/mink/driver-testsuite

- name: Set up test environment
run: eval "${{ matrix.driver.setup }}"

- name: Run tests
run: eval "${{ matrix.driver.test }}"

- name: Upload logs as artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.driver.name }}-logs
path: ./logs
Loading