mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 14:25:38 -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
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