-
Notifications
You must be signed in to change notification settings - Fork 10
81 lines (68 loc) · 2.03 KB
/
wasm-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: wasm-test
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
paths:
- "wasm/**"
- ".github/workflows/wasm-test.yaml"
workflow_dispatch:
jobs:
test-and-release:
name: Test and Release
runs-on: ubuntu-latest
permissions:
id-token: write
# Notes: this defaults only apply on run tasks.
defaults:
run:
working-directory: "wasm"
steps:
- uses: actions/checkout@v4
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
override: true
components: clippy, rustfmt
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Rust example e2e tests
run: cd examples/rust && cargo test -r
- name: Go example e2e tests
run: cd examples/go && go mod tidy && go run main.go
- name: Node.js example e2e tests
run: cd examples/node && npm install && npm run build
- name: Browser example e2e tests
run: cd examples/browser && npm install && npm run build
- name: Publish Dry Run
if: "startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-')"
# Since this command will not exit with non-zero code when file missing,
# we need to check the output manually.
run: |
npm publish --access public --provenance --dry-run
- name: Publish
if: "startsWith(github.ref, 'refs/tags/')"
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public --provenance
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}