From cbf7e24dc4100d17e48738475a48ab1eca0558a3 Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Wed, 8 Jan 2025 20:39:38 +0100 Subject: [PATCH 01/15] Add smoke-test workflow --- .github/workflows/smoke.yml | 106 ++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 .github/workflows/smoke.yml diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml new file mode 100644 index 0000000..26a60e3 --- /dev/null +++ b/.github/workflows/smoke.yml @@ -0,0 +1,106 @@ +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 + ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & + while ! nc -z localhost 8002 ./logs/mink-test-server.log & + docker run --net host --name chrome 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 ./logs/mink-test-server.log & + while ! nc -z localhost 8002 ./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:4 &> ./logs/selenium.log & + while ! nc -z localhost 4444 Date: Thu, 9 Jan 2025 00:39:26 +0100 Subject: [PATCH 02/15] Minor adjustments --- .github/workflows/smoke.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 26a60e3..073679c 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -33,11 +33,14 @@ jobs: setup: | mkdir ./logs ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & - docker run --net host --name chrome 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 & + 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 ./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:4 &> ./logs/selenium.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 Date: Thu, 9 Jan 2025 08:39:11 +0100 Subject: [PATCH 03/15] Use oldest supported zombie driver --- .github/workflows/smoke.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 073679c..13e95c9 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -47,7 +47,7 @@ jobs: repo: https://github.com/minkphp/MinkZombieDriver.git php: 7.2 setup: | - npm install zombie + npm install zombie@^2.0 mkdir ./logs ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & while ! nc -z localhost 8002 Date: Thu, 9 Jan 2025 08:44:37 +0100 Subject: [PATCH 04/15] Set node version --- .github/workflows/smoke.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 13e95c9..cc3111c 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -46,6 +46,7 @@ jobs: - name: Zombie repo: https://github.com/minkphp/MinkZombieDriver.git php: 7.2 + node: 10 setup: | npm install zombie@^2.0 mkdir ./logs @@ -90,6 +91,11 @@ jobs: coverage: none php-version: ${{ matrix.driver.php }} + - uses: actions/setup-node@v4 + if: ${{ matrix.driver.node }} + with: + node-version: ${{ matrix.driver.node }} + - name: Install driver dependencies run: composer install --no-interaction --ansi --no-progress From dfdd8f08262272c2a539dd66a3b57c2b6544628a Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Thu, 9 Jan 2025 08:49:24 +0100 Subject: [PATCH 05/15] Use even older crap --- .github/workflows/smoke.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index cc3111c..555074c 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -7,7 +7,7 @@ on: jobs: test: name: ${{ matrix.driver.name }} - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: @@ -46,7 +46,7 @@ jobs: - name: Zombie repo: https://github.com/minkphp/MinkZombieDriver.git php: 7.2 - node: 10 + node: 5 setup: | npm install zombie@^2.0 mkdir ./logs From a84be67ef483f2dffb43b01d10152a83d2bd53f4 Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Thu, 9 Jan 2025 08:51:52 +0100 Subject: [PATCH 06/15] Roll back 9 year old downgrade --- .github/workflows/smoke.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 555074c..a60b36c 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -7,7 +7,7 @@ on: jobs: test: name: ${{ matrix.driver.name }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -46,9 +46,9 @@ jobs: - name: Zombie repo: https://github.com/minkphp/MinkZombieDriver.git php: 7.2 - node: 5 + node: 10 setup: | - npm install zombie@^2.0 + npm install zombie@^4.0 mkdir ./logs ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & while ! nc -z localhost 8002 Date: Thu, 9 Jan 2025 08:57:56 +0100 Subject: [PATCH 07/15] Remove zombie driver --- .github/workflows/smoke.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index a60b36c..68cbabc 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -43,17 +43,6 @@ jobs: export DRIVER_MACHINE_BASE_PATH=/fixtures/ ./vendor/bin/phpunit --colors=always --testdox - - name: Zombie - repo: https://github.com/minkphp/MinkZombieDriver.git - php: 7.2 - node: 10 - setup: | - npm install zombie@^4.0 - mkdir ./logs - ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & - while ! nc -z localhost 8002 Date: Thu, 9 Jan 2025 09:21:39 +0100 Subject: [PATCH 08/15] Various fixes --- .github/workflows/smoke.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 68cbabc..f4d0155 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -15,10 +15,7 @@ jobs: - name: BrowserKit (http client) repo: https://github.com/minkphp/MinkBrowserKitDriver.git php: 7.2 - setup: | - mkdir ./logs - ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & - while ! nc -z localhost 8002 ./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 ./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 ./logs/mink-test-server.log & + eval "${{ matrix.driver.setup }}" + while ! nc -z localhost 8002 Date: Thu, 9 Jan 2025 09:27:36 +0100 Subject: [PATCH 09/15] dvfgsafgnhdbgdbfndnfghz --- .github/workflows/smoke.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index f4d0155..cace619 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -58,7 +58,7 @@ jobs: test: | export WEB_FIXTURES_BROWSER=firefox export DRIVER_MACHINE_BASE_PATH=/fixtures/ - ./vendor/bin/phpunit --colors=always --testdox --bootstrap=./vendor/autoload.php + ./vendor/bin/phpunit --colors=always --testdox steps: - name: Set up workspace for driver repo From f20f4b1a046eae96508fb9607a1f3c9574f20ef8 Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Sat, 11 Jan 2025 10:08:03 +0100 Subject: [PATCH 10/15] Limit minkse2driver to selenium 2 --- .github/workflows/smoke.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index cace619..8a85490 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -41,7 +41,7 @@ jobs: repo: https://github.com/minkphp/MinkSelenium2Driver.git php: 7.2 setup: | - 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 & + 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:2 &> ./logs/selenium.log & while ! nc -z localhost 4444 Date: Sat, 11 Jan 2025 10:36:40 +0100 Subject: [PATCH 11/15] Fix infinite loops; fix selenium image --- .github/workflows/smoke.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 8a85490..65b3091 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -15,13 +15,11 @@ jobs: - name: BrowserKit (http client) repo: https://github.com/minkphp/MinkBrowserKitDriver.git php: 7.2 - setup: 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 @@ -41,8 +39,8 @@ jobs: repo: https://github.com/minkphp/MinkSelenium2Driver.git php: 7.2 setup: | - 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:2 &> ./logs/selenium.log & - while ! nc -z localhost 4444 ./logs/selenium.log & + 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/ @@ -83,7 +81,7 @@ jobs: mkdir ./logs ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & eval "${{ matrix.driver.setup }}" - while ! nc -z localhost 8002 Date: Sat, 11 Jan 2025 11:09:46 +0100 Subject: [PATCH 12/15] Fix many problems --- .github/workflows/smoke.yml | 56 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 65b3091..40851af 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -11,61 +11,67 @@ jobs: strategy: fail-fast: false matrix: - driver: + include: - name: BrowserKit (http client) - repo: https://github.com/minkphp/MinkBrowserKitDriver.git + driverRepoUrl: https://github.com/minkphp/MinkBrowserKitDriver.git php: 7.2 - test: ./vendor/bin/phpunit --colors=always --testdox --configuration ./phpunit.http_client.xml + testCmd: ./vendor/bin/phpunit --colors=always --testdox --configuration ./phpunit.http_client.xml - name: BrowserKit (http kernel) - repo: https://github.com/minkphp/MinkBrowserKitDriver.git + driverRepoUrl: https://github.com/minkphp/MinkBrowserKitDriver.git php: 7.2 - test: ./vendor/bin/phpunit --colors=always --testdox + testCmd: ./vendor/bin/phpunit --colors=always --testdox - name: Chrome - repo: https://gitlab.com/behat-chrome/chrome-mink-driver.git + driverRepoUrl: https://gitlab.com/behat-chrome/chrome-mink-driver.git php: 7.4 - setup: | - 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 & + setUpCmd: | + docker run --detach --quiet --net host --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures \ + --name chrome 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" sed "s#http://localhost/#http://localhost:8002/#" phpunit.xml.dist > phpunit.xml while ! nc -z localhost 9222 ./logs/chrome.docker.log - name: Selenium2 - repo: https://github.com/minkphp/MinkSelenium2Driver.git + driverRepoUrl: https://github.com/minkphp/MinkSelenium2Driver.git php: 7.2 - setup: | - 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:2.53.1 &> ./logs/selenium.log & + setUpCmd: | + docker run --detach --quiet --net host --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures \ + --name selenium selenium/standalone-firefox:2.53.1 curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status - test: | + testCmd: | export WEB_FIXTURES_BROWSER=firefox export DRIVER_MACHINE_BASE_PATH=/fixtures/ ./vendor/bin/phpunit --colors=always --testdox + tearDownCmd: | + docker logs selenium > ./logs/selenium.docker.log - name: WebDriver-Classic - repo: https://github.com/minkphp/webdriver-classic-driver.git + driverRepoUrl: https://github.com/minkphp/webdriver-classic-driver.git php: 7.4 - setup: | + setUpCmd: | 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: | + testCmd: | export WEB_FIXTURES_BROWSER=firefox export DRIVER_MACHINE_BASE_PATH=/fixtures/ ./vendor/bin/phpunit --colors=always --testdox steps: - name: Set up workspace for driver repo - run: git clone ${{ matrix.driver.repo }} . + run: git clone ${{ matrix.driverRepoUrl }} . - uses: shivammathur/setup-php@v2 with: coverage: none - php-version: ${{ matrix.driver.php }} + php-version: ${{ matrix.php }} - name: Install driver dependencies run: composer install --no-interaction --ansi --no-progress @@ -76,19 +82,23 @@ jobs: with: path: ./vendor/mink/driver-testsuite - - name: Set up test environment + - name: Set up run: | mkdir ./logs ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & - eval "${{ matrix.driver.setup }}" + eval "${{ matrix.setUpCmd }}" curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:8002/ - name: Run tests - run: eval "${{ matrix.driver.test }}" + run: eval "${{ matrix.testCmd }}" + + - name: Tear down + run: | + eval "${{ matrix.tearDownCmd }}" - name: Upload logs as artifact uses: actions/upload-artifact@v4 if: always() with: - name: ${{ matrix.driver.name }}-logs + name: ${{ matrix.name }}-logs path: ./logs From 5b7060a4741e115175ed9b183d10e54000a1edf4 Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Sat, 11 Jan 2025 11:11:02 +0100 Subject: [PATCH 13/15] Fix job name --- .github/workflows/smoke.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 40851af..9fef8fa 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -6,7 +6,7 @@ on: jobs: test: - name: ${{ matrix.driver.name }} + name: ${{ matrix.name }} runs-on: ubuntu-latest strategy: fail-fast: false From 193885c78dea6465df145bd761f9e2a9824d8668 Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Sun, 12 Jan 2025 17:55:30 +0100 Subject: [PATCH 14/15] Various fixes; merge workflows --- .github/workflows/ci.yml | 120 ++++++++++++++++++++++++++++++++---- .github/workflows/smoke.yml | 104 ------------------------------- .github/workflows/test.yml | 74 ++++++++++++++++++++++ 3 files changed, 182 insertions(+), 116 deletions(-) delete mode 100644 .github/workflows/smoke.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0126c4..de93b51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,17 +19,113 @@ jobs: with: coverage: none php-version: '8.2' - - run: composer validate --strict --no-check-lock + - run: composer validate --strict --no-check-lock --ansi 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 + name: Static analysis + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + coverage: none + php-version: '8.2' + - run: composer update --ansi --no-progress --prefer-dist --no-interaction + - run: vendor/bin/phpstan analyze --ansi --no-progress + + Official: + name: "🛡️ ${{ matrix.name }}" + uses: "./.github/workflows/test.yml" + with: + name: ${{ matrix.name }} + driverRepoUrl: ${{ matrix.driverRepoUrl }} + php: ${{ matrix.php }} + setUpCmd: ${{ matrix.setUpCmd }} + testCmd: ${{ matrix.testCmd }} + tearDownCmd: ${{ matrix.tearDownCmd }} + strategy: + fail-fast: false + matrix: + include: + - name: "BrowserKit (http client)" + driverRepoUrl: "https://github.com/minkphp/MinkBrowserKitDriver.git" + php: "7.2" + # language=bash + testCmd: ./vendor/bin/phpunit --colors=always --testdox --configuration ./phpunit.http_client.xml + + - name: "BrowserKit (http kernel)" + driverRepoUrl: "https://github.com/minkphp/MinkBrowserKitDriver.git" + php: "7.2" + # language=bash + testCmd: ./vendor/bin/phpunit --colors=always --testdox + + - name: "Selenium2" + driverRepoUrl: "https://github.com/minkphp/MinkSelenium2Driver.git" + php: "7.2" + # language=bash + setUpCmd: | + export SELENIUM_IMAGE=selenium/standalone-firefox:2.53.1 + 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 + # language=bash + testCmd: | + export WEB_FIXTURES_BROWSER=firefox + export DRIVER_MACHINE_BASE_PATH=/fixtures/ + export WEB_FIXTURES_HOST=http://host.docker.internal:8002 + ./vendor/bin/phpunit --colors=always --testdox + # language=bash + tearDownCmd: | + docker compose logs --no-color --no-log-prefix --timestamps selenium > ./logs/selenium.docker.log + + - name: "WebDriver-Classic" + driverRepoUrl: "https://github.com/minkphp/webdriver-classic-driver.git" + php: "7.4" + # language=bash + setUpCmd: | + 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 + # language=bash + testCmd: | + export WEB_FIXTURES_BROWSER=firefox + export DRIVER_MACHINE_BASE_PATH=/fixtures/ + export WEB_FIXTURES_HOST=http://host.docker.internal:8002 + ./vendor/bin/phpunit --colors=always --testdox + # language=bash + tearDownCmd: | + docker compose logs --no-color --no-log-prefix --timestamps selenium > ./logs/selenium.docker.log + + Unofficial: + name: "✨️ ${{ matrix.name }}" + uses: "./.github/workflows/test.yml" + if: ${{ github.event_name == 'workflow_dispatch' }} + with: + name: ${{ matrix.name }} + driverRepoUrl: ${{ matrix.driverRepoUrl }} + php: ${{ matrix.php }} + setUpCmd: ${{ matrix.setUpCmd }} + testCmd: ${{ matrix.testCmd }} + tearDownCmd: ${{ matrix.tearDownCmd }} + strategy: + fail-fast: false + matrix: + include: + - name: "Chrome" + driverRepoUrl: "https://gitlab.com/behat-chrome/chrome-mink-driver.git" + php: "7.4" + # language=bash + setUpCmd: | + docker run --detach --quiet --net host --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures \ + --name chrome 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" + sed "s#http://localhost/#http://localhost:8002/#" phpunit.xml.dist > phpunit.xml + while ! nc -z localhost 9222 ./logs/chrome.docker.log + diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml deleted file mode 100644 index 9fef8fa..0000000 --- a/.github/workflows/smoke.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Smoke Test - -on: - workflow_dispatch: - pull_request: # TODO Temporary, but maybe we might keep it - -jobs: - test: - name: ${{ matrix.name }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - name: BrowserKit (http client) - driverRepoUrl: https://github.com/minkphp/MinkBrowserKitDriver.git - php: 7.2 - testCmd: ./vendor/bin/phpunit --colors=always --testdox --configuration ./phpunit.http_client.xml - - - name: BrowserKit (http kernel) - driverRepoUrl: https://github.com/minkphp/MinkBrowserKitDriver.git - php: 7.2 - testCmd: ./vendor/bin/phpunit --colors=always --testdox - - - name: Chrome - driverRepoUrl: https://gitlab.com/behat-chrome/chrome-mink-driver.git - php: 7.4 - setUpCmd: | - docker run --detach --quiet --net host --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures \ - --name chrome 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" - sed "s#http://localhost/#http://localhost:8002/#" phpunit.xml.dist > phpunit.xml - while ! nc -z localhost 9222 ./logs/chrome.docker.log - - - name: Selenium2 - driverRepoUrl: https://github.com/minkphp/MinkSelenium2Driver.git - php: 7.2 - setUpCmd: | - docker run --detach --quiet --net host --volume /dev/shm:/dev/shm --shm-size 2g --volume ./vendor/mink/driver-testsuite/web-fixtures:/fixtures \ - --name selenium selenium/standalone-firefox:2.53.1 - curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status - testCmd: | - export WEB_FIXTURES_BROWSER=firefox - export DRIVER_MACHINE_BASE_PATH=/fixtures/ - ./vendor/bin/phpunit --colors=always --testdox - tearDownCmd: | - docker logs selenium > ./logs/selenium.docker.log - - - name: WebDriver-Classic - driverRepoUrl: https://github.com/minkphp/webdriver-classic-driver.git - php: 7.4 - setUpCmd: | - 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 - testCmd: | - export WEB_FIXTURES_BROWSER=firefox - export DRIVER_MACHINE_BASE_PATH=/fixtures/ - ./vendor/bin/phpunit --colors=always --testdox - - steps: - - name: Set up workspace for driver repo - run: git clone ${{ matrix.driverRepoUrl }} . - - - uses: shivammathur/setup-php@v2 - with: - coverage: none - php-version: ${{ matrix.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 - run: | - mkdir ./logs - ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & - eval "${{ matrix.setUpCmd }}" - curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:8002/ - - - name: Run tests - run: eval "${{ matrix.testCmd }}" - - - name: Tear down - run: | - eval "${{ matrix.tearDownCmd }}" - - - name: Upload logs as artifact - uses: actions/upload-artifact@v4 - if: always() - with: - name: ${{ matrix.name }}-logs - path: ./logs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f283d9a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,74 @@ +on: + workflow_call: + inputs: + name: + description: Name of the driver test + required: true + type: string + driverRepoUrl: + description: Git URL of the driver repository + required: true + type: string + php: + description: PHP version for running tests + required: true + type: string + setUpCmd: + description: Command to run before test + required: false + type: string + testCmd: + description: Command that runs the test + required: true + type: string + tearDownCmd: + description: Command to run after test + required: false + type: string + +jobs: + Test: + runs-on: ubuntu-latest + steps: + - name: Set up workspace for driver repo + # language=bash + run: git clone ${{ inputs.driverRepoUrl }} . + + - uses: shivammathur/setup-php@v2 + with: + coverage: none + php-version: ${{ inputs.php }} + + - name: Install driver dependencies + # language=bash + run: composer install --no-interaction --ansi --no-progress + + - name: Set up driver test suite as composer dependency + # This is instead of `composer require "mink/driver-testsuite:dev-master#${{ github.sha }}"`, which works with forks + uses: actions/checkout@v4 + with: + path: ./vendor/mink/driver-testsuite + + - name: Set up + # language=bash + run: | + mkdir ./logs + MINK_HOST=0.0.0.0:8002 ./vendor/bin/mink-test-server &> ./logs/mink-test-server.log & + eval "${{ inputs.setUpCmd }}" + curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:8002/ + + - name: Run tests + # language=bash + run: eval "${{ inputs.testCmd }}" + + - name: Tear down + # language=bash + run: | + eval "${{ inputs.tearDownCmd }}" + + - name: Upload logs as artifact + uses: actions/upload-artifact@v4 + if: always() + with: + name: ${{ inputs.name }}-logs + path: ./logs From d7fa83e4e67a473ebcdf712db0e0f3381de2f2cd Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Sun, 19 Jan 2025 17:41:38 +0100 Subject: [PATCH 15/15] Specify branch explicitly; fix Selenium2Driver workflow --- .github/workflows/ci.yml | 8 ++++++++ .github/workflows/test.yml | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de93b51..fb27a0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: with: name: ${{ matrix.name }} driverRepoUrl: ${{ matrix.driverRepoUrl }} + driverRepoBranch: ${{ matrix.driverRepoBranch }} php: ${{ matrix.php }} setUpCmd: ${{ matrix.setUpCmd }} testCmd: ${{ matrix.testCmd }} @@ -49,18 +50,21 @@ jobs: include: - name: "BrowserKit (http client)" driverRepoUrl: "https://github.com/minkphp/MinkBrowserKitDriver.git" + driverRepoBranch: "master" php: "7.2" # language=bash testCmd: ./vendor/bin/phpunit --colors=always --testdox --configuration ./phpunit.http_client.xml - name: "BrowserKit (http kernel)" driverRepoUrl: "https://github.com/minkphp/MinkBrowserKitDriver.git" + driverRepoBranch: "master" php: "7.2" # language=bash testCmd: ./vendor/bin/phpunit --colors=always --testdox - name: "Selenium2" driverRepoUrl: "https://github.com/minkphp/MinkSelenium2Driver.git" + driverRepoBranch: "master" php: "7.2" # language=bash setUpCmd: | @@ -70,6 +74,7 @@ jobs: # language=bash testCmd: | export WEB_FIXTURES_BROWSER=firefox + export SELENIUM_VERSION=2.53.1 export DRIVER_MACHINE_BASE_PATH=/fixtures/ export WEB_FIXTURES_HOST=http://host.docker.internal:8002 ./vendor/bin/phpunit --colors=always --testdox @@ -79,6 +84,7 @@ jobs: - name: "WebDriver-Classic" driverRepoUrl: "https://github.com/minkphp/webdriver-classic-driver.git" + driverRepoBranch: "main" php: "7.4" # language=bash setUpCmd: | @@ -102,6 +108,7 @@ jobs: with: name: ${{ matrix.name }} driverRepoUrl: ${{ matrix.driverRepoUrl }} + driverRepoBranch: ${{ matrix.driverRepoBranch }} php: ${{ matrix.php }} setUpCmd: ${{ matrix.setUpCmd }} testCmd: ${{ matrix.testCmd }} @@ -112,6 +119,7 @@ jobs: include: - name: "Chrome" driverRepoUrl: "https://gitlab.com/behat-chrome/chrome-mink-driver.git" + driverRepoBranch: "main" php: "7.4" # language=bash setUpCmd: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f283d9a..e7846ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,10 @@ on: description: Git URL of the driver repository required: true type: string + driverRepoBranch: + description: Driver repository branch to check out + required: true + type: string php: description: PHP version for running tests required: true @@ -32,7 +36,7 @@ jobs: steps: - name: Set up workspace for driver repo # language=bash - run: git clone ${{ inputs.driverRepoUrl }} . + run: git clone --single-branch --branch "${{ inputs.driverRepoBranch }}" "${{ inputs.driverRepoUrl }}" . - uses: shivammathur/setup-php@v2 with: