diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51c0e4b8..e2cc7bea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,8 +34,8 @@ jobs: # - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04 , use-cross: true } - { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, use-cross: true } - { target: aarch64-unknown-linux-musl, os: ubuntu-20.04, use-cross: true } - - { target: aarch64-apple-darwin, os: macos-12 } - - { target: x86_64-apple-darwin, os: macos-12 } + - { target: aarch64-apple-darwin, os: macos-15 } + - { target: x86_64-apple-darwin, os: macos-15 } - { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 } - { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, use-cross: true } - { target: riscv64gc-unknown-linux-gnu, os: ubuntu-20.04, use-cross: true, cargo-args: "--no-default-features"} diff --git a/.gitignore b/.gitignore index 41b433cc..f44aba62 100644 --- a/.gitignore +++ b/.gitignore @@ -24,10 +24,7 @@ wasmex-*.tar # Cargo things in the Rust part of this package priv/native/libwasmex.so -test/wasm_source/target/* -test/wasm_link_test/target/* -test/wasm_link_dep_test/target/* -test/wasm_link_import_test/target/* +test/**/target/* .mix_tasks **/.DS_Store diff --git a/.tool-versions b/.tool-versions index 7a9c1c3e..cf2e822a 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,3 @@ -erlang 27.0 -elixir 1.17.0-otp-27 +erlang 27.1.2 +elixir 1.17.3-otp-27 +rust 1.82.0 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..81a790e7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "rust-analyzer.linkedProjects": [ + "./native/wasmex/Cargo.toml" + ] +} diff --git a/docs/release.md b/docs/release.md index 36f0acfd..f241f5a4 100644 --- a/docs/release.md +++ b/docs/release.md @@ -5,7 +5,7 @@ 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. Wait for the CI to create the github release and precompiled 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 diff --git a/test/wasi_test/.cargo/config.toml b/test/fixture_projects/wasi_test/.cargo/config.toml similarity index 100% rename from test/wasi_test/.cargo/config.toml rename to test/fixture_projects/wasi_test/.cargo/config.toml diff --git a/test/wasi_test/.gitignore b/test/fixture_projects/wasi_test/.gitignore similarity index 100% rename from test/wasi_test/.gitignore rename to test/fixture_projects/wasi_test/.gitignore diff --git a/test/wasi_test/Cargo.lock b/test/fixture_projects/wasi_test/Cargo.lock similarity index 100% rename from test/wasi_test/Cargo.lock rename to test/fixture_projects/wasi_test/Cargo.lock diff --git a/test/wasi_test/Cargo.toml b/test/fixture_projects/wasi_test/Cargo.toml similarity index 100% rename from test/wasi_test/Cargo.toml rename to test/fixture_projects/wasi_test/Cargo.toml diff --git a/test/wasi_test/README.md b/test/fixture_projects/wasi_test/README.md similarity index 100% rename from test/wasi_test/README.md rename to test/fixture_projects/wasi_test/README.md diff --git a/test/wasi_test/src/main.rs b/test/fixture_projects/wasi_test/src/main.rs similarity index 100% rename from test/wasi_test/src/main.rs rename to test/fixture_projects/wasi_test/src/main.rs diff --git a/test/wasm_import_test/.cargo/config.toml b/test/fixture_projects/wasm_import_test/.cargo/config.toml similarity index 100% rename from test/wasm_import_test/.cargo/config.toml rename to test/fixture_projects/wasm_import_test/.cargo/config.toml diff --git a/test/wasm_import_test/.gitignore b/test/fixture_projects/wasm_import_test/.gitignore similarity index 100% rename from test/wasm_import_test/.gitignore rename to test/fixture_projects/wasm_import_test/.gitignore diff --git a/test/wasm_import_test/Cargo.lock b/test/fixture_projects/wasm_import_test/Cargo.lock similarity index 100% rename from test/wasm_import_test/Cargo.lock rename to test/fixture_projects/wasm_import_test/Cargo.lock diff --git a/test/wasm_import_test/Cargo.toml b/test/fixture_projects/wasm_import_test/Cargo.toml similarity index 100% rename from test/wasm_import_test/Cargo.toml rename to test/fixture_projects/wasm_import_test/Cargo.toml diff --git a/test/wasm_import_test/src/lib.rs b/test/fixture_projects/wasm_import_test/src/lib.rs similarity index 100% rename from test/wasm_import_test/src/lib.rs rename to test/fixture_projects/wasm_import_test/src/lib.rs diff --git a/test/wasm_link_dep_test/Cargo.lock b/test/fixture_projects/wasm_link_dep_test/Cargo.lock similarity index 100% rename from test/wasm_link_dep_test/Cargo.lock rename to test/fixture_projects/wasm_link_dep_test/Cargo.lock diff --git a/test/wasm_link_dep_test/Cargo.toml b/test/fixture_projects/wasm_link_dep_test/Cargo.toml similarity index 100% rename from test/wasm_link_dep_test/Cargo.toml rename to test/fixture_projects/wasm_link_dep_test/Cargo.toml diff --git a/test/wasm_link_dep_test/src/lib.rs b/test/fixture_projects/wasm_link_dep_test/src/lib.rs similarity index 100% rename from test/wasm_link_dep_test/src/lib.rs rename to test/fixture_projects/wasm_link_dep_test/src/lib.rs diff --git a/test/wasm_link_import_test/.cargo/config.toml b/test/fixture_projects/wasm_link_import_test/.cargo/config.toml similarity index 100% rename from test/wasm_link_import_test/.cargo/config.toml rename to test/fixture_projects/wasm_link_import_test/.cargo/config.toml diff --git a/test/wasm_link_import_test/Cargo.lock b/test/fixture_projects/wasm_link_import_test/Cargo.lock similarity index 100% rename from test/wasm_link_import_test/Cargo.lock rename to test/fixture_projects/wasm_link_import_test/Cargo.lock diff --git a/test/wasm_link_import_test/Cargo.toml b/test/fixture_projects/wasm_link_import_test/Cargo.toml similarity index 100% rename from test/wasm_link_import_test/Cargo.toml rename to test/fixture_projects/wasm_link_import_test/Cargo.toml diff --git a/test/wasm_link_import_test/src/lib.rs b/test/fixture_projects/wasm_link_import_test/src/lib.rs similarity index 100% rename from test/wasm_link_import_test/src/lib.rs rename to test/fixture_projects/wasm_link_import_test/src/lib.rs diff --git a/test/wasm_link_test/Cargo.lock b/test/fixture_projects/wasm_link_test/Cargo.lock similarity index 100% rename from test/wasm_link_test/Cargo.lock rename to test/fixture_projects/wasm_link_test/Cargo.lock diff --git a/test/wasm_link_test/Cargo.toml b/test/fixture_projects/wasm_link_test/Cargo.toml similarity index 100% rename from test/wasm_link_test/Cargo.toml rename to test/fixture_projects/wasm_link_test/Cargo.toml diff --git a/test/wasm_link_test/src/lib.rs b/test/fixture_projects/wasm_link_test/src/lib.rs similarity index 100% rename from test/wasm_link_test/src/lib.rs rename to test/fixture_projects/wasm_link_test/src/lib.rs diff --git a/test/wasm_test/.cargo/config.toml b/test/fixture_projects/wasm_test/.cargo/config.toml similarity index 100% rename from test/wasm_test/.cargo/config.toml rename to test/fixture_projects/wasm_test/.cargo/config.toml diff --git a/test/wasm_test/.gitignore b/test/fixture_projects/wasm_test/.gitignore similarity index 100% rename from test/wasm_test/.gitignore rename to test/fixture_projects/wasm_test/.gitignore diff --git a/test/wasm_test/Cargo.lock b/test/fixture_projects/wasm_test/Cargo.lock similarity index 100% rename from test/wasm_test/Cargo.lock rename to test/fixture_projects/wasm_test/Cargo.lock diff --git a/test/wasm_test/Cargo.toml b/test/fixture_projects/wasm_test/Cargo.toml similarity index 100% rename from test/wasm_test/Cargo.toml rename to test/fixture_projects/wasm_test/Cargo.toml diff --git a/test/wasm_test/src/lib.rs b/test/fixture_projects/wasm_test/src/lib.rs similarity index 100% rename from test/wasm_test/src/lib.rs rename to test/fixture_projects/wasm_test/src/lib.rs diff --git a/test/test_helper.exs b/test/test_helper.exs index ecc1aa9e..b5e84d37 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,10 +1,11 @@ defmodule TestHelper do - @wasm_test_source_dir "#{Path.dirname(__ENV__.file)}/wasm_test" - @wasm_link_test_source_dir "#{Path.dirname(__ENV__.file)}/wasm_link_test" - @wasm_link_dep_test_source_dir "#{Path.dirname(__ENV__.file)}/wasm_link_dep_test" - @wasm_link_import_test_source_dir "#{Path.dirname(__ENV__.file)}/wasm_link_import_test" - @wasm_import_test_source_dir "#{Path.dirname(__ENV__.file)}/wasm_import_test" - @wasi_test_source_dir "#{Path.dirname(__ENV__.file)}/wasi_test" + @fixture_project_dir "#{Path.dirname(__ENV__.file)}/fixture_projects" + @wasm_test_source_dir "#{@fixture_project_dir}/wasm_test" + @wasm_link_test_source_dir "#{@fixture_project_dir}/wasm_link_test" + @wasm_link_dep_test_source_dir "#{@fixture_project_dir}/wasm_link_dep_test" + @wasm_link_import_test_source_dir "#{@fixture_project_dir}/wasm_link_import_test" + @wasm_import_test_source_dir "#{@fixture_project_dir}/wasm_import_test" + @wasi_test_source_dir "#{@fixture_project_dir}/wasi_test" def wasm_test_file_path, do: "#{@wasm_test_source_dir}/target/wasm32-unknown-unknown/debug/wasmex_test.wasm" @@ -40,7 +41,7 @@ defmodule TestHelper do "--target=wasm32-unknown-unknown", "--", "--extern", - "utils=../wasm_test/target/wasm32-unknown-unknown/debug/wasmex_test.wasm" + "utils=#{@wasm_test_source_dir}/target/wasm32-unknown-unknown/debug/wasmex_test.wasm" ], cd: @wasm_link_test_source_dir ) @@ -53,7 +54,7 @@ defmodule TestHelper do "--target=wasm32-unknown-unknown", "--", "--extern", - "calculator=../wasm_link_test/target/wasm32-unknown-unknown/debug/wasmex_link_test.wasm" + "calculator=#{@wasm_link_test_source_dir}/target/wasm32-unknown-unknown/debug/wasmex_link_test.wasm" ], cd: @wasm_link_dep_test_source_dir ) diff --git a/test/wasi_test.exs b/test/wasi_test.exs index 3c8f95d3..0de92118 100644 --- a/test/wasi_test.exs +++ b/test/wasi_test.exs @@ -144,9 +144,9 @@ defmodule WasiTest do {:ok, stdout} = Wasmex.Pipe.new() wasi = %WasiOptions{ - args: ["wasmex", "list_files", "test/wasi_test/src"], + args: ["wasmex", "list_files", "test/fixture_projects/wasi_test/src"], stdout: stdout, - preopen: [%PreopenOptions{path: "test/wasi_test/src"}] + preopen: [%PreopenOptions{path: "test/fixture_projects/wasi_test/src"}] } instance = @@ -156,7 +156,7 @@ defmodule WasiTest do {:ok, _} = Wasmex.call_function(instance, :_start, []) Wasmex.Pipe.seek(stdout, 0) - assert Wasmex.Pipe.read(stdout) == "\"test/wasi_test/src/main.rs\"\n" + assert Wasmex.Pipe.read(stdout) == "\"test/fixture_projects/wasi_test/src/main.rs\"\n" end test "list files on a preopened dir with alias" do @@ -165,7 +165,9 @@ defmodule WasiTest do wasi = %WasiOptions{ args: ["wasmex", "list_files", "aliased_src"], stdout: stdout, - preopen: [%PreopenOptions{path: "test/wasi_test/src", alias: "aliased_src"}] + preopen: [ + %PreopenOptions{path: "test/fixture_projects/wasi_test/src", alias: "aliased_src"} + ] } instance = @@ -184,7 +186,7 @@ defmodule WasiTest do wasi = %WasiOptions{ args: ["wasmex", "read_file", "src/main.rs"], stdout: stdout, - preopen: [%PreopenOptions{path: "test/wasi_test/src", alias: "src"}] + preopen: [%PreopenOptions{path: "test/fixture_projects/wasi_test/src", alias: "src"}] } instance = @@ -193,7 +195,7 @@ defmodule WasiTest do ) {:ok, _} = Wasmex.call_function(instance, :_start, []) - {:ok, expected_content} = File.read("test/wasi_test/src/main.rs") + {:ok, expected_content} = File.read("test/fixture_projects/wasi_test/src/main.rs") Wasmex.Pipe.seek(stdout, 0) assert Wasmex.Pipe.read(stdout) == expected_content <> "\n" end diff --git a/test/wasmex_test.exs b/test/wasmex_test.exs index 2d43cb6a..928988ac 100644 --- a/test/wasmex_test.exs +++ b/test/wasmex_test.exs @@ -305,7 +305,7 @@ defmodule WasmexTest do assert {:error, reason} = Wasmex.call_function(pid, :divide, [1, 0]) # contains source file and line number - assert reason =~ "wasmex/test/wasm_test/src/lib.rs:75:5" + assert reason =~ "wasm_test/src/lib.rs:75:5" end end