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:
|
2023-05-09 05:38:02 -04:00
|
|
|
NODEJS_VERSION: 20
|
2022-12-11 18:46:30 -05:00
|
|
|
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-10-17 14:05:43 -04:00
|
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
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
|
2023-09-07 13:56:20 -04:00
|
|
|
run: yarn test:e2e:ci --filter=backend
|
2022-12-11 18:46:30 -05:00
|
|
|
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-05-15 20:31:36 -04:00
|
|
|
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
directory: backend/coverage-e2e
|
2023-08-06 13:34:20 -04:00
|
|
|
flags: backend, e2e-tests, backend-e2e-tests
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
backend-mariadb:
|
|
|
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
mariadb:
|
2023-06-11 08:39:50 -04:00
|
|
|
# renovate: datasource=docker depName=mariadb
|
2023-10-13 10:18:49 -04:00
|
|
|
image: mariadb:11.1.2@sha256:2403cc521634162f743b5179ff5b35520daf72df5d9e7e397192af685d9148fd
|
2022-12-11 18:46:30 -05:00
|
|
|
env:
|
|
|
|
MYSQL_USER: hedgedoc
|
|
|
|
MYSQL_PASSWORD: hedgedoc
|
|
|
|
MYSQL_DATABASE: hedgedoc
|
|
|
|
MYSQL_ROOT_PASSWORD: hedgedoc
|
2023-06-19 13:50:00 -04:00
|
|
|
MARIADB_MYSQL_LOCALHOST_USER: 1
|
|
|
|
MARIADB_MYSQL_LOCALHOST_GRANTS: USAGE
|
|
|
|
options: --health-cmd "healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval 10s --health-timeout 5s --health-retries 10
|
2022-12-11 18:46:30 -05:00
|
|
|
ports:
|
|
|
|
- 3306:3306
|
|
|
|
steps:
|
2023-10-17 14:05:43 -04:00
|
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
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
|
2023-09-07 13:56:20 -04:00
|
|
|
run: yarn test:e2e:ci --filter=backend
|
2022-12-11 18:46:30 -05:00
|
|
|
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:
|
2023-06-11 08:44:47 -04:00
|
|
|
# renovate: datasource=docker depName=postgres
|
2023-10-13 12:08:12 -04:00
|
|
|
image: postgres:16.0@sha256:3d9ed832906091d609cfd6f283e79492ace01ba15866b21d8a262e8fd1cdfb55
|
2022-12-11 18:46:30 -05:00
|
|
|
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-10-17 14:05:43 -04:00
|
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
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
|
2023-09-07 13:56:20 -04:00
|
|
|
run: yarn test:e2e:ci --filter=backend
|
2022-12-11 18:46:30 -05:00
|
|
|
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-10-17 14:05:43 -04:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
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
|
2023-09-07 13:56:20 -04:00
|
|
|
run: yarn build:test --filter=frontend
|
2022-12-11 18:46:30 -05:00
|
|
|
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
|
2023-08-26 08:26:47 -04:00
|
|
|
run: tar --zstd -cf frontend-e2e-build.tar.zst frontend/dist/
|
2023-04-18 04:38:04 -04:00
|
|
|
|
|
|
|
- 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-07-09 06:31:23 -04:00
|
|
|
image: cypress/browsers:node-18.16.0-chrome-113.0.5672.92-1-ff-113.0-edge-113.0.1774.35-1@sha256:6bf406250fcdf27fcdcea54c9087f54e1cbaf4c6c5420cced8840efc7f6b144e
|
2022-12-11 18:46:30 -05:00
|
|
|
options: --shm-size=2g
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
containers: [ 1, 2, 3 ]
|
|
|
|
steps:
|
2023-05-04 16:26:26 -04:00
|
|
|
- name: Install additional packages
|
2023-05-09 05:57:02 -04:00
|
|
|
run: apt-get update && apt-get install -y jq zstd screen curl
|
2023-04-18 04:38:04 -04:00
|
|
|
|
2022-12-11 18:46:30 -05:00
|
|
|
- name: Check out repo
|
2023-10-17 14:05:43 -04:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
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/
|
2023-08-26 08:26:47 -04:00
|
|
|
run: (screen -dmS server -L yarn start) && sleep 3 && (tail -f screenlog.0 &)
|
2022-12-11 18:46:30 -05:00
|
|
|
env:
|
|
|
|
NODE_ENV: test
|
2023-08-26 08:26:47 -04:00
|
|
|
HOSTNAME: "127.0.0.1"
|
|
|
|
HD_BASE_URL: "http://127.0.0.1:3001/"
|
|
|
|
PORT: 3001
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
- name: Wait for server
|
2023-05-04 16:26:26 -04:00
|
|
|
run: "curl -L --max-time 120 http://127.0.0.1:3001/"
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
- name: Run cypress
|
2023-09-07 13:56:20 -04:00
|
|
|
run: yarn test:e2e:ci --filter=frontend
|
2022-12-11 18:46:30 -05:00
|
|
|
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 }}
|
|
|
|
|
2023-09-06 18:17:15 -04:00
|
|
|
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # master
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
name: screenshots
|
|
|
|
path: cypress/screenshots
|