Skip to content

Commit 0cfc0cc

Browse files
authored
chore(ci): use elixir-lang.org installer (#8)
Signed-off-by: Cocoa <[email protected]>
1 parent a412d6f commit 0cfc0cc

File tree

1 file changed

+10
-35
lines changed

1 file changed

+10
-35
lines changed

.github/workflows/macos.yml

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -33,44 +33,17 @@ jobs:
3333
- name: Checkout
3434
uses: actions/checkout@v4
3535

36-
- name: Cache OTP
37-
uses: actions/cache@v3
38-
id: cache-otp
39-
with:
40-
path: ./cache/otp
41-
key: ${{ runner.os }}-otp-${{ matrix.otp_version }}
42-
4336
- name: Download OTP
44-
if: steps.cache-otp.outputs.cache-hit != 'true'
45-
run: |
46-
mkdir -p ./cache/otp
47-
curl -fSL https://github.com/cocoa-xu/otp-build/releases/download/v${{ matrix.otp_version }}/otp-x86_64-apple-darwin.tar.gz -o ./cache/otp/otp-v${{ matrix.otp_version }}-x86_64-apple-darwin.tar.gz
48-
cd ./cache/otp
49-
tar -xzf otp-v${{ matrix.otp_version }}-x86_64-apple-darwin.tar.gz
50-
51-
- name: Cache Elixir
52-
id: cache-elixir
53-
uses: actions/cache@v3
54-
with:
55-
path: ./cache/elixir
56-
key: ${{ runner.os }}-elixir-${{ env.ELIXIR_VERSION }}
57-
58-
- name: Download and Compile Elixir
59-
if: steps.cache-elixir.outputs.cache-hit != 'true'
6037
run: |
61-
export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ env.ELIXIR_VERSION }}/bin:${PATH}
62-
export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
63-
mkdir -p ./cache/elixir
64-
curl -fSL https://github.com/elixir-lang/elixir/archive/refs/tags/v${{ env.ELIXIR_VERSION }}.tar.gz -o ./cache/elixir/elixir-${{ env.ELIXIR_VERSION }}.tar.gz
65-
cd ./cache/elixir
66-
tar -xzf elixir-${{ env.ELIXIR_VERSION }}.tar.gz
67-
cd elixir-${{ env.ELIXIR_VERSION }}
68-
make -j$(sysctl -n hw.ncpu) install
38+
curl -fsSO https://elixir-lang.org/install.sh
39+
sh install.sh "elixir@${{ env.ELIXIR_VERSION }}" "otp@${{ matrix.otp_version }}"
6940
7041
- name: Install Mix and Rebar
7142
run: |
72-
export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ env.ELIXIR_VERSION }}/bin:${PATH}
73-
export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
43+
export OTP_VERSION=${{ matrix.otp_version }}
44+
export OTP_MAIN_VER="${OTP_VERSION%%.*}"
45+
export PATH=$HOME/.elixir-install/installs/otp/${{ matrix.otp_version }}/bin:$PATH
46+
export PATH=$HOME/.elixir-install/installs/elixir/${{ env.ELIXIR_VERSION }}-otp-${OTP_MAIN_VER}/bin:$PATH
7447
mix local.hex --force
7548
mix local.rebar --force
7649
@@ -82,8 +55,10 @@ jobs:
8255

8356
- name: Compile and Test
8457
run: |
85-
export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ env.ELIXIR_VERSION }}/bin:${PATH}
86-
export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
58+
export OTP_VERSION=${{ matrix.otp_version }}
59+
export OTP_MAIN_VER="${OTP_VERSION%%.*}"
60+
export PATH=$HOME/.elixir-install/installs/otp/${{ matrix.otp_version }}/bin:$PATH
61+
export PATH=$HOME/.elixir-install/installs/elixir/${{ env.ELIXIR_VERSION }}-otp-${OTP_MAIN_VER}/bin:$PATH
8762
8863
mix deps.get
8964
mix deps.compile

0 commit comments

Comments
 (0)