Skip to content

Commit 6cfd1bb

Browse files
committed
test
1 parent dbc176e commit 6cfd1bb

File tree

1 file changed

+4
-372
lines changed

1 file changed

+4
-372
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 372 deletions
Original file line numberDiff line numberDiff line change
@@ -8,382 +8,14 @@ on:
88
# used with for all release branches (wildcard pattern turns that off)
99
push:
1010
branches:
11-
- 'release-*'
12-
13-
# Cancel any in-flight jobs for the same PR/branch so there's only one active
14-
# at a time
15-
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}
17-
cancel-in-progress: true
18-
19-
defaults:
20-
run:
21-
shell: bash
11+
- 'wat'
2212

2313
jobs:
2414
build:
2515
name: Build wasm-tools
26-
runs-on: ${{ matrix.os }}
27-
strategy:
28-
fail-fast: ${{ github.event_name != 'pull_request' }}
29-
matrix:
30-
include:
31-
- build: x86_64-linux
32-
os: ubuntu-latest
33-
- build: x86_64-musl
34-
os: ubuntu-latest
35-
target: x86_64-unknown-linux-musl
36-
- build: x86_64-macos
37-
os: macos-latest
38-
target: x86_64-apple-darwin
39-
- build: aarch64-macos
40-
os: macos-latest
41-
target: aarch64-apple-darwin
42-
- build: x86_64-windows
43-
os: windows-latest
44-
- build: aarch64-linux
45-
os: ubuntu-latest
46-
target: aarch64-unknown-linux-gnu
47-
- build: aarch64-musl
48-
os: ubuntu-latest
49-
target: aarch64-unknown-linux-musl
50-
- build: wasm32-wasip1
51-
os: ubuntu-latest
52-
target: wasm32-wasip1
53-
steps:
54-
- uses: actions/checkout@v5
55-
with:
56-
submodules: true
57-
- uses: ./.github/actions/install-rust
58-
- uses: bytecodealliance/wasmtime/.github/actions/binary-compatible-builds@release-28.0.0
59-
with:
60-
name: ${{ matrix.build }}
61-
if: matrix.build != 'wasm32-wasip1'
62-
- run: |
63-
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
64-
rustup target add ${{ matrix.target }}
65-
if: matrix.target != ''
66-
- run: $CENTOS cargo build --release
67-
- run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}"
68-
- uses: actions/upload-artifact@v4
69-
with:
70-
name: bins-${{ matrix.build }}
71-
path: dist
72-
73-
test-prefer-btree-collections:
74-
name: Test (no-hash-maps)
75-
runs-on: ubuntu-latest
76-
steps:
77-
- uses: actions/checkout@v5
78-
with:
79-
submodules: true
80-
- uses: ./.github/actions/install-rust
81-
- name: Test (prefer-btree-collections)
82-
run: cargo test --workspace --locked --features prefer-btree-collections
83-
84-
test:
85-
name: Test
86-
runs-on: ${{ matrix.os }}
87-
strategy:
88-
fail-fast: ${{ github.event_name != 'pull_request' }}
89-
matrix:
90-
include:
91-
- os: ubuntu-latest
92-
rust: stable
93-
- os: ubuntu-latest
94-
rust: beta
95-
- os: ubuntu-latest
96-
rust: nightly
97-
- os: macos-latest
98-
rust: stable
99-
- os: windows-latest
100-
rust: stable
101-
- os: ubuntu-latest
102-
rust: msrv
103-
# skip testing crates that require wasmtime since wasmtime has a
104-
# more aggressive msrv than wasm-tools
105-
flags: --exclude fuzz-stats --exclude wit-component --exclude wasm-mutate-stats --exclude wit-dylib --exclude wit-dylib-ffi --exclude test-programs
106-
# this is the rust nightly that oss-fuzz currently uses so we don't
107-
# want this to break.
108-
- os: ubuntu-latest
109-
rust: nightly-2025-07-16
110-
# test that if `RUST_BACKTRACE=1` is set in the environment that all
111-
# tests with blessed error messages still pass.
112-
- os: ubuntu-latest
113-
rust: stable
114-
env:
115-
RUST_BACKTRACE: 1
116-
env: ${{ matrix.env || fromJSON('{}') }}
117-
steps:
118-
- uses: actions/checkout@v5
119-
with:
120-
submodules: true
121-
- uses: ./.github/actions/install-rust
122-
with:
123-
toolchain: ${{ matrix.rust }}
124-
- run: cargo test --locked --all ${{ matrix.flags }}
125-
126-
test_extra_features:
127-
name: Test with extra Cargo features
128-
runs-on: ubuntu-latest
129-
steps:
130-
- uses: actions/checkout@v5
131-
with:
132-
submodules: true
133-
- uses: ./.github/actions/install-rust
134-
- run: cargo test --locked -p wasmparser --benches
135-
- run: cargo test --locked -p wasm-encoder --all-features
136-
- run: cargo test -p wasm-smith --features wasmparser
137-
- run: cargo test -p wasm-smith --features component-model
138-
139-
test_capi:
140-
name: Test the C API
141-
runs-on: ${{ matrix.os }}
142-
strategy:
143-
fail-fast: ${{ github.event_name != 'pull_request' }}
144-
matrix:
145-
include:
146-
- os: ubuntu-latest
147-
- os: macos-latest
148-
- os: windows-latest
149-
steps:
150-
- uses: actions/checkout@v5
151-
with:
152-
submodules: true
153-
- uses: ./.github/actions/install-rust
154-
- run: cmake -S examples -B examples/build -DCMAKE_BUILD_TYPE=Release
155-
- run: cmake --build examples/build --config Release
156-
157-
testdl:
158-
name: Test libdl.so
159-
runs-on: ubuntu-latest
160-
steps:
161-
- uses: actions/checkout@v5
162-
with:
163-
submodules: true
164-
- uses: ./.github/actions/install-rust
165-
with:
166-
toolchain: 1.89.0
167-
- run: rustup target add wasm32-wasip1
168-
- run: cd crates/wit-component/dl && bash check.sh
169-
170-
wasm:
171-
name: Test on WebAssembly
172-
runs-on: ubuntu-latest
173-
steps:
174-
- uses: actions/checkout@v5
175-
with:
176-
submodules: true
177-
- uses: ./.github/actions/install-rust
178-
- run: rustup target add wasm32-wasip1
179-
- run: |
180-
tag=v10.0.1
181-
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/${tag}/wasmtime-${tag}-x86_64-linux.tar.xz
182-
tar xf wasmtime-${tag}-x86_64-linux.tar.xz
183-
echo `pwd`/wasmtime-${tag}-x86_64-linux >> $GITHUB_PATH
184-
echo CARGO_TARGET_WASM32_WASIP1_RUNNER='wasmtime run --dir . --' >> $GITHUB_ENV
185-
echo CARGO_BUILD_TARGET='wasm32-wasip1' >> $GITHUB_ENV
186-
- run: |
187-
cargo --locked test --workspace \
188-
--exclude fuzz-stats \
189-
--exclude wasm-tools-fuzz \
190-
--exclude wasm-mutate-stats \
191-
--exclude dl \
192-
--exclude test-programs
193-
194-
rustfmt:
195-
name: Rustfmt
19616
runs-on: ubuntu-latest
19717
steps:
198-
- uses: actions/checkout@v5
199-
- uses: ./.github/actions/install-rust
200-
- run: rustup component add rustfmt
201-
- run: printf "\n" > playground/component/src/bindings.rs
202-
# Note that this doesn't use `cargo fmt` because that doesn't format
203-
# modules-defined-in-macros which is in use in `wast` for example. This is
204-
# the best alternative I can come up with at this time
205-
- run: find . -name '*.rs' | xargs rustfmt --check --edition 2021
206-
207-
fuzz:
208-
name: Fuzz
209-
runs-on: ubuntu-latest
210-
steps:
211-
- uses: actions/checkout@v5
212-
with:
213-
submodules: true
214-
- uses: ./.github/actions/install-rust
215-
with:
216-
toolchain: nightly
217-
- run: cargo install cargo-fuzz
218-
- run: cargo fuzz build --dev -s none
219-
- run: cargo fuzz build --dev --features wasmtime -s none
220-
221-
check:
222-
runs-on: ubuntu-latest
223-
steps:
224-
- uses: actions/checkout@v5
225-
- uses: ./.github/actions/install-rust
226-
- run: rustup target add x86_64-unknown-none
227-
- run: cargo check --benches -p wasm-smith
228-
- run: cargo check --no-default-features
229-
- run: cargo check --no-default-features --features print
230-
- run: cargo check --no-default-features --features parse
231-
- run: cargo check --no-default-features --features validate
232-
- run: cargo check --no-default-features --features smith
233-
- run: cargo check --no-default-features --features shrink
234-
- run: cargo check --no-default-features --features mutate
235-
- run: cargo check --no-default-features --features dump
236-
- run: cargo check --no-default-features --features objdump
237-
- run: cargo check --no-default-features --features strip
238-
- run: cargo check --no-default-features --features compose
239-
- run: cargo check --no-default-features --features demangle
240-
- run: cargo check --no-default-features --features component
241-
- run: cargo check --no-default-features --features metadata
242-
- run: cargo check --no-default-features --features wit-smith
243-
- run: cargo check --no-default-features --features addr2line
244-
- run: cargo check --no-default-features --features json-from-wast
245-
- run: cargo check --no-default-features --features completion
246-
- run: cargo check --no-default-features --features wast
247-
- run: cargo check --no-default-features --features wit-dylib
248-
- run: cargo check --no-default-features -p wit-parser
249-
- run: cargo check --no-default-features -p wit-parser --features wat
250-
- run: cargo check --no-default-features -p wit-parser --features serde
251-
- run: cargo check --no-default-features -p wit-parser --features decoding
252-
- run: cargo check --no-default-features -p wit-parser --features serde,decoding,wat
253-
- run: cargo check --no-default-features -p wasmparser
254-
- run: cargo check --no-default-features -p wasmparser --target x86_64-unknown-none
255-
- run: cargo check --no-default-features -p wasmparser --target x86_64-unknown-none --features validate,serde
256-
- run: cargo check --no-default-features -p wasmparser --target x86_64-unknown-none --features validate,serde,prefer-btree-collections
257-
- run: cargo check --no-default-features -p wasmparser --features std
258-
- run: cargo check --no-default-features -p wasmparser --features validate
259-
- run: cargo check --no-default-features -p wasmparser --features features
260-
- run: cargo check --no-default-features -p wasmparser --features features,validate
261-
- run: cargo check --no-default-features -p wasmparser --features prefer-btree-collections
262-
- run: cargo check --no-default-features -p wasmparser --features serde
263-
- run: cargo check --no-default-features -p wasmparser --features serde,prefer-btree-collections
264-
- run: cargo check --no-default-features -p wasmparser --features component-model
265-
- run: cargo check --no-default-features -p wasmparser --features component-model,validate
266-
- run: cargo check --no-default-features -p wasmparser --features std,component-model
267-
- run: cargo check --no-default-features -p wasmparser --features std,component-model,validate
268-
- run: cargo check --no-default-features -p wasmprinter
269-
- run: cargo check --no-default-features -p wasmprinter --features component-model
270-
- run: cargo check --no-default-features -p wast
271-
- run: cargo check --no-default-features -p wast --features wasm-module
272-
- run: cargo check --no-default-features -p wast --features wasm-module,component-model
273-
- run: cargo check --no-default-features -p wat
274-
- run: cargo check --no-default-features -p wat --features component-model
275-
- run: cargo check --no-default-features -p wat --features dwarf
276-
- run: cargo check --no-default-features -p wasm-encoder
277-
- run: cargo check --no-default-features -p wasm-encoder --target x86_64-unknown-none
278-
- run: cargo check --no-default-features -p wasm-encoder --target x86_64-unknown-none --features wasmparser,component-model
279-
- run: cargo check --no-default-features -p wasm-encoder --features component-model
280-
- run: cargo check --no-default-features -p wasm-encoder --features wasmparser
281-
- run: cargo check --no-default-features -p wasm-smith
282-
- run: cargo check --no-default-features -p wasm-smith --features component-model
283-
- run: cargo check --no-default-features -p wasm-smith --features wasmparser
284-
- run: cargo check --no-default-features -p wasm-smith --features wasmparser,component-model
285-
- run: cargo check --no-default-features -p wasm-smith --features serde
286-
- run: cargo check --no-default-features -p wasm-metadata
287-
- run: cargo check --no-default-features -p wasm-metadata --features serde
288-
- run: cargo check --no-default-features -p wasm-metadata --features oci
289-
- run: |
290-
if cargo tree -p wasm-smith --no-default-features -e no-dev | grep wasmparser; then
291-
echo wasm-smith without default features should not depend on wasmparser
292-
exit 1
293-
fi
294-
295-
# Double-check that files and such related to the `tests/cli` test suite are
296-
# up-to-date.
297-
generated_files_up_to_date:
298-
name: Check generated files are up-to-date
299-
runs-on: ubuntu-latest
300-
steps:
301-
- uses: actions/checkout@v5
302-
with:
303-
submodules: true
304-
- uses: ./.github/actions/install-rust
305-
- run: rm -rf tests/snapshots
306-
- run: rustc ci/generate-spec-tests.rs && ./generate-spec-tests
307-
- run: find tests/cli -name '*.stderr' | xargs rm
308-
- run: BLESS=1 cargo test --test cli
309-
- run: git diff --exit-code
310-
311-
doc:
312-
runs-on: ubuntu-latest
313-
steps:
314-
- uses: actions/checkout@v5
315-
- uses: ./.github/actions/install-rust
316-
- run: RUSTDOCFLAGS="-Dwarnings" cargo doc --all
317-
318-
clippy:
319-
runs-on: ubuntu-latest
320-
steps:
321-
- uses: actions/checkout@v5
322-
- uses: ./.github/actions/install-rust
323-
- run: rustup component add clippy
324-
- run: cargo clippy --workspace --all-targets --exclude dl --exclude component
325-
326-
verify-publish:
327-
if: github.repository_owner == 'bytecodealliance'
328-
runs-on: ubuntu-latest
329-
steps:
330-
- uses: actions/checkout@v5
331-
with:
332-
submodules: true
333-
- uses: ./.github/actions/install-rust
334-
- run: rustc ci/publish.rs
335-
# Make sure we can bump version numbers for the next release
336-
- run: ./publish bump
337-
# Make sure the tree is publish-able as-is
338-
- run: ./publish verify
339-
340-
# "Join node" which the merge queue waits on.
341-
ci-status:
342-
name: Record the result of testing and building steps
343-
runs-on: ubuntu-latest
344-
needs:
345-
- test
346-
- testdl
347-
- wasm
348-
- rustfmt
349-
- fuzz
350-
- check
351-
- doc
352-
- build
353-
- verify-publish
354-
- test_capi
355-
- test_extra_features
356-
- test-prefer-btree-collections
357-
- clippy
358-
- generated_files_up_to_date
359-
if: always()
360-
361-
steps:
362-
- name: Successful test and build
363-
if: ${{ !(contains(needs.*.result, 'failure')) }}
364-
run: exit 0
365-
- name: Failing test and build
366-
if: ${{ contains(needs.*.result, 'failure') }}
367-
run: exit 1
368-
- name: Report failure on cancellation
369-
if: ${{ contains(needs.*.result, 'cancelled') || cancelled() }}
370-
run: exit 1
371-
372-
# Once CI has finished on `release-*` branches test to see if a release needs
373-
# to be made based on the commits of this push.
374-
maybe-trigger-tag:
375-
runs-on: ubuntu-latest
376-
needs: ci-status
377-
if: |
378-
always()
379-
&& needs.ci-status.result == 'success'
380-
&& github.event_name == 'push'
381-
&& startsWith(github.ref, 'refs/heads/release-')
382-
steps:
383-
- uses: actions/checkout@v5
384-
with:
385-
submodules: true
386-
fetch-depth: 0
387-
- uses: ./.github/actions/publish-release
18+
- name: Setup `wasmtime`
19+
uses: bytecodealliance/actions/wasmtime/setup@v1
38820
with:
389-
cargo_token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
21+
version: "dev"

0 commit comments

Comments
 (0)