2022-12-11 18:46:30 -05:00
|
|
|
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
name: E2E Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ develop ]
|
|
|
|
pull_request_target:
|
|
|
|
branches: [ develop ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ develop ]
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ !!github.event.pull_request && github.event.pull_request.head.label || github.ref }}-${{ github.event_name }}-${{ github.job }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
env:
|
|
|
|
NODEJS_VERSION: 18
|
|
|
|
HEAD_COMMIT_HASH: "${{ !!github.event.pull_request && github.event.pull_request.head.sha || github.sha }}"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
backend-sqlite: # This run also collects coverage
|
|
|
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-04-13 09:45:37 -04:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Setup node
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
|
|
|
|
|
|
|
- name: Run e2e tests
|
|
|
|
run: yarn turbo run test:e2e:ci --filter=backend
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
HEDGEDOC_TEST_DB_TYPE: sqlite
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
|
|
|
|
|
|
- name: Upload coverage
|
2023-04-20 16:30:39 -04:00
|
|
|
uses: codecov/codecov-action@894ff025c7b54547a9a2a1e9f228beae737ad3c2 # v3.1.3
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
directory: backend/coverage-e2e
|
|
|
|
flags: e2e-tests
|
|
|
|
|
|
|
|
backend-mariadb:
|
|
|
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
mariadb:
|
|
|
|
image: mariadb
|
|
|
|
env:
|
|
|
|
MYSQL_USER: hedgedoc
|
|
|
|
MYSQL_PASSWORD: hedgedoc
|
|
|
|
MYSQL_DATABASE: hedgedoc
|
|
|
|
MYSQL_ROOT_PASSWORD: hedgedoc
|
|
|
|
options: --health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
|
|
|
|
ports:
|
|
|
|
- 3306:3306
|
|
|
|
steps:
|
2023-04-13 09:45:37 -04:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Setup node
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
|
|
|
|
|
|
|
- name: Run e2e tests
|
|
|
|
run: yarn turbo run test:e2e:ci --filter=backend
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
HEDGEDOC_TEST_DB_TYPE: mariadb
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
|
|
|
|
|
|
backend-postgres:
|
|
|
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: hedgedoc
|
|
|
|
POSTGRES_USER: hedgedoc
|
|
|
|
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
steps:
|
2023-04-13 09:45:37 -04:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Setup node
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
|
|
|
|
|
|
|
- name: Run e2e tests
|
|
|
|
run: yarn turbo run test:e2e:ci --filter=backend
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
HEDGEDOC_TEST_DB_TYPE: postgres
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
|
|
|
|
|
|
frontend-build:
|
|
|
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Build test build of frontend
|
|
|
|
steps:
|
|
|
|
- name: Check out repo
|
2023-04-13 09:45:37 -04:00
|
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
ref: ${{ env.HEAD_COMMIT_HASH }}
|
|
|
|
|
|
|
|
- name: Setup node
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
|
|
|
|
|
|
|
- name: Build test production build
|
|
|
|
run: yarn turbo run build:test --filter=frontend
|
|
|
|
shell: bash
|
|
|
|
env:
|
2023-04-18 04:38:04 -04:00
|
|
|
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
2022-12-11 18:46:30 -05:00
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
|
|
|
2023-04-18 04:38:04 -04:00
|
|
|
- name: Compress build
|
|
|
|
run: tar --exclude='frontend/.next/cache' --exclude='frontend/.next/standalone' --zstd -cf frontend-e2e-build.tar.zst frontend/.next/
|
|
|
|
|
|
|
|
- name: Upload build artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: frontend-e2e-build
|
|
|
|
retention-days: 1
|
|
|
|
path: frontend-e2e-build.tar.zst
|
|
|
|
|
2022-12-11 18:46:30 -05:00
|
|
|
frontend-cypress:
|
|
|
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
|
|
|
needs: frontend-build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2023-03-16 04:43:45 -04:00
|
|
|
image: cypress/browsers:node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1
|
2022-12-11 18:46:30 -05:00
|
|
|
options: --shm-size=2g
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
containers: [ 1, 2, 3 ]
|
|
|
|
steps:
|
2023-04-18 04:38:04 -04:00
|
|
|
- name: Install jq and zstd
|
|
|
|
run: apt-get update && apt-get install -y jq zstd
|
|
|
|
|
2022-12-11 18:46:30 -05:00
|
|
|
- name: Check out repo
|
2023-04-13 09:45:37 -04:00
|
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-04-18 04:38:04 -04:00
|
|
|
with:
|
|
|
|
ref: ${{ env.HEAD_COMMIT_HASH }}
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
- name: Setup node
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
|
|
|
|
2023-04-18 04:38:04 -04:00
|
|
|
- name: Download build
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: frontend-e2e-build
|
2022-12-11 18:46:30 -05:00
|
|
|
|
2023-04-18 04:38:04 -04:00
|
|
|
- name: Decompress build
|
|
|
|
run: tar -xf frontend-e2e-build.tar.zst
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
- name: Run server
|
|
|
|
working-directory: frontend/
|
|
|
|
run: yarn start:ci &
|
|
|
|
env:
|
|
|
|
NODE_ENV: test
|
|
|
|
|
|
|
|
- name: Wait for server
|
|
|
|
run: "sleep 3 && curl --max-time 120 http://127.0.0.1:3001/"
|
|
|
|
|
|
|
|
- name: Run cypress
|
|
|
|
run: yarn turbo run test:e2e:ci --filter=frontend
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
|
|
CYPRESS_CONTAINER_ID: ${{ matrix.containers }}
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 # master
|
|
|
|
with:
|
|
|
|
name: screenshots
|
|
|
|
path: cypress/screenshots
|