Skip to content

Commit e2dda4e

Browse files
committed
Merge pull request #2183 from petermm/ci-macos-use-setup-beam
CI: Use setup-beam in macOS CI Fixes currently broken CIs for macos These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents e9cb79c + f0309fb commit e2dda4e

2 files changed

Lines changed: 37 additions & 33 deletions

File tree

.github/workflows/build-and-test-macos.yaml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
os: ["macos-14", "macos-15", "macos-15-intel", "macos-26"]
42-
otp: ["24", "25", "26", "27", "28"]
42+
otp: ["25", "26", "27", "28"]
4343
mbedtls: ["mbedtls@3"]
4444
cmake_opts_other: [""]
4545

@@ -66,22 +66,27 @@ jobs:
6666
with:
6767
submodules: 'recursive'
6868

69-
- name: "Install deps"
70-
if: matrix.otp != '24' && matrix.otp != '25'
71-
run: brew update && HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf doxygen erlang@${{ matrix.otp }} gleam ${{ matrix.mbedtls }} rebar3
69+
- name: "Normalize ImageOS for setup-beam"
70+
if: matrix.os == 'macos-26'
71+
run: echo "ImageOS=macos15" >> "$GITHUB_ENV"
72+
73+
- uses: erlef/setup-beam@v1
74+
with:
75+
otp-version: ${{ matrix.otp }}
76+
rebar3-version: ${{ fromJSON('{"25":"3.24.0","26":"3.25.1","27":"3.25.1","28":"3.26"}')[matrix.otp] || '3' }}
77+
hexpm-mirrors: |
78+
https://builds.hex.pm
79+
https://repo.hex.pm
80+
https://cdn.jsdelivr.net/hex
7281
7382
- name: "Install deps"
74-
if: matrix.otp == '24' || matrix.otp == '25'
75-
run: |
76-
brew update
77-
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf doxygen erlang@${{ matrix.otp }} gleam ${{ matrix.mbedtls }}
78-
wget https://github.com/erlang/rebar3/releases/download/3.23.0/rebar3
79-
chmod +x rebar3
80-
for bin_dir in {/usr/local,/opt/homebrew}/opt/erlang@{24,25}/bin/ ; do
81-
if [ -e ${bin_dir} ]; then
82-
sudo cp rebar3 ${bin_dir}
83-
fi
84-
done
83+
run: brew update && HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf doxygen ${{ matrix.mbedtls }}
84+
85+
- name: "Install Gleam"
86+
run: |
87+
# Reuse the OTP/rebar3 installed by setup-beam instead of Homebrew dependencies.
88+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --ignore-dependencies gleam
89+
gleam --version
8590
8691
- name: "Workaround for nxdomain random issues"
8792
run: |
@@ -126,20 +131,15 @@ jobs:
126131
- name: "Build: run cmake"
127132
working-directory: build
128133
run: |
129-
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:/opt/homebrew/opt/erlang@${{ matrix.otp }}/bin:$PATH"
130134
cmake -DAVM_WARNINGS_ARE_ERRORS=ON ${MBEDTLS_PREFIX:+-DCMAKE_PREFIX_PATH="$MBEDTLS_PREFIX"} ${{ matrix.cmake_opts_other }} -G Ninja ..
131135
132136
- name: "Build: run ninja"
133137
working-directory: build
134-
run: |
135-
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:/opt/homebrew/opt/erlang@${{ matrix.otp }}/bin:$PATH"
136-
ninja
138+
run: ninja
137139

138140
- name: "Build: run dialyzer"
139141
working-directory: build
140-
run: |
141-
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:/opt/homebrew/opt/erlang@${{ matrix.otp }}/bin:$PATH"
142-
ninja dialyzer
142+
run: ninja dialyzer
143143

144144
# Test
145145
- name: "Test: test-erlang"
@@ -202,7 +202,6 @@ jobs:
202202
- name: "Install and smoke test"
203203
working-directory: build
204204
run: |
205-
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:/opt/homebrew/opt/erlang@${{ matrix.otp }}/bin:$PATH"
206205
sudo ninja install
207206
atomvm examples/erlang/hello_world.avm
208207
atomvm -v

