Skip to content

Tests and linting

Tests and linting #292

Workflow file for this run

name: Tests and linting
on:
push:
pull_request:
schedule:
- cron: '0 3 * * *'
jobs:
selenium:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
branch: ['']
browser: ['chrome', 'firefox']
name: ['stable']
include:
- { browser: 'chrome', branch: 'dev-main', name: 'main branch' }
name: "Selenium - ${{ matrix.browser }} (Steward ${{ matrix.name }})"
services:
selenium-hub:
image: selenium/hub:4.1.0
options: >-
--health-cmd "/opt/bin/check-grid.sh"
ports:
- 4444:4444
# Start one instance of Chrome
selenium-node-chrome:
image: selenium/node-chrome:4.1.0
volumes:
- /dev/shm:/dev/shm
env:
SE_EVENT_BUS_HOST: selenium-hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
# Start two instances of Firefox
selenium-node-firefox-1:
image: selenium/node-firefox:4.1.0
volumes:
- /dev/shm:/dev/shm
env:
SE_EVENT_BUS_HOST: selenium-hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
selenium-node-firefox-2:
image: selenium/node-firefox:4.1.0
volumes:
- /dev/shm:/dev/shm
env:
SE_EVENT_BUS_HOST: selenium-hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, zip
- name: Install dependencies
run: composer update --no-progress
- name: Install specific Steward version
if: ${{ ! matrix.branch == '' }}
run: composer require lmc/steward:${{ matrix.branch }} --update-with-dependencies
- name: Run Steward
run: vendor/bin/steward run production ${{ matrix.browser }} -vvv
- name: Print results
run: vendor/bin/steward results -vvv
- name: Generate timeline.html
run: vendor/bin/steward generate-timeline
- name: Upload logs and screenshots artifacts
uses: actions/upload-artifact@v2
if: ${{ success() || failure() }}
with:
name: logs (Selenium - ${{ matrix.browser }}, Steward ${{ matrix.name }})
path: ${{ github.workspace }}/logs/*
retention-days: 7
- name: Print services logs
if: ${{ success() || failure() }}
run: |
echo --- selenium-hub ---
docker logs "${{ job.services.selenium-hub.id }}"
echo --- selenium-node-chrome ---
docker logs "${{ job.services.selenium-node-chrome.id }}"
echo --- selenium-node-firefox-1 ---
docker logs "${{ job.services.selenium-node-firefox-1.id }}"
echo --- selenium-node-firefox-2 ---
docker logs "${{ job.services.selenium-node-firefox-2.id }}"
sauce-labs:
if: github.event.pull_request.head.repo.full_name == github.repository # do not run on forks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { browser: 'microsoftedge' }
- { browser: 'firefox' }
name: "Sauce Labs - ${{ matrix.browser }}"
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, zip
- name: Install dependencies
run: composer update --no-progress
- name: Start Sauce Connect
uses: saucelabs/sauce-connect-action@v1
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
scVersion: latest
- name: Run tests
run: vendor/bin/steward run production ${{ matrix.browser }} -vvv --server-url=https://${{ secrets.SAUCE_USERNAME }}:${{ secrets.SAUCE_ACCESS_KEY }}@ondemand.saucelabs.com:443/wd/hub --capability="platform:Windows 10" --capability="version:latest"
- name: Print results
run: vendor/bin/steward results -vvv
- name: Upload logs and screenshots artifacts
uses: actions/upload-artifact@v2
if: ${{ success() || failure() }}
with:
name: logs (Sauce Labs - ${{ matrix.browser }})
path: ${{ github.workspace }}/logs/*
retention-days: 7
codestyle:
name: "Code style and static analysis"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl
- name: Install dependencies
run: composer update --no-progress
- name: Lint
run: composer lint
- name: Run checks
run: composer analyze