diff --git a/.github/workflows/compatibility-elixir.yml b/.github/workflows/compatibility-elixir.yml index 845ccab..ad6c992 100644 --- a/.github/workflows/compatibility-elixir.yml +++ b/.github/workflows/compatibility-elixir.yml @@ -25,7 +25,7 @@ jobs: - otp: 27.0 elixir: 1.16.1 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: otp-version: ${{ matrix.otp }} diff --git a/.github/workflows/elixir-ci.yml b/.github/workflows/elixir-ci.yml index 7d8659c..9d6483f 100644 --- a/.github/workflows/elixir-ci.yml +++ b/.github/workflows/elixir-ci.yml @@ -18,7 +18,7 @@ jobs: outputs: deps-cache-key: ${{ steps.get-cache-key.outputs.key }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} @@ -31,7 +31,7 @@ jobs: - id: get-cache-key run: echo "key=mix-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ hashFiles('**/mix.lock') }}" >> $GITHUB_OUTPUT - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-deps with: path: | @@ -46,13 +46,13 @@ jobs: needs: deps runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-deps with: path: | @@ -66,7 +66,7 @@ jobs: needs: deps runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} @@ -78,13 +78,13 @@ jobs: needs: deps runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-deps with: path: | @@ -98,13 +98,13 @@ jobs: needs: deps runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: otp-version: ${{ env.OTP_VERSION }} elixir-version: ${{ env.ELIXIR_VERSION }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-deps with: path: | @@ -121,7 +121,7 @@ jobs: rustup target add wasm32-unknown-unknown rustup target add wasm32-wasi - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a53b868..51c0e4b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: steps: - name: Checkout source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Extract crate information shell: bash @@ -79,13 +79,13 @@ jobs: cargo-args: ${{ matrix.job.cargo-args }} - name: Artifact upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.build-crate.outputs.file-name }} path: ${{ steps.build-crate.outputs.file-path }} - name: Publish archives and packages - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | ${{ steps.build-crate.outputs.file-path }} diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index d09a8fa..d6f8c6e 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -16,13 +16,13 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: stable components: rustfmt, clippy - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ diff --git a/docs/release.md b/docs/release.md new file mode 100644 index 0000000..36f0acf --- /dev/null +++ b/docs/release.md @@ -0,0 +1,12 @@ +# How to release a new version of Wasmex + +1. Make sure CI is green and `CHANGELOG.md` is up to date +1. Increase the package version in `mix.exs`, `README.md` and `Cargo.toml` - best grep for the current version and replace it +1. Commit the version bump and push it +1. Tag the commit with the new version number `git tag -a v0.8.0` - copy the changelog into the tag message +1. Push the tag `git push --tags` +1. Wait for the CI to create the github release and precompied binaries +1. Edit the GitHub release with the `CHANGELOG.md` content +1. Download the precompiled binaries with `mix rustler_precompiled.download Wasmex.Native --all --ignore-unavailable --print` +1. Inspect the output and the checksum-Elixir.Wasmex.Native.exs file +1. Continue with `mix hex.publish` diff --git a/native/wasmex/src/engine.rs b/native/wasmex/src/engine.rs index 4b9ef2e..27cb861 100644 --- a/native/wasmex/src/engine.rs +++ b/native/wasmex/src/engine.rs @@ -1,8 +1,3 @@ -// Due to a clippy bug it thinks we needlessly borrow stuff -// when defining the ExStoreLimits struct -// see: https://github.com/rust-lang/rust-clippy/issues/9778 -#![allow(clippy::needless_borrow)] - use rustler::{Binary, Error, NifStruct, OwnedBinary, Resource, ResourceArc}; use std::ops::Deref; use std::sync::Mutex; diff --git a/native/wasmex/src/instance.rs b/native/wasmex/src/instance.rs index 7299483..ee183d9 100644 --- a/native/wasmex/src/instance.rs +++ b/native/wasmex/src/instance.rs @@ -1,3 +1,7 @@ +// Clippy regression in rust 1.80.0 +// see: https://github.com/rust-lang/rust-clippy/issues/13170 +#![allow(clippy::needless_borrows_for_generic_args)] + use crate::{ atoms, environment::{link_imports, link_modules, CallbackTokenResource}, @@ -111,7 +115,7 @@ pub fn get_global_value( ))) })?; - let value = global.get(&mut store_or_caller); + let value = global.get(store_or_caller); match value { Val::I32(i) => Ok(i.encode(env)), @@ -177,7 +181,7 @@ pub fn set_global_value( }; global - .set(&mut store_or_caller, val) + .set(store_or_caller, val) .map_err(|e| rustler::Error::Term(Box::new(format!("Could not set global: {e}")))) } diff --git a/native/wasmex/src/module.rs b/native/wasmex/src/module.rs index 81ded02..69cfe85 100644 --- a/native/wasmex/src/module.rs +++ b/native/wasmex/src/module.rs @@ -119,8 +119,8 @@ enum WasmValueType { Ref(String), } -impl<'a> Encoder for WasmValueType { - fn encode<'b>(&self, env: Env<'b>) -> Term<'b> { +impl Encoder for WasmValueType { + fn encode<'a>(&self, env: Env<'a>) -> Term<'a> { match self { Self::I32 => atoms::i32().encode(env), Self::I64 => atoms::i64().encode(env), diff --git a/native/wasmex/src/store.rs b/native/wasmex/src/store.rs index afee378..b5061eb 100644 --- a/native/wasmex/src/store.rs +++ b/native/wasmex/src/store.rs @@ -1,8 +1,3 @@ -// Due to a clippy bug it thinks we needlessly borrow stuff -// when defining the ExStoreLimits struct -// see: https://github.com/rust-lang/rust-clippy/issues/9778 -#![allow(clippy::needless_borrow)] - use crate::{ caller::{get_caller, get_caller_mut}, engine::{unwrap_engine, EngineResource}, @@ -223,7 +218,7 @@ pub fn set_fuel( })?); match store_or_caller { StoreOrCaller::Store(store) => store.set_fuel(fuel), - StoreOrCaller::Caller(token) => get_caller_mut(&token) + StoreOrCaller::Caller(token) => get_caller_mut(token) .ok_or_else(|| { rustler::Error::Term(Box::new( "Caller is not valid. Only use a caller within its own function scope.", @@ -244,7 +239,7 @@ pub fn get_fuel( })?); match store_or_caller { StoreOrCaller::Store(store) => store.get_fuel(), - StoreOrCaller::Caller(token) => get_caller_mut(&token) + StoreOrCaller::Caller(token) => get_caller_mut(token) .ok_or_else(|| { rustler::Error::Term(Box::new( "Caller is not valid. Only use a caller within its own function scope.",