You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.0 KiB
YAML
87 lines
2.0 KiB
YAML
name: Lint & Test
|
|
|
|
on:
|
|
push:
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 16.x
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v2
|
|
id: cache-npm-packages
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install NPM dependencies
|
|
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
needs: prepare
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 16.x
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v2
|
|
id: cache-npm-packages
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install NPM dependencies
|
|
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Lint Scripts
|
|
run: npm run lint
|
|
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
needs: prepare
|
|
env:
|
|
CI: true
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 16.x
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v2
|
|
id: cache-npm-packages
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install NPM dependencies
|
|
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Run tests
|
|
run: npm run test
|