diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml index 5aa8505..0d11907 100644 --- a/.github/actions/install-rust/action.yml +++ b/.github/actions/install-rust/action.yml @@ -10,16 +10,16 @@ inputs: runs: using: composite steps: - - name: Install Rust + - name: Select Rust shell: bash id: select run: | - # Determine MSRV as N in `1.N.0` by looking at the `rust-version` - # located in the root `Cargo.toml`. - msrv=$(grep 'rust-version.*1' Cargo.toml | sed 's/.*\.\([0-9]*\)\..*/\1/') + # Determine MSRV by looking at the `rust-version` located in the root + # `Cargo.toml`. + msrv=$(grep 'rust-version.*1' Cargo.toml | sed 's/rust-version *\= *"\([^"]*\)"/\1/') if [ "${{ inputs.toolchain }}" = "msrv" ]; then - echo "version=1.$msrv.0" >> "$GITHUB_OUTPUT" + echo "version=$msrv" >> "$GITHUB_OUTPUT" else echo "version=${{ inputs.toolchain }}" >> "$GITHUB_OUTPUT" fi diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 726a7cf..026420a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,15 +17,17 @@ permissions: jobs: build_and_test: name: Build and test - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] + rust: [msrv, stable, nightly] steps: - uses: actions/checkout@master - uses: ./.github/actions/install-rust + with: + toolchain: ${{ matrix.rust }} - name: Install wasmtime uses: bytecodealliance/actions/wasmtime/setup@v1 diff --git a/Cargo.toml b/Cargo.toml index 6129835..4fbb58b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,8 +59,7 @@ license = "Apache-2.0 WITH LLVM-exception" repository = "https://github.com/bytecodealliance/wstd" keywords = ["WebAssembly", "async", "stdlib", "Components"] categories = ["wasm", "asynchronous"] -# Rust-version policy: stable N-2, same as wasmtime. -rust-version = "1.89" +rust-version = "1.88" authors = [ "Yoshua Wuyts ", "Pat Hickey ", diff --git a/test-programs/Cargo.toml b/test-programs/Cargo.toml index ba431b4..f280352 100644 --- a/test-programs/Cargo.toml +++ b/test-programs/Cargo.toml @@ -16,6 +16,9 @@ ureq.workspace = true cargo_metadata.workspace = true heck.workspace = true +[dependencies] +fs2 = "0.4" + [features] default = [] no-aws = [] diff --git a/test-programs/src/lib.rs b/test-programs/src/lib.rs index 0d4a83f..a62d166 100644 --- a/test-programs/src/lib.rs +++ b/test-programs/src/lib.rs @@ -6,6 +6,9 @@ use std::process::{Child, Command}; use std::thread::sleep; use std::time::Duration; +// Required until msrv over 1.89, at which point locking is available in std +use fs2::FileExt; + const DEFAULT_SERVER_PORT: u16 = 8081; /// Manages exclusive access to port 8081, and kills the process when dropped @@ -31,7 +34,8 @@ impl WasmtimeServe { let mut lockfile = std::env::temp_dir(); lockfile.push(format!("TEST_PROGRAMS_WASMTIME_SERVE_{port}.lock")); let lockfile = File::create(&lockfile)?; - lockfile.lock()?; + // Once msrv reaches 1.89, replace with std's `.lock()` method + lockfile.lock_exclusive()?; // Run wasmtime serve. // Enable -Scli because we currently don't have a way to build with the