diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8c93d0..6f9df6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,20 +8,39 @@ on: jobs: test: - runs-on: ubuntu-24.04 + name: Test (${{ matrix.os }}, Elixir ${{ matrix.pair.elixir }}, OTP ${{ matrix.pair.otp }}) + runs-on: ${{ matrix.os }} env: MIX_ENV: test strategy: fail-fast: false matrix: include: - - pair: - elixir: 1.16 - otp: 26 - - pair: + - os: ubuntu-latest + pair: + elixir: "1.16" + otp: "26" + - os: ubuntu-latest + pair: elixir: "1.20" - otp: 29 + otp: "29" lint: true + - os: ubuntu-24.04-arm + pair: + elixir: "1.20" + otp: "29" + - os: macos-15-intel + pair: + elixir: "1.20" + otp: "29" + - os: macos-latest + pair: + elixir: "1.20" + otp: "29" + - os: windows-latest + pair: + elixir: "1.20" + otp: "29" steps: - uses: actions/checkout@v6 @@ -35,7 +54,7 @@ jobs: path: | deps _build - key: ${{ runner.os }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-${{ hashFiles('**/mix.lock') }} + key: ${{ matrix.os }}-${{ runner.arch }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-${{ hashFiles('**/mix.lock') }} - run: mix deps.get diff --git a/test/rustler_precompiled_test.exs b/test/rustler_precompiled_test.exs index c777efb..2c32110 100644 --- a/test/rustler_precompiled_test.exs +++ b/test/rustler_precompiled_test.exs @@ -230,6 +230,7 @@ defmodule RustlerPrecompiledTest do - x86_64-unknown-linux-gnu - x86_64-unknown-linux-musl """ + |> String.replace("\r\n", "\n") |> String.trim() assert {:error, ^error_message} = RustlerPrecompiled.target(config, @available_targets) @@ -369,10 +370,7 @@ defmodule RustlerPrecompiledTest do @tag :tmp_dir test "check_integrity_from_map/3", %{tmp_dir: tmp_dir} do - content = """ - Roses are red - Violets are blue - """ + content = "Roses are red\nViolets are blue\n" file_path = Path.join(tmp_dir, "poem.txt") :ok = File.write(file_path, content) @@ -846,6 +844,12 @@ defmodule RustlerPrecompiledTest do checksum_sample = File.read!(Path.join(nif_fixtures_dir, "checksum-sample-file.exs")) Process.register(self(), :load_data_fun_test) + # Unload the NIF before other tests replace the shared library. + on_exit(fn -> + :code.delete(RustlerPrecompilationExample.Native) + :code.purge(RustlerPrecompilationExample.Native) + end) + in_tmp(tmp_dir, fn -> File.write!("checksum-Elixir.RustlerPrecompilationExample.Native.exs", checksum_sample)