mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 11:15:23 -04:00
refactor(ci): restructure workflows
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
cad64b4b1a
commit
b7dcd43d9d
4 changed files with 111 additions and 65 deletions
36
.github/actions/setup-node/action.yml
vendored
Normal file
36
.github/actions/setup-node/action.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: Setup Node
|
||||||
|
description: "Setups node and configures the cache"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
NODEJS_VERSION:
|
||||||
|
required: true
|
||||||
|
description: "NodeJS version to install"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Get yarn cache directory path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Cache yarn cache
|
||||||
|
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
|
||||||
|
id: yarn-cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-master
|
||||||
|
|
||||||
|
- name: Set up NodeJS
|
||||||
|
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||||
|
with:
|
||||||
|
node-version: ${{ inputs.NODEJS_VERSION }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --frozen-lockfile --prefer-offline
|
||||||
|
working-directory: .
|
||||||
|
shell: bash
|
43
.github/workflows/build-and-test.yml
vendored
Normal file
43
.github/workflows/build-and-test.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: Build & run tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node: ['14', '16']
|
||||||
|
name: Node ${{ 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 run build
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: yarn run mocha-suite
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
if: github.ref == 'refs/heads/master' && matrix.node-version == '16'
|
||||||
|
with:
|
||||||
|
name: Prebuild with Node.js ${{ matrix.node-version }}
|
||||||
|
path: |
|
||||||
|
**
|
||||||
|
!.git
|
||||||
|
!node_modules
|
32
.github/workflows/lint.yml
vendored
Normal file
32
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Lint files
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
|
with:
|
||||||
|
NODEJS_VERSION: '16'
|
||||||
|
|
||||||
|
- name: Run ESLint
|
||||||
|
run: yarn run eslint
|
||||||
|
|
||||||
|
- name: Lint markdown files
|
||||||
|
run: yarn run markdownlint
|
||||||
|
|
||||||
|
- name: Lint shell scripts with shellcheck
|
||||||
|
run: shellcheck bin/heroku bin/setup
|
||||||
|
|
||||||
|
- name: Lint JSON files
|
||||||
|
run: sudo apt install -y jq && yarn run jsonlint
|
65
.github/workflows/node.js.yml
vendored
65
.github/workflows/node.js.yml
vendored
|
@ -1,65 +0,0 @@
|
||||||
name: Node.js CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
static-tests:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
command:
|
|
||||||
- yarn run eslint
|
|
||||||
- yarn run markdownlint
|
|
||||||
- shellcheck bin/heroku bin/setup
|
|
||||||
- sudo apt install -y jq && yarn run jsonlint
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Use Node.js 16
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: yarn
|
|
||||||
- run: yarn --frozen-lockfile --prefer-offline
|
|
||||||
- run: ${{matrix.command}}
|
|
||||||
dynamic-tests:
|
|
||||||
needs: static-tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [14, 16]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: yarn
|
|
||||||
- run: yarn --frozen-lockfile --prefer-offline
|
|
||||||
- run: yarn run mocha-suite
|
|
||||||
production-build:
|
|
||||||
needs: dynamic-tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [14, 16]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: yarn
|
|
||||||
- run: yarn --frozen-lockfile --prefer-offline
|
|
||||||
- run: yarn run build
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: github.ref == 'refs/heads/master' && matrix.node-version == '16'
|
|
||||||
with:
|
|
||||||
name: Prebuild with Node.js ${{ matrix.node-version }}
|
|
||||||
path: |
|
|
||||||
**
|
|
||||||
!.git
|
|
||||||
!node_modules
|
|
Loading…
Add table
Add a link
Reference in a new issue