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