@@ -10,7 +10,7 @@ permissions:
10
10
11
11
jobs :
12
12
precompile :
13
- runs-on : macos-12
13
+ runs-on : macos-14
14
14
env :
15
15
MIX_ENV : prod
16
16
strategy :
@@ -19,62 +19,57 @@ jobs:
19
19
- x86_64-apple-darwin
20
20
- arm64-apple-darwin
21
21
job :
22
- - {otp: "27.0.1", elixir: "1.17.2"}
23
- - {otp: "25.3.2.13", elixir: "1.16.3"}
22
+ - {otp: "27.0.1", elixir: "1.17.2-otp-27 "}
23
+ - {otp: "25.3.2.13", elixir: "1.16.3-otp-25 "}
24
24
25
25
name : Mac ${{ matrix.arch }} - OTP ${{ matrix.job.otp }} - Elixir ${{ matrix.job.elixir }}
26
26
steps :
27
27
- name : Checkout
28
28
uses : actions/checkout@v4
29
29
30
- - name : Cache OTP
30
+ - name : Install asdf
31
+ uses : asdf-vm/actions/setup@v2
32
+
33
+ - name : Cache asdf
34
+ id : asdf-cache
31
35
uses : actions/cache@v3
32
- id : cache-otp
33
36
with :
34
- path : ./cache/otp
35
- key : ${{ runner.os }}-otp -${{ matrix.arch }}-${{ matrix.job.otp }}
37
+ path : ~/.asdf
38
+ key : asdf- ${{ runner.os }}-build -${{ matrix.job.otp }}-${{ matrix.job.elixir }}
36
39
37
- - name : Install OTP
38
- if : steps.cache-otp.outputs.cache-hit != 'true'
40
+ - if : ${{ steps.asdf-cache.outputs.cache-hit != 'true' }}
41
+ name : Install Erlang & Elixir
42
+ env :
43
+ ELIXIR_VERSION : ${{ matrix.job.elixir }}
44
+ OTP_VERSION : ${{ matrix.job.otp }}
39
45
run : |
40
- mkdir -p ./cache/otp
41
- curl -fSL https://github.com/cocoa-xu/otp-build/releases/download/v${{ matrix.job.otp }}/otp-${{ matrix.arch }}.tar.gz -o ./cache/otp/otp-v${{ matrix.job.otp }}-${{ matrix.arch }}.tar.gz
42
- cd ./cache/otp
43
- tar -xzf otp-v${{ matrix.job.otp }}-${{ matrix.arch }}.tar.gz
46
+ asdf plugin-add erlang
47
+ asdf install erlang ${OTP_VERSION}
44
48
45
- - name : Cache Elixir
46
- id : cache-elixir
47
- uses : actions/cache@v3
48
- with :
49
- path : ./cache/elixir
50
- key : ${{ runner.os }}-elixir-${{ matrix.arch }}-${{ matrix.job.elixir }}-${{ matrix.job.otp }}
49
+ ELIXIR_OTP_VERSION=$(echo $OTP_VERSION | cut -d. -f1)
50
+ asdf plugin-add elixir
51
+ asdf install elixir ${ELIXIR_VERSION}-otp-${ELIXIR_OTP_VERSION}
51
52
52
- - name : Download and Compile Elixir
53
- if : steps.cache-elixir.outputs.cache-hit != 'true'
53
+ - name : Setup Erlang & Elixir
54
+ env :
55
+ ELIXIR_VERSION : ${{ matrix.job.elixir }}
56
+ OTP_VERSION : ${{ matrix.job.otp }}
54
57
run : |
55
- export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
56
- export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
57
- mkdir -p ./cache/elixir
58
- curl -fSL https://github.com/elixir-lang/elixir/archive/refs/tags/v${{ matrix.job.elixir }}.tar.gz -o ./cache/elixir/elixir-${{ matrix.job.elixir }}.tar.gz
59
- cd ./cache/elixir
60
- tar -xzf elixir-${{ matrix.job.elixir }}.tar.gz
61
- cd elixir-${{ matrix.job.elixir }}
62
- make -j$(sysctl -n hw.ncpu) install
58
+ asdf global erlang ${OTP_VERSION}
59
+ ELIXIR_OTP_VERSION=$(echo $OTP_VERSION | cut -d. -f1)
60
+ asdf global elixir ${ELIXIR_VERSION}-otp-${ELIXIR_OTP_VERSION}
63
61
64
- - name : Install Mix and Rebar
62
+ - name : Install hex & rebar
65
63
run : |
66
- export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
67
- export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
68
64
mix local.hex --force
69
65
mix local.rebar --force
70
66
71
- - name : Create precompiled ${{ matrix.arch }} library
67
+ - run : mix deps.get
68
+
69
+ - name : Pre-compile NIF library
72
70
run : |
73
- export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
74
- export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
75
71
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
76
72
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
77
- mix deps.get
78
73
mix elixir_make.precompile
79
74
80
75
- uses : softprops/action-gh-release@v1
0 commit comments