2021-01-06 20:37:59 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-11-11 09:55:08 +00:00
|
|
|
name: Frontend / Run unit tests & build
|
2020-05-27 13:43:28 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-11-11 09:55:08 +00:00
|
|
|
branches: [ develop ]
|
2020-05-27 13:43:28 +00:00
|
|
|
pull_request:
|
2022-11-11 09:55:08 +00:00
|
|
|
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-11-11 09:55:08 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: frontend
|
2020-05-27 13:43:28 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-11-11 09:55:08 +00:00
|
|
|
changes:
|
|
|
|
name: Check for frontend 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 09:55:08 +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 09:55:08 +00:00
|
|
|
- name: Check for frontend file changes
|
2022-11-21 16:24:36 +00:00
|
|
|
if: github.event_name != 'push'
|
2022-11-11 09:55:08 +00:00
|
|
|
uses: dorny/paths-filter@v2
|
|
|
|
id: changed
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
files:
|
2022-12-04 21:41:39 +00:00
|
|
|
- 'commons/**'
|
2022-11-11 09:55:08 +00:00
|
|
|
- 'frontend/**'
|
|
|
|
- '.github/**'
|
|
|
|
- '.yarn/**'
|
|
|
|
|
2020-05-27 13:43:28 +00:00
|
|
|
build:
|
2022-11-11 09:55:08 +00:00
|
|
|
needs: changes
|
2020-05-27 13:43:28 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-06-06 22:02:50 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-06-15 18:40:26 +00:00
|
|
|
node: [ '14', '16', '18' ]
|
2020-08-31 10:48:58 +00:00
|
|
|
name: Test and build with NodeJS ${{ matrix.node }}
|
2020-05-27 13:43:28 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-11-11 09:55:08 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-03-05 15:27:37 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-10-21 16:57:29 +00:00
|
|
|
|
2022-11-29 16:36:57 +00:00
|
|
|
- name: Setup node
|
2022-11-11 09:55:08 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-11-29 16:36:57 +00:00
|
|
|
uses: ./.github/actions/setup-node
|
2020-05-27 13:43:28 +00:00
|
|
|
with:
|
2022-11-29 16:36:57 +00:00
|
|
|
NODE_VERSION: ${{ matrix.node }}
|
2022-10-21 16:57:29 +00:00
|
|
|
|
2020-07-18 20:17:36 +00:00
|
|
|
- name: Test Project
|
2022-11-11 09:55:08 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2021-12-25 15:44:24 +00:00
|
|
|
run: yarn test:ci
|
2022-10-21 16:57:29 +00:00
|
|
|
|
2020-06-06 22:02:50 +00:00
|
|
|
- name: Build project
|
2022-11-11 09:55:08 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2021-05-02 20:38:43 +00:00
|
|
|
run: yarn build:mock
|