hedgedoc/.github/workflows/node.js.yml

95 lines
2.9 KiB
YAML
Raw Normal View History

name: Node.js CI
on:
push:
branches:
- master
- renovate/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@v2
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile --prefer-offline
- run: ${{matrix.command}}
dynamic-tests:
needs: static-tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 15.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-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: [12.x, 14.x, 15.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile --prefer-offline
- run: yarn run build
- uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/master' && matrix.node-version == '14.x'
with:
name: Prebuild with Node.js ${{ matrix.node-version }}
path: |
**
!.git
!node_modules