2020-11-11 04:03:08 -05:00
|
|
|
name: Node.js CI
|
|
|
|
|
2020-11-26 15:21:12 -05:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [master]
|
|
|
|
pull_request:
|
|
|
|
branches: [master]
|
2020-11-11 04:03:08 -05:00
|
|
|
|
|
|
|
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
|
2021-02-05 15:59:08 -05:00
|
|
|
uses: actions/setup-node@v2
|
2020-11-11 04:03:08 -05:00
|
|
|
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:
|
2021-04-22 12:47:22 -04:00
|
|
|
node-version: [12.x, 14.x, 15.x, 16.x]
|
2020-11-11 04:03:08 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2021-02-05 15:59:08 -05:00
|
|
|
uses: actions/setup-node@v2
|
2020-11-11 04:03:08 -05:00
|
|
|
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:
|
2021-04-22 12:47:22 -04:00
|
|
|
node-version: [12.x, 14.x, 15.x, 16.x]
|
2020-11-11 04:03:08 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2021-02-05 15:59:08 -05:00
|
|
|
uses: actions/setup-node@v2
|
2020-11-11 04:03:08 -05:00
|
|
|
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
|
2020-11-17 18:12:25 -05:00
|
|
|
- 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
|