-
Notifications
You must be signed in to change notification settings - Fork 2
240 lines (231 loc) · 8.14 KB
/
Copy pathci.yaml
File metadata and controls
240 lines (231 loc) · 8.14 KB
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
name: CI
on:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request:
permissions:
checks: write
pull-requests: write
contents: write
env:
CARGO_TERM_COLOR: always
WASI_SDK_VERSION: "25"
WASI_SDK_PATH: /opt/wasi-sdk
# CI always builds and tests against Golem's wasmtime fork — see
# .github/scripts/enable-wasmtime-fork.sh for the rationale. Build/test
# jobs run that script (which uncomments the [patch.crates-io] block in
# Cargo.toml) and pass --features use-golem-wasmtime via this variable.
# The `release-binaries` and `publish` jobs deliberately skip both so
# they keep using the unpatched, crates.io-publishable wasmtime.
CI_WASMTIME_FORK_FEATURES: --features use-golem-wasmtime
jobs:
build:
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
- name: Enable Golem wasmtime fork
run: bash .github/scripts/enable-wasmtime-fork.sh
- name: Check formatting
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy $CI_WASMTIME_FORK_FEATURES -- -Dwarnings
- name: Build
run: cargo build --all-targets $CI_WASMTIME_FORK_FEATURES
test-other:
needs: [build]
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
- name: Enable Golem wasmtime fork
run: bash .github/scripts/enable-wasmtime-fork.sh
- name: Compilation, DTS and error tests
run: cargo test --test compilation --test dts --test errors $CI_WASMTIME_FORK_FEATURES -- --report-time --format ctrf --logfile target/ctrf.json
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
if: always()
with:
report-path: "**/target/ctrf-*.json"
upload-artifact: "true"
artifact-name: test-other-report
summary: true
summary-report: true
failed-report: true
slowest-report: true
github-report: true
flaky-report: true
collapse-large-reports: true
exit-on-no-files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-runtime:
needs: [build]
runs-on: blacksmith-16vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
- name: Enable Golem wasmtime fork
run: bash .github/scripts/enable-wasmtime-fork.sh
- name: Runtime tests (group ${{ matrix.group }}/8)
run: cargo test --test runtime $CI_WASMTIME_FORK_FEATURES -- --report-time --format ctrf --logfile target/ctrf.json ':tag:group${{ matrix.group }}'
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
if: always()
with:
report-path: "**/target/ctrf-*.json"
upload-artifact: "true"
artifact-name: test-runtime-group-${{ matrix.group }}-report
summary: true
summary-report: true
failed-report: true
slowest-report: true
github-report: true
flaky-report: true
collapse-large-reports: true
exit-on-no-files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-node-compat:
needs: [build]
runs-on: blacksmith-16vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
- name: Enable Golem wasmtime fork
run: bash .github/scripts/enable-wasmtime-fork.sh
- name: Vendor Node.js test suite
run: bash tests/node_compat/vendor.sh
- name: Node compat tests (shard ${{ matrix.shard }}/8)
run: cargo test --test node_compat $CI_WASMTIME_FORK_FEATURES -- --report-time --format ctrf --logfile target/ctrf.json ':tag:shard${{ matrix.shard }}'
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
if: always()
with:
report-path: "**/target/ctrf-*.json"
upload-artifact: "true"
artifact-name: test-node-compat-shard-${{ matrix.shard }}-report
summary: true
summary-report: true
failed-report: true
slowest-report: true
github-report: true
flaky-report: true
collapse-large-reports: true
exit-on-no-files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-binaries:
needs: [test-other, test-runtime, test-node-compat]
if: "startsWith(github.ref, 'refs/tags/v')"
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: blacksmith-16vcpu-ubuntu-2404
archive: tar.gz
- target: aarch64-unknown-linux-gnu
os: blacksmith-16vcpu-ubuntu-2404
archive: tar.gz
cross: true
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: v1-rust
shared-key: release-${{ matrix.target }}
cache-all-crates: true
- id: get_version
uses: battila7/get-version-action@v2
- name: Set version
shell: bash
run: |
VERSION="${{ steps.get_version.outputs.version-without-v }}"
if [[ "$RUNNER_OS" == "macOS" ]]; then
sed -i '' "s/0.0.0/$VERSION/g" Cargo.toml
else
sed -i "s/0.0.0/$VERSION/g" Cargo.toml
fi
- name: Install cross-compilation tools
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: matrix.archive == 'tar.gz'
shell: bash
run: |
ARCHIVE="wasm-rquickjs-cli-v${{ steps.get_version.outputs.version-without-v }}-${{ matrix.target }}.tar.gz"
tar -czf "$ARCHIVE" -C target/${{ matrix.target }}/release wasm-rquickjs
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Package (windows)
if: matrix.archive == 'zip'
shell: bash
run: |
ARCHIVE="wasm-rquickjs-cli-v${{ steps.get_version.outputs.version-without-v }}-${{ matrix.target }}.zip"
cd target/${{ matrix.target }}/release
7z a "../../../$ARCHIVE" wasm-rquickjs.exe
cd ../../..
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ARCHIVE }}
publish:
needs: [test-other, test-runtime, test-node-compat]
if: "startsWith(github.ref, 'refs/tags/v')"
runs-on: blacksmith-16vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/setup
with:
cache-key: release
- id: get_version
uses: battila7/get-version-action@v2
- name: Publish crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
export VERSION="${{ steps.get_version.outputs.version-without-v }}"
sed -i "s/0.0.0/$VERSION/g" Cargo.toml
cargo publish -p wasm-rquickjs --features optimize --allow-dirty
cargo publish -p wasm-rquickjs-cli --allow-dirty