2022-03-06 17:56:46 +00:00
|
|
|
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-10-02 18:10:32 +00:00
|
|
|
name: Backend / E2E Tests
|
2022-03-06 17:56:46 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ develop ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ develop ]
|
|
|
|
|
2022-12-04 21:14:59 +00:00
|
|
|
concurrency:
|
2022-12-05 17:40:59 +00:00
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
2022-12-04 21:14:59 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-03-06 20:05:40 +00:00
|
|
|
env:
|
2022-04-26 12:31:58 +00:00
|
|
|
NODEJS_VERSION: 18
|
2022-03-06 20:05:40 +00:00
|
|
|
|
2022-10-02 18:10:32 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: backend
|
2022-03-06 20:05:40 +00:00
|
|
|
|
2022-03-06 17:56:46 +00:00
|
|
|
jobs:
|
2022-11-11 11:00:45 +00:00
|
|
|
changes:
|
|
|
|
name: Check for backend changes
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
pull-requests: read
|
|
|
|
outputs:
|
2022-11-21 16:24:36 +00:00
|
|
|
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
2022-11-11 11:00:45 +00:00
|
|
|
steps:
|
2022-11-20 21:16:54 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-21 16:24:36 +00:00
|
|
|
if: github.event_name != 'push'
|
|
|
|
|
2022-11-11 11:00:45 +00:00
|
|
|
- name: Check for backend file changes
|
2022-11-21 16:24:36 +00:00
|
|
|
if: github.event_name != 'push'
|
2022-11-11 11:00:45 +00:00
|
|
|
uses: dorny/paths-filter@v2
|
|
|
|
id: changed
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
files:
|
2022-12-04 21:41:39 +00:00
|
|
|
- 'commons/**'
|
2022-11-11 11:00:45 +00:00
|
|
|
- 'backend/**'
|
|
|
|
- '.github/**'
|
|
|
|
- '.yarn/**'
|
|
|
|
|
2022-03-06 17:56:46 +00:00
|
|
|
sqlite: # This run also collects coverage
|
2022-11-11 11:00:45 +00:00
|
|
|
needs: changes
|
2022-03-06 17:56:46 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-03-06 17:56:46 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-11-11 11:00:45 +00:00
|
|
|
|
2022-11-29 16:36:57 +00:00
|
|
|
- name: Setup node
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-11-29 16:36:57 +00:00
|
|
|
uses: ./.github/actions/setup-node
|
2022-03-06 17:56:46 +00:00
|
|
|
with:
|
2022-11-29 16:36:57 +00:00
|
|
|
NODE_VERSION: ${{ env.NODEJS_VERSION }}
|
2022-11-11 11:00:45 +00:00
|
|
|
|
2022-03-06 17:56:46 +00:00
|
|
|
- run: yarn run test:e2e:cov
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
|
|
|
|
2022-04-10 00:02:23 +00:00
|
|
|
- uses: codecov/codecov-action@v3
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-03-06 17:56:46 +00:00
|
|
|
with:
|
2022-10-02 18:10:32 +00:00
|
|
|
directory: backend/coverage-e2e
|
2022-03-06 17:56:46 +00:00
|
|
|
flags: e2e-tests
|
|
|
|
|
|
|
|
mariadb:
|
2022-11-11 11:00:45 +00:00
|
|
|
needs: changes
|
2022-03-06 17:56:46 +00:00
|
|
|
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:
|
|
|
|
- uses: actions/checkout@v3
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-03-06 17:56:46 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-11-11 11:00:45 +00:00
|
|
|
|
2022-12-06 11:04:11 +00:00
|
|
|
- name: Setup node
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-12-06 11:04:11 +00:00
|
|
|
uses: ./.github/actions/setup-node
|
2022-03-06 17:56:46 +00:00
|
|
|
with:
|
2022-12-06 11:04:11 +00:00
|
|
|
NODE_VERSION: ${{ env.NODEJS_VERSION }}
|
2022-11-11 11:00:45 +00:00
|
|
|
|
2022-03-06 17:56:46 +00:00
|
|
|
- run: yarn run test:e2e
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-03-06 17:56:46 +00:00
|
|
|
env:
|
|
|
|
HEDGEDOC_TEST_DB_TYPE: mariadb
|
|
|
|
|
|
|
|
postgres:
|
2022-11-11 11:00:45 +00:00
|
|
|
needs: changes
|
2022-03-06 17:56:46 +00:00
|
|
|
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:
|
|
|
|
- uses: actions/checkout@v3
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-03-06 17:56:46 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-11-11 11:00:45 +00:00
|
|
|
|
2022-12-06 11:04:11 +00:00
|
|
|
- name: Setup node
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-12-06 11:04:11 +00:00
|
|
|
uses: ./.github/actions/setup-node
|
2022-03-06 17:56:46 +00:00
|
|
|
with:
|
2022-12-06 11:04:11 +00:00
|
|
|
NODE_VERSION: ${{ env.NODEJS_VERSION }}
|
2022-11-11 11:00:45 +00:00
|
|
|
|
2022-03-06 17:56:46 +00:00
|
|
|
- run: yarn run test:e2e
|
2022-11-11 11:00:45 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-03-06 17:56:46 +00:00
|
|
|
env:
|
|
|
|
HEDGEDOC_TEST_DB_TYPE: postgres
|