2019-09-15 23:27:57 +00:00
|
|
|
name: 'Test'
|
|
|
|
|
2019-09-22 00:37:17 +00:00
|
|
|
on:
|
|
|
|
push:
|
2019-10-01 11:10:45 +00:00
|
|
|
branches:
|
2020-01-17 15:44:07 +00:00
|
|
|
- master
|
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- opened
|
|
|
|
- synchronize
|
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2019-09-15 23:27:57 +00:00
|
|
|
|
|
|
|
jobs:
|
2020-01-17 15:44:07 +00:00
|
|
|
skipci:
|
2019-09-15 23:27:57 +00:00
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
2020-01-17 15:44:07 +00:00
|
|
|
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
2019-10-08 15:20:05 +00:00
|
|
|
|
2020-01-17 15:44:07 +00:00
|
|
|
test:
|
2019-09-21 01:41:21 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-01-17 15:44:07 +00:00
|
|
|
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
2019-09-15 23:27:57 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-01-17 15:44:07 +00:00
|
|
|
os:
|
|
|
|
- 'ubuntu-18.04'
|
|
|
|
- 'macos-latest'
|
|
|
|
- 'windows-latest'
|
2019-09-15 23:27:57 +00:00
|
|
|
steps:
|
|
|
|
|
2020-01-17 15:44:07 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Read .nvmrc
|
|
|
|
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
|
|
|
id: nvm
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
|
|
|
|
|
|
|
- name: Get npm cache directory
|
|
|
|
id: npm-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(npm config get cache)"
|
|
|
|
|
|
|
|
- name: Cache npm
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ${{ steps.npm-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-node-
|
|
|
|
|
|
|
|
- run: npm ci
|
|
|
|
|
|
|
|
- name: Run prettier
|
|
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
|
|
run: npm run format:check
|
|
|
|
|
|
|
|
- name: Run eslint
|
|
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
|
|
run: npm run lint
|
|
|
|
|
|
|
|
- name: Run ncc
|
|
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
- run: npm test
|
|
|
|
|
|
|
|
- name: Upload test coverage as artifact
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: coverage
|
|
|
|
path: coverage
|
|
|
|
|
2020-01-17 17:48:31 +00:00
|
|
|
- name: Upload test coverage to Coveralls
|
|
|
|
uses: coverallsapp/github-action@v1.0.1
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
parallel: true
|
|
|
|
|
|
|
|
- name: Coveralls Finished
|
|
|
|
uses: coverallsapp/github-action@v1.0.1
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
parallel-finished: true
|