2021-05-20 11:30:42 +02:00
|
|
|
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
|
|
|
2021-05-20 15:45:18 +02:00
|
|
|
# yarn cache setup from https://www.karltarvas.com/2020/12/09/github-actions-cache-yarn-install.html
|
|
|
|
|
2021-05-20 11:30:42 +02:00
|
|
|
name: Code checks
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
node-version: [14.x]
|
|
|
|
|
|
|
|
steps:
|
2021-05-20 15:34:06 +02:00
|
|
|
- name: Checkout source
|
2021-05-20 11:30:42 +02:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install tools
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2021-05-20 15:40:53 +02:00
|
|
|
# See: https://github.com/actions/cache/blob/main/examples.md#node---yarn
|
2021-05-20 15:34:06 +02:00
|
|
|
- name: Get Yarn cache directory
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- name: Use Yarn cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --prefer-offline --frozen-lockfile
|
2021-05-20 11:30:42 +02:00
|
|
|
- name: Unit tests
|
2021-05-20 15:34:06 +02:00
|
|
|
run: yarn test
|
2021-05-20 11:30:42 +02:00
|
|
|
- name: Lint
|
2021-05-20 15:34:06 +02:00
|
|
|
run: yarn run lint-ci
|