bigint-crypto-utils/.github/workflows/build-and-test.yml

116 lines
2.9 KiB
YAML
Raw Normal View History

2023-04-11 09:21:16 +00:00
name: build, test (node and browser), coverage, publish to NPM
2022-04-21 09:36:13 +00:00
on:
push:
2023-04-11 09:21:16 +00:00
tags:
- "v*.*.*"
workflow_dispatch:
2022-04-21 09:36:13 +00:00
jobs:
build:
2023-04-11 09:21:16 +00:00
name: build
2022-04-21 09:36:13 +00:00
runs-on: ubuntu-latest
2023-04-11 09:21:16 +00:00
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: "https://registry.npmjs.org"
- name: install
run: npm ci
- name: build
run: npm run build
nodetests:
name: tests in Node.js
needs: [build]
runs-on: ${{ matrix.os }}
2022-04-21 09:36:13 +00:00
strategy:
matrix:
2023-04-11 09:21:16 +00:00
os: [ubuntu-latest, windows-latest, macos-latest]
2023-04-11 11:31:59 +00:00
node-version: [14.x, 16.x, 18.x]
2023-04-11 09:21:16 +00:00
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails.
fail-fast: false
# The maximum number of jobs that can run simultaneously. Set to 1 if you can't run tests in parallel
# max-parallel: 1
2022-04-21 09:36:13 +00:00
steps:
2023-04-11 09:21:16 +00:00
- name: Git checkout
uses: actions/checkout@v3
2022-04-21 09:36:13 +00:00
- name: Use Node.js ${{ matrix.node-version }}
2023-04-11 09:21:16 +00:00
uses: actions/setup-node@v3
2022-04-21 09:36:13 +00:00
with:
node-version: ${{ matrix.node-version }}
2023-04-11 09:21:16 +00:00
registry-url: "https://registry.npmjs.org"
2022-04-21 09:36:13 +00:00
- name: install
2023-04-11 11:31:59 +00:00
run: npm i
2022-04-21 09:36:13 +00:00
2023-04-11 09:21:16 +00:00
- name: node esm tests
run: npm run test:node-esm
# env:
# VARIABLE1: ${{ secrets.VARIABLE1 }}
# VARIABLE2: ${{ secrets.VARIABLE2 }}
- name: node cjs tests
run: npm run test:node-cjs
# env:
# VARIABLE1: ${{ secrets.VARIABLE1 }}
# VARIABLE2: ${{ secrets.VARIABLE2 }}
2022-04-21 09:36:13 +00:00
2023-04-11 09:21:16 +00:00
browsertests:
needs: [build]
name: tests in browser
2022-04-21 09:36:13 +00:00
runs-on: ubuntu-latest
steps:
2023-04-11 09:21:16 +00:00
- name: Git checkout
uses: actions/checkout@v3
2022-04-21 09:36:13 +00:00
2023-04-11 09:21:16 +00:00
- name: Use Node.js 18
uses: actions/setup-node@v3
2022-04-21 09:36:13 +00:00
with:
2023-04-11 09:21:16 +00:00
node-version: 18.x
registry-url: "https://registry.npmjs.org"
2022-04-21 09:36:13 +00:00
- name: install
run: npm ci
2023-04-11 09:21:16 +00:00
2022-04-21 09:36:13 +00:00
- name: browser tests
run: npm run test:browser-headless
2023-04-11 09:21:16 +00:00
# env:
# VARIABLE1: ${{ secrets.VARIABLE1 }}
# VARIABLE2: ${{ secrets.VARIABLE2 }}
publish:
needs: [nodetests, browsertests]
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: install
run: npm ci
- name: coverage
2022-04-21 09:36:13 +00:00
run: npm run coverage
2023-04-11 09:21:16 +00:00
2022-04-21 09:36:13 +00:00
- name: send report to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2023-04-11 09:21:16 +00:00
- name: NPM publish
run: npm publish --access public
2022-04-21 09:36:13 +00:00
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}