Skip to content

Commit 44c29fa

Browse files
authored
chore(ci): use installer from elixir-lang.org (#129)
Signed-off-by: Cocoa <i@uwucocoa.moe>
1 parent f16d86e commit 44c29fa

File tree

2 files changed

+22
-70
lines changed

2 files changed

+22
-70
lines changed

.github/workflows/ci.yml

+9-40
Original file line numberDiff line numberDiff line change
@@ -77,52 +77,21 @@ jobs:
7777
ELIXIR_VERSION: "1.15.7"
7878

7979
steps:
80-
- uses: actions/checkout@v4
81-
82-
- name: Cache OTP
83-
uses: actions/cache@v4
84-
id: cache-otp
85-
with:
86-
path: ./cache/otp
87-
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}
80+
- name: Checkout
81+
uses: actions/checkout@v4
8882

89-
- name: Download OTP
90-
if: steps.cache-otp.outputs.cache-hit != 'true'
83+
- name: Install OTP and Elixir
9184
run: |
92-
mkdir -p ./cache/otp
93-
curl -fSL https://github.com/cocoa-xu/otp-build/releases/download/v${{ env.OTP_VERSION }}/otp-x86_64-apple-darwin.tar.gz -o ./cache/otp/otp-v${{ env.OTP_VERSION }}-x86_64-apple-darwin.tar.gz
94-
cd ./cache/otp
95-
tar -xzf otp-v${{ env.OTP_VERSION }}-x86_64-apple-darwin.tar.gz
96-
97-
- name: Cache Elixir
98-
id: cache-elixir
99-
uses: actions/cache@v4
100-
with:
101-
path: ./cache/elixir
102-
key: ${{ runner.os }}-elixir-${{ env.ELIXIR_VERSION }}
85+
curl -fsSO https://elixir-lang.org/install.sh
86+
sh install.sh "elixir@${ELIXIR_VERSION}" "otp@${OTP_VERSION}"
10387
104-
- name: Download and Compile Elixir
105-
if: steps.cache-elixir.outputs.cache-hit != 'true'
88+
- name: Compile and Test
10689
run: |
107-
export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ env.ELIXIR_VERSION }}/bin:${PATH}
108-
export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
109-
mkdir -p ./cache/elixir
110-
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
111-
cd ./cache/elixir
112-
tar -xzf elixir-${{ env.ELIXIR_VERSION }}.tar.gz
113-
cd elixir-${{ env.ELIXIR_VERSION }}
114-
make -j$(sysctl -n hw.ncpu) install
90+
export OTP_MAIN_VER="${OTP_VERSION%%.*}"
91+
export PATH=$HOME/.elixir-install/installs/otp/${OTP_VERSION}/bin:$PATH
92+
export PATH=$HOME/.elixir-install/installs/elixir/${ELIXIR_VERSION}-otp-${OTP_MAIN_VER}/bin:$PATH
11593
116-
- name: macOS setup
117-
run: |
118-
export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ env.ELIXIR_VERSION }}/bin:${PATH}
119-
export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
12094
mix local.hex --force
12195
mix local.rebar --force
122-
123-
- name: Compile and Test
124-
run: |
125-
export PATH=$(pwd)/./cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ env.ELIXIR_VERSION }}/bin:${PATH}
126-
export ERL_ROOTDIR=$(pwd)/./cache/otp/usr/local/lib/erlang
12796
mix deps.get
12897
mix test --exclude postgresql

.github/workflows/precompile.yml

+13-30
Original file line numberDiff line numberDiff line change
@@ -57,48 +57,31 @@ jobs:
5757
runs-on: macos-13
5858
env:
5959
MIX_ENV: prod
60-
elixir_version: "1.16.2"
61-
strategy:
62-
matrix:
63-
job:
64-
- { otp_version: "25.3.2.8", elixir: "1.16.2" }
60+
ELIXIR_VERSION: "1.16.2"
61+
OTP_VERSION: "25.3.2.8"
6562

66-
name: macOS - OTP ${{ matrix.job.otp_version }}
63+
name: macOS
6764

6865
steps:
6966
- name: Checkout
7067
uses: actions/checkout@v4
7168

72-
- name: Install erlang and elixir
69+
- name: Install OTP and Elixir
7370
run: |
74-
export ROOT_DIR=$(pwd)
75-
76-
mkdir -p ./cache/otp
77-
curl -fSL https://github.com/cocoa-xu/otp-build/releases/download/v${{ matrix.job.otp_version }}/otp-x86_64-apple-darwin.tar.gz -o ./cache/otp/otp-v${{ matrix.job.otp_version }}-x86_64-apple-darwin.tar.gz
78-
cd ./cache/otp
79-
tar -xzf otp-v${{ matrix.job.otp_version }}-x86_64-apple-darwin.tar.gz
80-
cd ${ROOT_DIR}
81-
82-
export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
83-
export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
84-
85-
mkdir -p ./cache/elixir
86-
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
87-
cd ./cache/elixir
88-
tar -xzf elixir-${{ matrix.job.elixir }}.tar.gz
89-
cd elixir-${{ matrix.job.elixir }}
90-
make compile
91-
make -j$(sysctl -n hw.ncpu) install
92-
93-
mix local.hex --force
94-
mix local.rebar --force
71+
curl -fsSO https://elixir-lang.org/install.sh
72+
sh install.sh "elixir@${ELIXIR_VERSION}" "otp@${OTP_VERSION}"
9573
9674
- name: Precompile
9775
run: |
98-
export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
99-
export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
76+
export OTP_MAIN_VER="${OTP_VERSION%%.*}"
77+
export PATH=$HOME/.elixir-install/installs/otp/${OTP_VERSION}/bin:$PATH
78+
export PATH=$HOME/.elixir-install/installs/elixir/${ELIXIR_VERSION}-otp-${OTP_MAIN_VER}/bin:$PATH
79+
10080
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
10181
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
82+
83+
mix local.hex --force
84+
mix local.rebar --force
10285
mix deps.get
10386
mix elixir_make.precompile
10487

0 commit comments

Comments
 (0)