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:
|
2020-08-15 10:17:06 -04:00
|
|
|
branches: [main]
|
2020-07-16 05:22:53 -04:00
|
|
|
pull_request:
|
2020-08-15 10:17:06 -04:00
|
|
|
branches: [main]
|
2020-07-16 05:22:53 -04:00
|
|
|
|
|
|
|
jobs:
|
2021-01-06 07:09:33 -05:00
|
|
|
e2e:
|
2020-08-19 16:43:56 -04:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-06 07:09:33 -05:00
|
|
|
name: Perform E2E Tests on BrowserStack
|
2020-08-19 16:43:56 -04:00
|
|
|
steps:
|
2021-01-06 07:09:33 -05:00
|
|
|
- name: Check out repo
|
|
|
|
uses: actions/checkout@v2
|
2020-11-29 04:07:44 -05:00
|
|
|
|
2021-01-11 15:55:25 -05:00
|
|
|
- name: Get branch and commit
|
|
|
|
id: gitinfo
|
|
|
|
run: |
|
|
|
|
if [ -n "${{ github.event.pull_request.head.sha }}" ]; \
|
|
|
|
then echo "::set-output name=shapr::$(echo ${{ github.event.pull_request.head.sha }} | cut -c -7) - #${{ github.event.pull_request.number }}"; \
|
|
|
|
else echo "::set-output name=shapr::$(echo ${{ github.sha }} | cut -c -7)"; fi
|
|
|
|
echo "::set-output name=branch::${GITHUB_HEAD_REF:-main}"
|
|
|
|
|
2020-11-29 04:07:44 -05:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
2020-08-19 16:43:56 -04:00
|
|
|
- name: Cache node_modules
|
2020-11-29 04:07:44 -05:00
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
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 }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
|
|
|
- name: Set up NodeJS
|
2020-12-18 19:39:40 -05:00
|
|
|
uses: actions/setup-node@v2
|
2020-08-19 16:43:56 -04:00
|
|
|
with:
|
2020-11-29 04:07:44 -05:00
|
|
|
node-version: 14
|
|
|
|
|
2021-01-11 15:55:25 -05:00
|
|
|
- name: Install sponge utility
|
|
|
|
run: sudo apt-get install -yqq moreutils
|
|
|
|
|
2021-01-06 07:09:33 -05:00
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --frozen-lockfile --prefer-offline
|
2020-08-19 16:43:56 -04:00
|
|
|
|
2021-01-06 07:09:33 -05:00
|
|
|
- name: Build test production build
|
|
|
|
run: yarn build:test
|
|
|
|
|
|
|
|
- name: Start http server
|
|
|
|
run: yarn serve:build &
|
|
|
|
|
2021-01-11 15:55:25 -05:00
|
|
|
- name: Set BrowserStack config values
|
|
|
|
run: jq '.run_settings.build_name = "${{ steps.gitinfo.outputs.shapr }} - ${{ steps.gitinfo.outputs.branch }}"' browserstack.json | sponge browserstack.json
|
|
|
|
|
2021-01-06 07:09:33 -05:00
|
|
|
- name: Set up BrowserStack environment
|
|
|
|
uses: 'browserstack/github-actions/setup-env@master'
|
2020-08-19 16:43:56 -04:00
|
|
|
with:
|
2021-01-06 07:09:33 -05:00
|
|
|
username: ${{ secrets.BROWSERSTACK_USERNAME }}
|
|
|
|
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
|
|
|
|
|
|
|
- name: Set up BrowserStack local connection
|
|
|
|
uses: 'browserstack/github-actions/setup-local@master'
|
2020-07-16 05:22:53 -04:00
|
|
|
with:
|
2021-01-06 07:09:33 -05:00
|
|
|
local-testing: start
|
|
|
|
local-identifier: random
|
|
|
|
|
2021-01-11 15:55:25 -05:00
|
|
|
- name: Enable cypress videos
|
|
|
|
run: jq '.video = true' cypress.json | sponge cypress.json
|
2021-01-06 07:09:33 -05:00
|
|
|
|
|
|
|
- name: Run BrowserStack Tests
|
|
|
|
run: yarn run cy:browserstack
|
|
|
|
|
|
|
|
- name: Stop BrowserStack local connection
|
|
|
|
uses: 'browserstack/github-actions/setup-local@master'
|
2020-11-15 14:07:02 -05:00
|
|
|
with:
|
2021-01-06 07:09:33 -05:00
|
|
|
local-testing: stop
|