.github/workflows/run-tests-with-beam.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,12 @@ jobs:
9191
# This is ARM64
9292
- os: "macos-15"
9393
otp: "26"
94-
path_prefix: "/opt/homebrew/opt/erlang@26/bin:"
9594

9695
- os: "macos-15"
9796
otp: "27"
98-
path_prefix: "/opt/homebrew/opt/erlang@27/bin:"
9997

10098
- os: "macos-15"
10199
otp: "28"
102-
path_prefix: "/opt/homebrew/opt/erlang@28/bin:"
103100
steps:
104101
# Setup
105102
- name: "Checkout repo"
@@ -122,9 +119,23 @@ jobs:
122119
apt update -y
123120
apt install -y cmake gperf zlib1g-dev ninja-build
124121
122+
- name: "Normalize ImageOS for setup-beam"
123+
if: matrix.os == 'macos-26'
124+
run: echo "ImageOS=macos15" >> "$GITHUB_ENV"
125+
126+
- uses: erlef/setup-beam@v1
127+
if: runner.os == 'macOS'
128+
with:
129+
otp-version: ${{ matrix.otp }}
130+
rebar3-version: ${{ fromJSON('{"26":"3.25.1","27":"3.25.1","28":"3.26"}')[matrix.otp] || '3' }}
131+
hexpm-mirrors: |
132+
https://builds.hex.pm
133+
https://repo.hex.pm
134+
https://cdn.jsdelivr.net/hex
135+
125136
- name: "Install deps (macOS)"
126137
if: runner.os == 'macOS'
127-
run: brew update && brew install gperf erlang@${{ matrix.otp }} mbedtls@3 rebar3
138+
run: brew update && HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf mbedtls@3
128139

129140
- name: "macOS setup mbedtls@3 environment"
130141
if: runner.os == 'macOS'
@@ -156,7 +167,6 @@ jobs:
156167
- name: "Build: run cmake"
157168
working-directory: build
158169
run: |
159-
export PATH="${{ matrix.path_prefix }}$PATH"
160170
cmake -G Ninja ${MBEDTLS_PREFIX:+-DCMAKE_PREFIX_PATH="$MBEDTLS_PREFIX"} ${{ matrix.cmake_opts }} ..
161171
162172
- name: "Touch files to benefit from cache"
@@ -169,31 +179,27 @@ jobs:
169179
- name: "Build: run ninja"
170180
working-directory: build
171181
run: |
172-
export PATH="${{ matrix.path_prefix }}$PATH"
173182
ninja
174183
175184
# Test
176185
- name: "Test: test-erlang with BEAM"
177186
timeout-minutes: 10
178187
working-directory: build
179188
run: |
180-
export PATH="${{ matrix.path_prefix }}$PATH"
181189
./tests/test-erlang -b ${{ matrix.test_erlang_opts }}
182190
183191
# Test
184192
- name: "Test: estdlib/ with BEAM"
185193
timeout-minutes: 10
186194
working-directory: build
187195
run: |
188-
export PATH="${{ matrix.path_prefix }}$PATH"
189196
erl -pa tests/libs/estdlib/ -pa tests/libs/estdlib/beams/ -pa libs/etest/src/beams -pa libs/eavmlib/src/beams -pa libs/avm_network/src/beams -s tests -s init stop -noshell
190197
191198
# Test
192199
- name: "Run tests/libs/etest/test_eunit with OTP eunit"
193200
timeout-minutes: 10
194201
working-directory: build
195202
run: |
196-
export PATH="${{ matrix.path_prefix }}$PATH"
197203
erl -pa tests/libs/etest/beams -s test_eunit test -s init stop -noshell
198204
199205
# Test
@@ -202,5 +208,4 @@ jobs:
202208
working-directory: build
203209
if: matrix.otp != '21' && matrix.otp != '22'
204210
run: |
205-
export PATH="${{ matrix.path_prefix }}$PATH"
206211
erl -pa tests/libs/jit/beams/ libs/jit/src/beams/ libs/etest/src/beams -noshell -s tests -s init stop -noshell

0 commit comments

Comments
 (0)