Sauce Labs #1852
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sauce Labs | |
permissions: | |
contents: read | |
on: | |
push: | |
schedule: | |
- cron: '0 3 * * *' | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
# Source: https://github.community/t/do-not-run-cron-workflows-in-forks/17636/2 | |
if: (github.event_name == 'schedule' && github.repository == 'php-webdriver/php-webdriver') || (github.event_name != 'schedule') | |
env: | |
SAUCELABS: 1 | |
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | |
strategy: | |
fail-fast: false | |
matrix: | |
w3c: [true] | |
include: | |
# Chrome 74 is the last version which doesn't use W3C WebDriver by default and rather use OSS protocol | |
- { name: "Chrome 74, OSS protocol", BROWSER_NAME: "chrome", VERSION: "74.0", PLATFORM: "Windows 10", w3c: false, tunnel-id: "gh-1" } | |
- { name: "Chrome latest, W3C protocol", BROWSER_NAME: "chrome", VERSION: "latest", PLATFORM: "Windows 10", tunnel-id: "gh-2" } | |
- { name: "Edge latest, W3C protocol", BROWSER_NAME: "MicrosoftEdge", VERSION: "latest", PLATFORM: "Windows 10", tunnel-id: "gh-3" } | |
name: ${{ matrix.name }} (${{ matrix.tunnel-id }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
extensions: mbstring, intl, zip | |
coverage: none | |
- name: Install PHP dependencies | |
run: composer update --no-interaction | |
- name: Start local PHP server | |
run: | | |
php -S 127.0.0.1:8000 -t tests/functional/web/ &>>./logs/php-server.log & | |
- name: Start Sauce Connect | |
uses: saucelabs/sauce-connect-action@v2 | |
with: | |
username: ${{ secrets.SAUCE_USERNAME }} | |
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} | |
tunnelIdentifier: ${{ matrix.tunnel-id }} | |
- name: Run tests | |
env: | |
BROWSER_NAME: ${{ matrix.BROWSER_NAME }} | |
VERSION: ${{ matrix.VERSION }} | |
PLATFORM: ${{ matrix.PLATFORM }} | |
DISABLE_W3C_PROTOCOL: "${{ matrix.w3c && '0' || '1' }}" | |
SAUCE_TUNNEL_IDENTIFIER: ${{ matrix.tunnel-id }} | |
run: | | |
if [ -n "$SAUCELABS" ]; then EXCLUDE_GROUP+="exclude-saucelabs,"; fi | |
if [ "$BROWSER_NAME" = "MicrosoftEdge" ]; then EXCLUDE_GROUP+="exclude-edge,"; fi | |
if [ "$BROWSER_NAME" = "firefox" ]; then EXCLUDE_GROUP+="exclude-firefox,"; fi | |
if [ "$BROWSER_NAME" = "chrome" ]; then EXCLUDE_GROUP+="exclude-chrome,"; fi | |
if [ -n "$EXCLUDE_GROUP" ]; then EXTRA_PARAMS+=" --exclude-group $EXCLUDE_GROUP"; fi | |
./vendor/bin/phpunit --testsuite functional $EXTRA_PARAMS | |
- name: Print logs | |
if: ${{ always() }} | |
run: | | |
if [ -f ./logs/php-server.log ]; then cat ./logs/php-server.log; fi |