2021-01-06 20:37:59 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-07-16 09:22:53 +00:00
|
|
|
name: e2e
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-06-17 19:18:52 +00:00
|
|
|
branches: [ main ]
|
2020-07-16 09:22:53 +00:00
|
|
|
pull_request:
|
2021-06-17 19:18:52 +00:00
|
|
|
branches: [ main ]
|
2020-07-16 09:22:53 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-04-11 20:34:53 +00:00
|
|
|
build-frontend:
|
2020-08-19 20:43:56 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-04-11 20:34:53 +00:00
|
|
|
name: Build test build of frontend
|
2020-08-19 20:43:56 +00:00
|
|
|
steps:
|
2021-01-06 12:09:33 +00:00
|
|
|
- name: Check out repo
|
2022-03-05 15:27:37 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-11-29 09:07:44 +00:00
|
|
|
|
2021-04-11 20:34:53 +00:00
|
|
|
- name: Cache build
|
2022-04-15 08:53:32 +00:00
|
|
|
uses: actions/cache@v3.0.2
|
2021-06-21 20:59:21 +00:00
|
|
|
id: build-cache
|
2021-04-11 20:34:53 +00:00
|
|
|
with:
|
2021-12-25 15:44:24 +00:00
|
|
|
path: .next
|
2021-06-21 20:59:21 +00:00
|
|
|
key: build-${{ github.sha }}
|
2021-04-11 20:34:53 +00:00
|
|
|
|
2021-06-13 21:02:39 +00:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
2021-06-21 20:59:21 +00:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2021-12-30 17:45:04 +00:00
|
|
|
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
2021-06-13 21:02:39 +00:00
|
|
|
|
2021-06-21 20:58:54 +00:00
|
|
|
- name: Cache yarn cache
|
2022-04-02 09:07:13 +00:00
|
|
|
uses: actions/cache@v3
|
2020-11-29 09:07:44 +00:00
|
|
|
id: yarn-cache
|
2021-06-21 20:59:21 +00:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2020-08-19 20:43:56 +00:00
|
|
|
with:
|
2020-11-29 09:07:44 +00:00
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
2021-05-24 19:01:16 +00:00
|
|
|
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
|
2020-11-29 09:07:44 +00:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
|
|
|
- name: Set up NodeJS
|
2021-06-21 20:59:21 +00:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2022-02-26 00:36:32 +00:00
|
|
|
uses: actions/setup-node@v3
|
2020-08-19 20:43:56 +00:00
|
|
|
with:
|
2021-05-24 19:01:16 +00:00
|
|
|
node-version: 16
|
2020-11-29 09:07:44 +00:00
|
|
|
|
2021-01-06 12:09:33 +00:00
|
|
|
- name: Install dependencies
|
2021-06-21 20:59:21 +00:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2021-12-30 17:45:04 +00:00
|
|
|
run: yarn install --immutable
|
2020-08-19 20:43:56 +00:00
|
|
|
|
2021-01-06 12:09:33 +00:00
|
|
|
- name: Build test production build
|
2021-06-21 20:59:21 +00:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2021-01-06 12:09:33 +00:00
|
|
|
run: yarn build:test
|
|
|
|
|
2021-04-11 20:34:53 +00:00
|
|
|
- uses: actions/upload-artifact@master
|
|
|
|
with:
|
2021-12-25 15:44:24 +00:00
|
|
|
name: next-build
|
2022-01-01 20:43:06 +00:00
|
|
|
path: |
|
|
|
|
.next
|
|
|
|
!.next/cache
|
2021-01-06 12:09:33 +00:00
|
|
|
|
2021-04-11 20:34:53 +00:00
|
|
|
end2end:
|
|
|
|
name: Perform E2E Test in ${{ matrix.browser }}
|
|
|
|
needs: build-frontend
|
|
|
|
runs-on: ubuntu-latest
|
2021-06-13 21:02:39 +00:00
|
|
|
container:
|
2021-10-16 10:10:13 +00:00
|
|
|
# renovate: datasource=docker depName=cypress/browsers versioning=docker
|
2022-04-15 08:55:32 +00:00
|
|
|
image: cypress/browsers:node16.13.2-chrome100-ff98
|
2021-06-13 21:02:39 +00:00
|
|
|
options: --user 1001 --shm-size=2g
|
2021-04-11 20:34:53 +00:00
|
|
|
strategy:
|
2021-06-17 19:18:52 +00:00
|
|
|
fail-fast: false
|
2021-04-11 20:34:53 +00:00
|
|
|
matrix:
|
2022-04-10 11:45:13 +00:00
|
|
|
browser: [ 'chrome' ]
|
2022-01-03 11:08:46 +00:00
|
|
|
containers: [ 1, 2, 3, 4, 5 ]
|
2021-04-11 20:34:53 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out repo
|
2022-03-05 15:27:37 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-01-11 20:55:25 +00:00
|
|
|
|
2021-04-11 20:34:53 +00:00
|
|
|
- name: Download built frontend
|
|
|
|
uses: actions/download-artifact@master
|
2020-08-19 20:43:56 +00:00
|
|
|
with:
|
2021-12-25 15:44:24 +00:00
|
|
|
name: next-build
|
|
|
|
path: .next
|
2021-01-06 12:09:33 +00:00
|
|
|
|
2021-04-11 20:34:53 +00:00
|
|
|
- uses: cypress-io/github-action@v2
|
2020-07-16 09:22:53 +00:00
|
|
|
with:
|
2021-04-11 20:34:53 +00:00
|
|
|
browser: ${{ matrix.browser }}
|
2021-12-25 15:44:24 +00:00
|
|
|
start: 'yarn start:ci'
|
2021-06-17 19:18:52 +00:00
|
|
|
parallel: true
|
|
|
|
record: true
|
|
|
|
group: "UI - ${{ matrix.browser }}"
|
|
|
|
wait-on: 'http://127.0.0.1:3001/'
|
|
|
|
wait-on-timeout: 120
|
2022-01-02 08:53:48 +00:00
|
|
|
install-command: yarn install --immutable --silent
|
2021-06-17 19:18:52 +00:00
|
|
|
env:
|
|
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-01-06 12:09:33 +00:00
|
|
|
|
2021-04-11 20:34:53 +00:00
|
|
|
- uses: actions/upload-artifact@master
|
|
|
|
if: always()
|
2020-11-15 19:07:02 +00:00
|
|
|
with:
|
2021-04-11 20:34:53 +00:00
|
|
|
name: screenshots
|
|
|
|
path: cypress/screenshots
|