bigint-crypto-utils/.github/workflows/nodejs.yml

100 lines
2.7 KiB
YAML
Raw Normal View History

# 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
name: Node CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
2021-03-25 13:20:01 +00:00
name: build and node tests
runs-on: ubuntu-latest
strategy:
matrix:
2022-04-21 08:50:22 +00:00
os: [ ubuntu-latest, windows-latest, macos-latest ]
node-version: [10.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install
run: npm ci
2021-03-25 12:59:44 +00:00
- name: lint
run: npm run lint
- name: build
2021-03-25 12:59:44 +00:00
run: npm run build:js
- name: docs
run: npm run docs
2022-04-21 08:50:22 +00:00
- if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x'
name: browser tests
run: npm run test:browser-headless
2021-03-25 12:59:44 +00:00
2021-03-25 13:09:04 +00:00
- name: node tests
run: npm run test:node
2021-03-25 12:59:44 +00:00
publication:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
2021-03-25 12:59:44 +00:00
- uses: EndBug/version-check@v1
id: check
2021-03-25 12:59:44 +00:00
- name: check version changes
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
2021-03-25 12:59:44 +00:00
- uses: actions/setup-node@v1
if: steps.check.outputs.changed == 'true'
with:
2022-04-21 08:50:22 +00:00
node-version: 16
2021-03-25 12:59:44 +00:00
registry-url: https://registry.npmjs.org/
- name: install
if: steps.check.outputs.changed == 'true'
run: npm ci
- name: lint
if: steps.check.outputs.changed == 'true'
run: npm run lint
2021-03-25 12:59:44 +00:00
- name: build
if: steps.check.outputs.changed == 'true'
run: npm run build:js
2021-03-25 12:59:44 +00:00
- name: docs
if: steps.check.outputs.changed == 'true'
run: npm run docs
2021-03-25 12:59:44 +00:00
- name: browser tests
if: steps.check.outputs.changed == 'true'
2022-04-21 08:50:22 +00:00
run: npm run test:browser-headless
2021-03-25 12:59:44 +00:00
- name: node tests and coverage
if: steps.check.outputs.changed == 'true'
run: npm run coverage
2021-03-25 12:59:44 +00:00
- name: send report to coveralls.io
if: steps.check.outputs.changed == 'true'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2021-03-25 12:59:44 +00:00
- name: publish to NPM
if: steps.check.outputs.changed == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}