Skip to content

Commit

Permalink
updated flow
Browse files Browse the repository at this point in the history
  • Loading branch information
juanelas committed Apr 17, 2023
1 parent 786358b commit 6425d82
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: build, test (node and browser), publish to NPM

on:
push:
tags:
- "v*.*.*"
workflow_dispatch:

jobs:
node:
name: Tests in node.js
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16.x, 18.x]
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails.
fail-fast: true
# The maximum number of jobs that can run simultaneously
max-parallel: 1
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: install
run: npm ci

- name: node tests
run: npm run test:node
env:
RPC_PROVIDER_URL: ${{ secrets.RPC_PROVIDER_URL }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}

browser:
name: test in browser
needs: [node]
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: install
run: npm ci

- name: browser tests
run: npm run test:browser-headless
env:
RPC_PROVIDER_URL: ${{ secrets.RPC_PROVIDER_URL }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}

npm-publish:
needs: [node, browser]
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: NPM publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 6425d82

Please sign in to comment.