Add the selenium workflow

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2021-02-08 18:36:05 +01:00
parent c7f23eb9cd
commit 2dd0c07ea7
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

92
.github/workflows/test-selenium.yml vendored Normal file
View File

@ -0,0 +1,92 @@
name: Run selenium tests
on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master
- QA_**
jobs:
test-selenium:
name: Selenium tests on php ${{ matrix.php-version }} and ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ${{ matrix.os }}
services:
database-server:
image: ${{ matrix.db-server }}
env:
MYSQL_ROOT_PASSWORD: testbench
ports:
- "3306:3306"
options: --name db-server --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php-version: ["7.1"]
os: [ubuntu-latest]
db-server: ["mysql:5.7"]
steps:
- uses: actions/checkout@v2
- name: Install gettext
run: sudo apt-get install -y gettext
- name: Generate mo files
run: ./scripts/generate-mo --quiet
- name: Use php ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, iconv, mysqli, zip, gd
tools: composer:v2
- name: Cache module
uses: actions/cache@v2
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install --no-interaction
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install modules
run: yarn install --non-interactive --production
- name: Install nginx and php-fpm
run: sudo apt-get install -y nginx php-fpm
- name: Start selenium server
run: docker run -d -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 --rm --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59
- name: Copy the config
run: cp test/config.e2e.inc.php config.inc.php
- name: Start server
env:
CI_MODE: selenium
FPM_PATH: php-fpm8.0
SKIP_STANDALONE: 1
run: ./test/start-local-server
- name: Run php tests
env:
CI_MODE: selenium
TESTSUITE_SELENIUM_BROWSER: chrome
TESTSUITE_USER: root
TESTSUITE_URL: http://127.0.0.1:8000
TESTSUITE_SERVER: "db-server"
TESTSUITE_DATABASE: "selenium"
TESTSUITE_SELENIUM_HOST: "127.0.0.1"
TESTSUITE_SELENIUM_PORT: "4444"
run: ./vendor/bin/phpunit --group selenium --verbose --debug
- name: Output selenium server logs
if: ${{ success() || failure() }}
run: docker logs selenium
- name: Stop selenium server
if: ${{ success() || failure() }}
run: docker stop selenium