Skip to content

Commit

Permalink
try to compile with NIF 2.14 for Linux and Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cocoa-xu committed Mar 10, 2024
1 parent bb11614 commit fa59cd6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ jobs:
MIX_ENV: test
strategy:
matrix:
otp_version: [25, 26]
job:
- { otp_version: "26", elixir_version: "1.15" }
- { otp_version: "21", elixir_version: "1.12" }

name: Linux x86_64 - OTP ${{ matrix.otp_version }}
name: Linux x86_64 - OTP ${{ matrix.job.otp_version }}

steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: 1.15
otp-version: ${{ matrix.job.otp_version }}
elixir-version: ${{ matrix.job.elixir_version }}

- name: Compile and Test
run: |
Expand All @@ -40,17 +42,20 @@ jobs:
MIX_ENV: test
strategy:
matrix:
otp_version: [25, 26]
job:
- { otp_version: "26", elixir_version: "1.15" }
- { otp_version: "21", elixir_version: "1.12" }

name: Windows x86_64 - OTP ${{ matrix.otp_version }}
name: Windows x86_64 - OTP ${{ matrix.job.otp_version }}

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: 1.15
otp-version: ${{ matrix.job.otp_version }}
elixir-version: ${{ matrix.job.elixir_version }}

- uses: ilammy/msvc-dev-cmd@v1
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/precompile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:

jobs:
linux:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
MIX_ENV: prod
strategy:
matrix:
otp_version: [26]
otp_version: [21]

name: Linux x86_64 - OTP ${{ matrix.otp_version }}

Expand All @@ -23,7 +23,7 @@ jobs:
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: 1.15
elixir-version: 1.12

- name: Install system dependecies
run: |
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
ELIXIR_VERSION: "1.16.0"
strategy:
matrix:
otp_version: ["26.2.2"]
otp_version: ["25.3.2.8"]

name: macOS x86_64 - OTP ${{ matrix.otp_version }}

Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
MIX_ENV: prod
strategy:
matrix:
otp_version: [26]
otp_version: [21]

name: Windows x86_64 - OTP ${{ matrix.otp_version }}

Expand All @@ -139,7 +139,7 @@ jobs:
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: 1.15
elixir-version: 1.12

- uses: ilammy/msvc-dev-cmd@v1
with:
Expand Down
11 changes: 10 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ defmodule StbImage.MixProject do
make_precompiler: {:nif, CCPrecompiler},
make_precompiler_url: "#{@github_url}/releases/download/v#{@version}/@{artefact_filename}",
make_precompiler_filename: "stb_image_nif",
make_precompiler_nif_versions: [versions: [@minimum_nif_version]]
make_precompiler_nif_versions: [
versions: fn opts ->
target = opts.target
if String.contains?(target, "darwin") do
["2.15"]
else
["2.14"]
end
end
]
]
end

Expand Down

0 comments on commit fa59cd6

Please sign in to comment.