-
Notifications
You must be signed in to change notification settings - Fork 4
79 lines (58 loc) · 2.18 KB
/
ci.yml
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
name: build
defaults:
run:
working-directory: rust-lib
on:
workflow_dispatch:
push:
branches: [ master ]
tags: [ v* ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: echo github ref
run: echo "${{ github.ref }}"
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build Rust
run: cargo build --verbose --release
- name: Run tests
run: cargo test --verbose
- name: Build docs
run: cargo doc --no-deps
- name: test WASM
run: wasm-pack test --headless --chrome # --firefox # Disabling tests in FF temporarily (refer: https://github.com/rustwasm/wasm-bindgen/issues/2261)
- name: build WASM bundler
run: wasm-pack build --out-dir ../npm-pkg/dist/bundler --release
- name: build WASM cjs
run: wasm-pack build --target nodejs --out-dir ../npm-pkg/dist/cjs --release
- name: cleanup dist
run: rm ../npm-pkg/dist/bundler/.gitignore ../npm-pkg/dist/bundler/email_address_parser.d.ts ../npm-pkg/dist/bundler/LICENSE ../npm-pkg/dist/bundler/package.json ../npm-pkg/dist/bundler/README.md ../npm-pkg/dist/cjs/.gitignore ../npm-pkg/dist/cjs/email_address_parser.d.ts ../npm-pkg/dist/cjs/LICENSE ../npm-pkg/dist/cjs/package.json ../npm-pkg/dist/cjs/README.md
- uses: actions/setup-node@v1
with:
node-version: '16.x'
registry-url: https://registry.npmjs.org/
scope: sparser
- name: npm ci
run: npm ci
working-directory: ./npm-pkg
- name: test npm package
run: npm test
working-directory: ./npm-pkg
# publish to crates.io
- name: crates.io publish
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
if: startsWith(github.ref, 'refs/tags/v')
# publish to npm
- name: publish to npm
run: npm publish --access public --@sparser:registry=https://registry.npmjs.org/
working-directory: ./npm-pkg
if: startsWith(github.ref, 'refs/tags/v')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}