-
Notifications
You must be signed in to change notification settings - Fork 65
255 lines (239 loc) · 7.41 KB
/
main.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
defaults:
run:
shell: bash
jobs:
build:
name: Jco Build
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 'latest'
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable
- name: Install wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown
- name: Install wasm32-wasip1 target
run: rustup target add wasm32-wasip1
- name: Install NPM packages
run: npm ci
- name: Build
run: npm run build
- name: Upload Jco Build
uses: actions/upload-artifact@v4
with:
name: jco-build
path: obj
test-jco:
name: Jco Test Suite
strategy:
matrix:
os: [
ubuntu-latest,
windows-latest,
macos-latest
]
node: [18.x, 20.x, latest]
weval-version:
- 'v0.3.2'
include:
- os: windows-latest
weval-bin-path: .weval-bin/weval.exe
- os: ubuntu-latest
weval-bin-path: .weval-bin/weval
- os: macos-latest
weval-bin-path: .weval-bin/weval
exclude:
- os: macos-latest
node: 20.x
- os: macos-latest
node: 18.x
- os: windows-latest
node: latest
- os: windows-latest
node: 18.x
runs-on: ${{ matrix.os }}
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
# Use cached weval bin if present
- name: Cache weval bin
id: cache-weval-bin
uses: actions/cache@v4
with:
path: .weval-bin
key: weval-bin-${{ matrix.weval-version }}-${{ matrix.os }}
# (no cached weval bin) download weval release
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ matrix.weval-version }}/weval-${{ matrix.weval-version }}-x86_64-linux.tar.xz
tar -xvJf weval-${{ matrix.weval-version }}-x86_64-linux.tar.xz
mv weval-${{ matrix.weval-version }}-x86_64-linux/weval .weval-bin
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ matrix.weval-version }}/weval-${{ matrix.weval-version }}-x86_64-windows.zip
unzip weval-${{ matrix.weval-version }}-x86_64-windows.zip
mv weval-${{ matrix.weval-version }}-x86_64-windows .weval-bin
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ matrix.weval-version }}/weval-${{ matrix.weval-version }}-aarch64-macos.tar.xz
tar -xvJf weval-${{ matrix.weval-version }}-aarch64-macos.tar.xz
mkdir .weval-bin
mv weval-${{ matrix.weval-version }}-aarch64-macos/weval .weval-bin/
# Perform NPM install
- name: Install NPM packages
run: npm ci
- name: Download Build
uses: actions/download-artifact@v4
with:
name: jco-build
path: obj
- name: Test LTS Node.js
run: npm run test:lts
if: matrix.node == '18.x' || matrix.node == '20.x'
- name: Test Latest Node.js
if: matrix.node == 'latest'
env:
WEVAL_BIN_PATH: ${{ matrix.weval-bin-path }}
run: npm run test
build-wasi-tests:
name: WASI Test Generation
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-wasi-tests.outputs.cache-primary-key }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache WASI Tests
id: cache-wasi-tests
uses: actions/cache@v4
with:
path: tests/gen
key: wasi-${{ hashFiles('xtask/src/generate/preview2_tests.rs', 'submodules/wasmtime/Cargo.lock') }}
- name: Install Rust
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: rustup update stable --no-self-update && rustup default stable
- name: Install wasm32-unknown-unknown target
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: rustup target add wasm32-unknown-unknown
- name: Install wasm32-wasip1 target
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: rustup target add wasm32-wasip1
- name: Install wasm-tools
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: cargo install wasm-tools
- name: Generate WASI Tests
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: cargo xtask generate preview2-tests
- name: Upload Generated WASI Tests
uses: actions/upload-artifact@v4
with:
name: wasi-tests
path: tests/gen
test-wasi-deno:
name: Jco Deno WASI Conformance Tests
runs-on: 'ubuntu-latest'
needs: [build, build-wasi-tests]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 'latest'
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install NPM packages
run: npm ci
- name: Download Build
uses: actions/download-artifact@v4
with:
name: jco-build
path: obj
- name: Download WASI Tests
uses: actions/download-artifact@v4
with:
name: wasi-tests
path: tests/gen
- name: WASI Preview 2 Conformance
run: cargo test deno_
test-wasi:
name: Jco Node.js WASI Conformance Tests
strategy:
matrix:
os: [
ubuntu-latest,
windows-latest,
macos-latest
]
node: [18.x, 20.x, latest]
exclude:
- os: macos-latest
node: 20.x
- os: macos-latest
node: 18.x
- os: windows-latest
node: 20.x
- os: windows-latest
node: 18.x
fail-fast: false
runs-on: ${{ matrix.os }}
needs: [build, build-wasi-tests]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install NPM packages
run: npm ci
- name: Download Build
uses: actions/download-artifact@v4
with:
name: jco-build
path: obj
- name: Download WASI Tests
uses: actions/download-artifact@v4
with:
name: wasi-tests
path: tests/gen
- name: WASI Preview 2 Conformance
run: cargo test node_
test-workspaces:
name: Test Workspaces
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install NPM packages
run: npm ci
- name: Test Workspaces
run: npm run test --workspaces
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install NPM packages
run: npm ci
- name: Lint
run: npm run lint
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- name: Remove tests mod
run: rm -r tests/mod.rs
- name: Format source code
run: cargo fmt -- --check