hedgedoc/.github/workflows/e2e.yml
Tilman Vatteroth f4e5d795e6
Parallel ci jobs (#1323)
* Add parallel testing to e2e ci job

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-06-17 21:18:52 +02:00

95 lines
2.4 KiB
YAML

# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: AGPL-3.0-only
name: e2e
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-frontend:
runs-on: ubuntu-latest
name: Build test build of frontend
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Cache build
uses: actions/cache@v2.1.6
with:
path: build
key: build-${{ hashFiles('src/**') }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up NodeJS
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
- name: Build test production build
run: yarn build:test
- uses: actions/upload-artifact@master
with:
name: build
path: build
end2end:
name: Perform E2E Test in ${{ matrix.browser }}
needs: build-frontend
runs-on: ubuntu-latest
container:
image: cypress/browsers:node14.16.0-chrome90-ff88
options: --user 1001 --shm-size=2g
strategy:
fail-fast: false
matrix:
browser: [ 'chrome', 'firefox' ]
containers: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Download built frontend
uses: actions/download-artifact@master
with:
name: build
path: build
- uses: cypress-io/github-action@v2
with:
browser: ${{ matrix.browser }}
start: 'yarn serve:build'
parallel: true
record: true
group: "UI - ${{ matrix.browser }}"
wait-on: 'http://127.0.0.1:3001/'
wait-on-timeout: 120
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@master
if: always()
with:
name: screenshots
path: cypress/screenshots