Skip to content

ci: Semantic PR config #51

ci: Semantic PR config

ci: Semantic PR config #51

Workflow file for this run

name: Core
on:
- push
- pull_request
jobs:
test:
runs-on: ${{ matrix.os }}
name: Test ${{ matrix.os }}/Node ${{ matrix.node }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- 16
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/setup-node@v2
name: Set up node
with:
node-version: ${{ matrix.node }}
registry-url: https://npm.pkg.github.com
- name: Get NPM cache dir
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache NPM
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-npm-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ matrix.node }}-
- name: Install deps
run: npm ci --no-fund
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Upload coverage
if: ${{ matrix.os != 'windows-latest' }}
continue-on-error: true
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: node-${{ matrix.node }}-on-${{ matrix.os }}-${{ github.event_name }}
# parallel: true
# posttest:
# runs-on: ubuntu-latest
# needs: test
# continue-on-error: true
# steps:
# - name: Finalise coverage report
# uses: coverallsapp/[email protected]
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel-finished: true
release:
name: Release
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
needs:
# - lint
- test
strategy:
matrix:
os:
- ubuntu-latest
node:
- 16
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1000
- uses: actions/setup-node@v2
name: Set up node
with:
node-version: ${{ matrix.node }}
registry-url: https://npm.pkg.github.com
- name: Get NPM cache dir
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache NPM
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-npm-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ matrix.node }}-
- name: Install deps
run: npm ci --no-fund
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v2
name: Reconfig Node
with:
node-version: ${{ matrix.node }}
registry-url: https://registry.npmjs.org
- name: Release
run: ./node_modules/.bin/semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}