2022-12-11 18:46:30 -05:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
name: Run tests & build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ develop ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ develop ]
|
2024-01-17 06:16:35 -05:00
|
|
|
pull_request_target:
|
|
|
|
branches: [ develop ]
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2024-01-17 06:16:35 -05:00
|
|
|
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
2022-12-11 18:46:30 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-01-17 07:08:08 -05:00
|
|
|
node: [ '20' ] # Are you changing this? Don't forget to update the min. and recommended node version in docs/content/how-to/develop/setup.md!
|
2022-12-11 18:46:30 -05:00
|
|
|
include:
|
2023-05-09 05:38:02 -04:00
|
|
|
- node: '20'
|
2022-12-11 18:46:30 -05:00
|
|
|
coverage: true
|
|
|
|
name: Test and build with NodeJS ${{ matrix.node }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2024-08-28 18:27:28 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
- name: Setup node
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
with:
|
|
|
|
NODEJS_VERSION: ${{ matrix.node }}
|
|
|
|
|
|
|
|
- name: Build project
|
2023-09-07 13:56:20 -04:00
|
|
|
run: yarn build
|
2022-12-11 18:46:30 -05:00
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
NODEJS_VERSION: ${{ matrix.node }}
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
|
|
|
|
|
|
- name: Test Project
|
2023-09-07 13:56:20 -04:00
|
|
|
run: yarn test:ci
|
2022-12-11 18:46:30 -05:00
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
NODEJS_VERSION: ${{ matrix.node }}
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
|
|
|
2023-08-06 13:34:20 -04:00
|
|
|
- name: Upload backend coverage
|
2022-12-11 18:46:30 -05:00
|
|
|
if: "${{ matrix.coverage == true }}"
|
2024-08-29 05:47:52 -04:00
|
|
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
directory: backend/coverage
|
2023-08-06 13:34:20 -04:00
|
|
|
flags: backend, unit-tests, backend-unit-tests
|
|
|
|
|
|
|
|
- name: Upload frontend coverage
|
|
|
|
if: "${{ matrix.coverage == true }}"
|
2024-08-29 05:47:52 -04:00
|
|
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
2023-08-06 13:34:20 -04:00
|
|
|
with:
|
|
|
|
directory: frontend/coverage
|
|
|
|
flags: frontend, unit-tests, frontend-unit-tests
|