312bc2c8e4
cf. https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request > By default, a workflow only runs when a pull_request's activity type is opened, synchronize, or reopened.
66 lines
1.4 KiB
YAML
66 lines
1.4 KiB
YAML
name: 'Test'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- '**.md'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '**.md'
|
|
|
|
jobs:
|
|
skipci:
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- run: echo "[skip ci] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
|
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- 'ubuntu-18.04'
|
|
- 'ubuntu-16.04'
|
|
- 'macos-latest'
|
|
- 'windows-latest'
|
|
steps:
|
|
- 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 }}'
|
|
|
|
- run: npm i -g npm
|
|
- run: npm ci
|
|
|
|
- name: Run prettier
|
|
if: startsWith(matrix.os, 'ubuntu-18.04')
|
|
run: npm run format:check
|
|
|
|
- name: Run eslint
|
|
if: startsWith(matrix.os, 'ubuntu-18.04')
|
|
run: npm run lint
|
|
|
|
- name: Run ncc
|
|
if: startsWith(matrix.os, 'ubuntu-18.04')
|
|
run: npm run build
|
|
|
|
- run: npm test
|
|
|
|
- name: Upload test coverage as artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: coverage-${{ matrix.os }}
|
|
path: coverage
|
|
|
|
- uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|