-
-
Notifications
You must be signed in to change notification settings - Fork 11
110 lines (106 loc) · 3.29 KB
/
build.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: build
on: [push, pull_request]
jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
matrix:
features: ["quick-js", "duktape"]
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Set up rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cache rust artifacts
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.features }}
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --features ${{ matrix.features }}
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features ${{ matrix.features }} --no-fail-fast
test-wasm-browser:
name: "test (wasm-js browser)"
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Set up rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Set up Chrome
uses: nanasess/setup-chromedriver@master
- name: Set up wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache rust artifacts
uses: Swatinem/rust-cache@v1
- name: Run wasm-pack test
run: |
wasm-pack test --chrome --headless --no-default-features --features wasm-js,wasm-js-test-in-browser
test-wasm-node:
name: "test (wasm-js node)"
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Set up rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Set up Node
uses: actions/setup-node@v2
- name: Set up wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache rust artifacts
uses: Swatinem/rust-cache@v1
- name: Run wasm-pack test
run: |
wasm-pack test --node --no-default-features --features wasm-js
deploy:
if: startsWith(github.ref, 'refs/tags/')
name: deploy
runs-on: ubuntu-latest
needs: [test, test-wasm-browser, test-wasm-node]
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Get release version
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/}"
echo "TAG_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
echo "version is: ${TAG_VERSION}"
- name: Set up rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Login to crates.io
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CRATES_TOKEN }}
- name: Run cargo publish
uses: actions-rs/cargo@v1
with:
command: publish
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_VERSION }}
name: Release ${{ env.TAG_VERSION }}
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}