mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 21:44:21 -04:00
misc: add turbo monorepo util
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de> Co-authored-by: David Mehren <git@herrmehren.de> Co-authored-by: Erik Michelson <github@erik.michelson.eu> Signed-off-by: Erik Michelson <github@erik.michelson.eu> Signed-off-by: David Mehren <git@herrmehren.de> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e3512d3a87
commit
305b6f5910
41 changed files with 785 additions and 1218 deletions
15
.github/actions/setup-node/action.yml
vendored
15
.github/actions/setup-node/action.yml
vendored
|
@ -6,9 +6,9 @@ name: Setup Node
|
|||
description: "Setups node and configures the cache"
|
||||
|
||||
inputs:
|
||||
NODE_VERSION:
|
||||
NODEJS_VERSION:
|
||||
required: true
|
||||
type: string
|
||||
description: "NodeJS version to install"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
@ -23,21 +23,16 @@ runs:
|
|||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ inputs.NODE_VERSION }}-yarn-${{ hashFiles('frontend/yarn.lock') }}
|
||||
key: ${{ runner.os }}-${{ inputs.NODEJS_VERSION }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ inputs.NODE_VERSION }}
|
||||
${{ runner.os }}-yarn-${{ inputs.NODEJS_VERSION }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||
with:
|
||||
node-version: ${{ inputs.NODE_VERSION }}
|
||||
node-version: ${{ inputs.NODEJS_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
working-directory: .
|
||||
shell: bash
|
||||
|
||||
- name: Build commons lib
|
||||
run: yarn build
|
||||
working-directory: commons
|
||||
shell: bash
|
||||
|
|
24
.github/workflows/backend-docker-cleanup.yml
vendored
24
.github/workflows/backend-docker-cleanup.yml
vendored
|
@ -1,24 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Delete old container images
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # every day at midnight
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
clean-ghcr:
|
||||
name: Cleanup CI containers
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cleanup CI containers
|
||||
uses: snok/container-retention-policy@6601a342b42bf08909bbd5b48736d4176100365b # v1.5.1
|
||||
with:
|
||||
image-names: hedgedoc-ci
|
||||
cut-off: A day ago UTC
|
||||
account-type: org
|
||||
org-name: ${{ github.repository_owner }}
|
||||
token: ${{ secrets.PAT_IMAGE_CLEANUP }}
|
143
.github/workflows/backend-docker.yml
vendored
143
.github/workflows/backend-docker.yml
vendored
|
@ -1,143 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Backend / Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request_target:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
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
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for backend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for backend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'backend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
build-dev:
|
||||
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98 # v2.4.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Login to GHCR
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build dev image
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
with:
|
||||
push: true
|
||||
file: backend/docker/Dockerfile
|
||||
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
target: development
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
||||
|
||||
sqlite-test:
|
||||
runs-on: ubuntu-latest
|
||||
if: needs.changes.outputs.changed == 'true' && (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork
|
||||
needs: [ build-dev, changes ]
|
||||
container:
|
||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
steps:
|
||||
- run: cd /usr/src/app/backend && yarn run test
|
||||
|
||||
sqlite-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
if: needs.changes.outputs.changed == 'true' && (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork
|
||||
needs: [ build-dev, changes ]
|
||||
container:
|
||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
steps:
|
||||
- run: cd /usr/src/app/backend && yarn run test:e2e
|
||||
|
||||
build-prod:
|
||||
runs-on: ubuntu-latest
|
||||
if: (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork
|
||||
needs: [ sqlite-test, sqlite-e2e, changes ]
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Generate Docker metadata
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
id: meta
|
||||
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98 # v2.4.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Login to GHCR
|
||||
if: github.event_name == 'push' && needs.changes.outputs.changed == 'true'
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
with:
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
file: backend/docker/Dockerfile
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
130
.github/workflows/backend-e2e-tests.yml
vendored
130
.github/workflows/backend-e2e-tests.yml
vendored
|
@ -1,130 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Backend / E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NODEJS_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for backend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for backend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'backend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
sqlite: # This run also collects coverage
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- run: yarn run test:e2e:cov
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- uses: codecov/codecov-action@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
directory: backend/coverage-e2e
|
||||
flags: e2e-tests
|
||||
|
||||
mariadb:
|
||||
needs: changes
|
||||
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@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- run: yarn run test:e2e
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
env:
|
||||
HEDGEDOC_TEST_DB_TYPE: mariadb
|
||||
|
||||
postgres:
|
||||
needs: changes
|
||||
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@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- run: yarn run test:e2e
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
env:
|
||||
HEDGEDOC_TEST_DB_TYPE: postgres
|
106
.github/workflows/backend-tests.yml
vendored
106
.github/workflows/backend-tests.yml
vendored
|
@ -1,106 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
|
||||
name: Backend / Lint and Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NODEJS_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for backend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for backend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'backend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
lint:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- run: yarn run lint
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
build:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [ 14.x, 16.x, 18.x ]
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODE_VERSION }}
|
||||
|
||||
- run: yarn run build
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
integration-tests:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODE_VERSION }}
|
||||
|
||||
- run: yarn run test:cov
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
directory: backend/coverage
|
||||
flags: integration-tests
|
92
.github/workflows/codeql-analysis.yml
vendored
92
.github/workflows/codeql-analysis.yml
vendored
|
@ -1,92 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
paths:
|
||||
- 'backend/src/'
|
||||
- 'backend/test/'
|
||||
- 'frontend/src/'
|
||||
- 'frontend/cypress/'
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ develop ]
|
||||
paths:
|
||||
- 'backend/src/'
|
||||
- 'backend/test/'
|
||||
- 'frontend/src/'
|
||||
- 'frontend/cypress/'
|
||||
schedule:
|
||||
- cron: '15 4 * * 3'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: +security-and-quality
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
60
.github/workflows/commons-lint.yml
vendored
60
.github/workflows/commons-lint.yml
vendored
|
@ -1,60 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Commons / Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
env:
|
||||
NODE_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: commons
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for commons changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for frontend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
lint:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
name: Lints all .ts and .tsx files
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Lint code
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn lint
|
68
.github/workflows/commons-tests.yml
vendored
68
.github/workflows/commons-tests.yml
vendored
|
@ -1,68 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Commons / Run unit tests & build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: commons
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for commons changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for frontend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
build:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: [ '14', '16', '18' ]
|
||||
name: Test and build with NodeJS ${{ matrix.node }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ matrix.node }}
|
||||
|
||||
- name: Test Project
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn test
|
||||
|
||||
- name: Build project
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn build
|
89
.github/workflows/docker.yml
vendored
Normal file
89
.github/workflows/docker.yml
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Generate Docker metadata for backend
|
||||
id: meta-backend
|
||||
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/backend
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
|
||||
- name: Generate Docker metadata for frontend
|
||||
id: meta-frontend
|
||||
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/frontend
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98 # v2.4.0
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push backend
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
with:
|
||||
push: true
|
||||
file: backend/docker/Dockerfile
|
||||
tags: ${{ steps.meta-backend.outputs.tags }}
|
||||
labels: ${{ steps.meta-backend.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
||||
build-args:
|
||||
TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"
|
||||
TURBO_API: "${{ vars.TURBO_API }}"
|
||||
TURBO_TEAM: "${{ vars.TURBO_TEAM }}"
|
||||
|
||||
- name: Build and push frontend
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
with:
|
||||
push: true
|
||||
file: frontend/docker/Dockerfile
|
||||
tags: ${{ steps.meta-frontend.outputs.tags }}
|
||||
labels: ${{ steps.meta-frontend.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
||||
build-args:
|
||||
BUILD_VERSION: "${{ github.event.head_commit.id }}"
|
||||
TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"
|
||||
TURBO_API: "${{ vars.TURBO_API }}"
|
||||
TURBO_TEAM: "${{ vars.TURBO_TEAM }}"
|
193
.github/workflows/e2e-tests.yml
vendored
Normal file
193
.github/workflows/e2e-tests.yml
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
# 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:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
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
|
||||
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
|
||||
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:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
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:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
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
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
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:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_API: ${{ vars.TURBO_API }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
frontend-cypress:
|
||||
if: "(github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork"
|
||||
needs: frontend-build
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: cypress/browsers:node18.12.0-chrome106-ff106
|
||||
options: --shm-size=2g
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
containers: [ 1, 2, 3 ]
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- name: Install jq
|
||||
run: apt-get update && apt-get install -y jq
|
||||
|
||||
- name: Build test production build
|
||||
run: yarn turbo run build:test --filter=frontend
|
||||
shell: bash
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_API: ${{ vars.TURBO_API }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
- 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
|
94
.github/workflows/frontend-docker.yml
vendored
94
.github/workflows/frontend-docker.yml
vendored
|
@ -1,94 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Frontend / build docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for frontend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for frontend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'frontend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
build:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Generate Docker metadata
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
id: meta
|
||||
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
|
||||
- name: Set up QEMU
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98 # v2.4.0
|
||||
|
||||
- name: Login to GHCR
|
||||
if: github.event_name != 'pull_request' && needs.changes.outputs.changed == 'true'
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
with:
|
||||
push: true
|
||||
file: frontend/docker/Dockerfile
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
||||
build-args: |
|
||||
BUILD_VERSION=${{ github.event.head_commit.id }}
|
174
.github/workflows/frontend-e2e-tests.yml
vendored
174
.github/workflows/frontend-e2e-tests.yml
vendored
|
@ -1,174 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Frontend / Run E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request_target:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NODE_VERSION: 18
|
||||
HEAD_COMMIT_HASH: "${{ !!github.event.pull_request && github.event.pull_request.head.sha || github.sha }}"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
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
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for frontend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for frontend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'frontend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
build-frontend:
|
||||
needs: changes
|
||||
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
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ env.HEAD_COMMIT_HASH }}
|
||||
|
||||
- name: Cache build
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
|
||||
id: build-cache
|
||||
with:
|
||||
path: frontend/.next
|
||||
key: ${{ env.HEAD_COMMIT_HASH }}
|
||||
|
||||
- name: Setup node
|
||||
if: steps.build-cache.outputs.cache-hit != 'true' && needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Build test production build
|
||||
if: steps.build-cache.outputs.cache-hit != 'true' && needs.changes.outputs.changed == 'true'
|
||||
run: yarn build:test
|
||||
|
||||
- uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 # master
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
retention-days: 1
|
||||
name: e2e-build
|
||||
path: |
|
||||
frontend/.next
|
||||
!frontend/.next/cache
|
||||
!frontend/.next/standalone
|
||||
|
||||
end2end:
|
||||
name: Perform E2E Test in ${{ matrix.browser }}
|
||||
needs:
|
||||
- build-frontend
|
||||
- changes
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: cypress/browsers:node18.12.0-chrome106-ff106
|
||||
options: --user 1001 --shm-size=2g
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
browser: [ 'chrome' ]
|
||||
containers: [ 1, 2, 3, 4, 5 ]
|
||||
steps:
|
||||
- name: Check out repo
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Cache build
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
|
||||
id: build-cache
|
||||
with:
|
||||
path: frontend/.next
|
||||
key: ${{ env.HEAD_COMMIT_HASH }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('frontend/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
if: steps.build-cache.outputs.cache-hit != 'true' && needs.changes.outputs.changed == 'true'
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Download built frontend
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b # master
|
||||
with:
|
||||
name: e2e-build
|
||||
path: frontend/.next
|
||||
|
||||
- name: Run server
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn start:ci &
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
- name: Wait for server
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: "sleep 3 && curl --max-time 120 http://127.0.0.1:3001/"
|
||||
|
||||
- name: Run cypress
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: "yarn cy:run:${{ matrix.browser }} --record true --parallel --group \"UI - ${{ matrix.browser }}\""
|
||||
env:
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 # master
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
name: screenshots
|
||||
path: cypress/screenshots
|
61
.github/workflows/frontend-lint.yml
vendored
61
.github/workflows/frontend-lint.yml
vendored
|
@ -1,61 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Frontend / Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
env:
|
||||
NODE_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for frontend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for frontend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'frontend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
lint:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
name: Lints all .ts and .tsx files
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Lint code
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn lint
|
|
@ -10,7 +10,7 @@ on:
|
|||
|
||||
env:
|
||||
NETLIFY_VERSION: 12.0.11
|
||||
NODE_VERSION: 18
|
||||
NODEJS_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
@ -21,74 +21,47 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for frontend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for frontend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'frontend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
deploy:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploys to netlify
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODE_VERSION }}
|
||||
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- name: Patch intro.md to include netlify banner.
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: cp netlify/intro.md public/public/intro.md
|
||||
|
||||
- name: Patch motd.md to include privacy policy.
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: cp netlify/motd.md public/public/motd.md
|
||||
|
||||
- name: Patch version.json to include git hash
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: jq ".version = \"0.0.0+${GITHUB_SHA:0:8}\"" src/version.json > src/_version.json && mv src/_version.json src/version.json
|
||||
|
||||
- name: Patch base URL
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: echo "HD_BASE_URL=\"https://hedgedoc.dev/\"" >> .env.production
|
||||
|
||||
- name: Build app
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn build:mock
|
||||
run: yarn turbo run build --filter=frontend
|
||||
shell: bash
|
||||
working-directory: .
|
||||
env:
|
||||
NEXT_PUBLIC_USE_MOCK_API: true
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_API: ${{ vars.TURBO_API }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
- name: Remove Next.js cache to avoid it being deployed
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: rm -r .next/cache
|
||||
|
||||
- name: Install netlify CLI
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: "npm install -g netlify-cli@${{ env.NETLIFY_VERSION }}"
|
||||
|
||||
- name: Run netlify CLI deployment
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
run: "netlify deploy --build --prod --message \"${{ github.event.head_commit.id }}: ${{ github.event.head_commit.message }}\""
|
||||
|
|
17
.github/workflows/frontend-netlify-deploy-pr.yml
vendored
17
.github/workflows/frontend-netlify-deploy-pr.yml
vendored
|
@ -28,7 +28,7 @@ permissions:
|
|||
|
||||
env:
|
||||
NETLIFY_VERSION: 12.0.11
|
||||
NODE_VERSION: 18
|
||||
NODEJS_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
@ -59,8 +59,8 @@ jobs:
|
|||
files:
|
||||
- 'commons/**'
|
||||
- 'frontend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
- 'yarn.lock'
|
||||
- 'package.json'
|
||||
|
||||
deploy:
|
||||
needs: changes
|
||||
|
@ -80,7 +80,7 @@ jobs:
|
|||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ env.NODE_VERSION }}
|
||||
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- name: Patch intro.md to include netlify banner.
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
@ -100,7 +100,14 @@ jobs:
|
|||
|
||||
- name: Build app
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn build:mock
|
||||
run: yarn turbo run build --filter=frontend
|
||||
shell: bash
|
||||
working-directory: .
|
||||
env:
|
||||
NEXT_PUBLIC_USE_MOCK_API: true
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_API: ${{ vars.TURBO_API }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
- name: Remove Next.js cache to avoid it being deployed
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
|
69
.github/workflows/frontend-test-and-build.yml
vendored
69
.github/workflows/frontend-test-and-build.yml
vendored
|
@ -1,69 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Frontend / Run unit tests & build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Check for frontend changes
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
if: github.event_name != 'push'
|
||||
|
||||
- name: Check for frontend file changes
|
||||
if: github.event_name != 'push'
|
||||
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: changed
|
||||
with:
|
||||
filters: |
|
||||
files:
|
||||
- 'commons/**'
|
||||
- 'frontend/**'
|
||||
- '.github/**'
|
||||
- '.yarn/**'
|
||||
|
||||
build:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: [ '14', '16', '18' ]
|
||||
name: Test and build with NodeJS ${{ matrix.node }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODE_VERSION: ${{ matrix.node }}
|
||||
|
||||
- name: Test Project
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn test:ci
|
||||
|
||||
- name: Build project
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
run: yarn build:mock
|
36
.github/workflows/lint.yml
vendored
Normal file
36
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Lint and check format
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
env:
|
||||
NODEJS_VERSION: 18
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
name: Lint files and check formatting
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
||||
|
||||
- name: Run ESLint
|
||||
run: yarn turbo run lint
|
||||
shell: bash
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_API: ${{ vars.TURBO_API }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
31
.github/workflows/njsscan-analysis.yml
vendored
31
.github/workflows/njsscan-analysis.yml
vendored
|
@ -1,31 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: "Njsscan Analysis"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ develop ]
|
||||
schedule:
|
||||
- cron: '0 7 * * 6'
|
||||
|
||||
jobs:
|
||||
njsscan:
|
||||
runs-on: ubuntu-latest
|
||||
name: Njsscan code scanning
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
- name: Scan with njsscan
|
||||
id: njsscan
|
||||
uses: ajinabraham/njsscan-action@d58d8b2f26322cd35a9efb8003baac517f226d81 # master
|
||||
with:
|
||||
args: '--sarif --output results.sarif src || true'
|
||||
- name: Upload njsscan report
|
||||
uses: github/codeql-action/upload-sarif@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
with:
|
||||
sarif_file: results.sarif
|
63
.github/workflows/static-analysis.yml
vendored
Normal file
63
.github/workflows/static-analysis.yml
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Static Analysis
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
schedule:
|
||||
- cron: '0 7 * * 6'
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
njsscan:
|
||||
runs-on: ubuntu-latest
|
||||
name: Njsscan code scanning
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
- name: Scan with njsscan
|
||||
id: njsscan
|
||||
uses: ajinabraham/njsscan-action@d58d8b2f26322cd35a9efb8003baac517f226d81 # master
|
||||
with:
|
||||
args: '--sarif --output results.sarif src || true'
|
||||
- name: Upload njsscan report
|
||||
uses: github/codeql-action/upload-sarif@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
codeql:
|
||||
name: CodeQL analysis
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: +security-and-quality
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
59
.github/workflows/test-and-build.yml
vendored
Normal file
59
.github/workflows/test-and-build.yml
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
# 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 ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: [ '14', '16', '18' ]
|
||||
include:
|
||||
- node: '18'
|
||||
coverage: true
|
||||
name: Test and build with NodeJS ${{ matrix.node }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
NODEJS_VERSION: ${{ matrix.node }}
|
||||
|
||||
- name: Build project
|
||||
run: yarn turbo run build
|
||||
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
|
||||
run: yarn turbo run test:ci
|
||||
shell: bash
|
||||
env:
|
||||
NODEJS_VERSION: ${{ matrix.node }}
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_API: ${{ vars.TURBO_API }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
- name: Upload coverage
|
||||
if: "${{ matrix.coverage == true }}"
|
||||
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
|
||||
with:
|
||||
directory: backend/coverage
|
||||
flags: integration-tests
|
Loading…
Add table
Add a link
Reference in a new issue