I am working on a library that has a dependency on wasm-bindgen and needs to run some tests in Github Actions. In my Github workflow for CI, I install wasm-bindgen-cli via cargo binstall --no-confirm wasm-bindgen-cli@0.2.89
.
I have two crates in my workspace, a proc_macro crate and a library crate. The library crate has a dependency on wasm-bindgen = "0.2.89"
which I would have thought, given there are no transitive dependencies requiring a newer version, should be the version used. However, referring to this run, wasm-bindgen, web-sys, js-sys etc are still being updated to the latest versions. What are my options for solving this problem?
- I don't think specifying the dependency as
wasm-bindgen = "=0.2.89"
is correct since the version should be upgradable to any patch version greater than0.2.89
in downstream crates, i.e., outside of CI - I don't think checking in a Cargo.lock file is correct since this should only be done for binary crates to the best of my knowledge
- I have tried to put
wasm-bindgen = "=0.2.89"
in thedev-dependencies
section which seems flaky. It worked once in CI, but then failed after I changed the keywords in Cargo.toml, although I suspect the caching fromactions-rust-lang/setup-rust-toolchain@v1
might have something to do with this
What is the correct way to solve this problem?