Skip to content

Commit 777f8be

Browse files
authored
Add MSRV support and testing to this repository (#1557)
* Add MSRV support and testing to this repository This mirrors the support in Wasmtime, which Wasmtime depends on, to this repository as well to ensure all various crates are tagged and CI works similarly. * Fix a warning on CI * Fix compat with Rust 1.76 * Fix warnings in `wast` crate when features are disabled * Disable tests for libdl crate
1 parent fadf4e9 commit 777f8be

29 files changed

Lines changed: 76 additions & 41 deletions

File tree

.github/workflows/main.yml

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- uses: actions/checkout@v4
4141
with:
4242
submodules: true
43-
- run: rustup update stable --no-self-update && rustup default stable
43+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
4444
- uses: bytecodealliance/wasmtime/.github/actions/binary-compatible-builds@v20.0.0
4545
with:
4646
name: ${{ matrix.build }}
@@ -63,8 +63,7 @@ jobs:
6363
- uses: actions/checkout@v4
6464
with:
6565
submodules: true
66-
- name: Install Rust
67-
run: rustup update stable --no-self-update && rustup default stable
66+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
6867
- name: Test (no-hash-maps)
6968
run: cargo test --workspace --locked --features no-hash-maps
7069

@@ -73,29 +72,26 @@ jobs:
7372
runs-on: ${{ matrix.os }}
7473
strategy:
7574
matrix:
76-
build: [stable, beta, nightly, macos, windows]
7775
include:
78-
- build: stable
79-
os: ubuntu-latest
80-
rust: stable
81-
- build: beta
82-
os: ubuntu-latest
76+
- os: ubuntu-latest
77+
rust: default
78+
- os: ubuntu-latest
8379
rust: beta
84-
- build: nightly
85-
os: ubuntu-latest
80+
- os: ubuntu-latest
8681
rust: nightly
87-
- build: macos
88-
os: macos-latest
89-
rust: stable
90-
- build: windows
91-
os: windows-latest
92-
rust: stable
82+
- os: macos-latest
83+
rust: default
84+
- os: windows-latest
85+
rust: default
86+
- os: ubuntu-latest
87+
rust: msrv
9388
steps:
9489
- uses: actions/checkout@v4
9590
with:
9691
submodules: true
97-
- name: Install Rust (rustup)
98-
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
92+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
93+
with:
94+
toolchain: ${{ matrix.rust }}
9995
- run: cargo test --locked --all
10096

10197
test_extra_features:
@@ -105,7 +101,7 @@ jobs:
105101
- uses: actions/checkout@v4
106102
with:
107103
submodules: true
108-
- run: rustup update stable --no-self-update && rustup default stable
104+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
109105
- run: cargo test --locked -p wasmparser --benches
110106
- run: cargo test --locked -p wasm-encoder --all-features
111107
- run: cargo test -p wasm-smith --features wasmparser
@@ -123,7 +119,7 @@ jobs:
123119
- uses: actions/checkout@v4
124120
with:
125121
submodules: true
126-
- run: rustup update stable --no-self-update && rustup default stable
122+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
127123
- run: cmake -S examples -B examples/build -DCMAKE_BUILD_TYPE=Release
128124
- run: cmake --build examples/build --config Release
129125

@@ -134,13 +130,13 @@ jobs:
134130
- uses: actions/checkout@v4
135131
with:
136132
submodules: true
137-
- name: Install Rust (rustup)
138-
run: rustup update 1.77.0 --no-self-update && rustup default 1.77.0
133+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
134+
with:
135+
toolchain: 1.77.0
139136
- run: |
140137
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-linux.tar.gz
141138
tar xf wasi-sdk-21.0-linux.tar.gz
142139
export WASI_SDK_PATH=$(pwd)/wasi-sdk-21.0
143-
rustup target add wasm32-wasi
144140
cd crates/wit-component/dl && bash check.sh
145141
146142
wasm:
@@ -150,9 +146,7 @@ jobs:
150146
- uses: actions/checkout@v4
151147
with:
152148
submodules: true
153-
- name: Install Rust
154-
run: rustup update stable --no-self-update && rustup default stable
155-
- run: rustup target add wasm32-wasi
149+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
156150
- run: |
157151
tag=v10.0.1
158152
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/${tag}/wasmtime-${tag}-x86_64-linux.tar.xz
@@ -172,8 +166,8 @@ jobs:
172166
runs-on: ubuntu-latest
173167
steps:
174168
- uses: actions/checkout@v4
175-
- name: Install Rust
176-
run: rustup update stable && rustup default stable && rustup component add rustfmt
169+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
170+
- run: rustup component add rustfmt
177171
# Note that this doesn't use `cargo fmt` because that doesn't format
178172
# modules-defined-in-macros which is in use in `wast` for example. This is
179173
# the best alternative I can come up with at this time
@@ -186,8 +180,9 @@ jobs:
186180
- uses: actions/checkout@v4
187181
with:
188182
submodules: true
189-
- name: Install Rust
190-
run: rustup update nightly && rustup default nightly
183+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
184+
with:
185+
toolchain: nightly
191186
- run: cargo install cargo-fuzz
192187
- run: cargo fuzz build --dev -s none
193188
- run: cargo fuzz build --dev --features wasmtime -s none
@@ -196,6 +191,7 @@ jobs:
196191
runs-on: ubuntu-latest
197192
steps:
198193
- uses: actions/checkout@v4
194+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
199195
- run: rustup target add x86_64-unknown-none
200196
- run: cargo check --benches -p wasm-smith
201197
- run: cargo check --no-default-features
@@ -246,7 +242,7 @@ jobs:
246242
- uses: actions/checkout@v4
247243
with:
248244
submodules: true
249-
- run: rustup update stable && rustup default stable
245+
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
250246
- run: rustc ci/publish.rs
251247
# Make sure the tree is publish-able as-is
252248
- run: ./publish verify

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ keywords = ["webassembly", "wasm"]
1111
repository = "https://github.com/bytecodealliance/wasm-tools"
1212
readme = "README.md"
1313
exclude = ['tests/wabt', 'tests/testsuite', 'tests/snapshots', 'ci']
14+
rust-version.workspace = true
1415

1516
[lints]
1617
workspace = true
@@ -34,6 +35,9 @@ all = "allow"
3435
[workspace.package]
3536
edition = '2021'
3637
version = "0.207.0"
38+
# Current policy for wasm-tools is the same as Wasmtime which is that this
39+
# number can be no larger than the current stable release of Rust minus 2.
40+
rust-version = "1.76.0"
3741

3842
[workspace.dependencies]
3943
anyhow = "1.0.58"

crates/c-api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license = "Apache-2.0 WITH LLVM-exception"
88
readme = "./README.md"
99
repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/c-api"
1010
publish = false
11+
rust-version.workspace = true
1112

1213
[lib]
1314
name = "wasmtools"

crates/fuzz-stats/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "fuzz-stats"
33
edition.workspace = true
44
publish = false
5+
rust-version.workspace = true
56

67
[dependencies]
78
anyhow = { workspace = true }

crates/wasm-compose/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wa
99
homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-compose"
1010
documentation = "https://docs.rs/wasm-compose"
1111
description = "A library for composing WebAssembly components."
12+
rust-version.workspace = true
1213

1314
[lints]
1415
workspace = true

crates/wasm-compose/example/middleware/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "middleware"
33
version = "0.1.0"
44
edition = "2021"
55
publish = false
6+
rust-version.workspace = true
67

78
[dependencies]
89
flate2 = "1.0.24"

crates/wasm-compose/example/server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "host"
33
version = "0.1.0"
44
edition = "2021"
55
publish = false
6+
rust-version.workspace = true
67

78
[dependencies]
89
async-std = { version = "1.12.0", features = ["attributes"] }

crates/wasm-compose/example/service/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "svc"
33
version = "0.1.0"
44
edition = "2021"
55
publish = false
6+
rust-version.workspace = true
67

78
[dependencies]
89
cargo-component-bindings = "0.6.0"

crates/wasm-encoder/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ documentation = "https://docs.rs/wasm-encoder"
1111
description = """
1212
A low-level WebAssembly encoder.
1313
"""
14+
rust-version.workspace = true
1415

1516
[lints]
1617
workspace = true

crates/wasm-metadata/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edition.workspace = true
55
license = "Apache-2.0 WITH LLVM-exception"
66
repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-metadata"
77
description = "Read and manipulate WebAssembly metadata"
8+
rust-version.workspace = true
89

910
[lints]
1011
workspace = true

0 commit comments

Comments
 (0)