Skip to content

Commit f8b54b5

Browse files
Run ARM-specific tests consistently (#434)
* Run ARM-specific test consistently * Fix for builds.hex.pm https://builds.hex.pm/builds/otp/arm64/ubuntu-<x>.04/builds.txt file is only available when <x> >= 20. * Fix for builds.hex.pm https://builds.hex.pm/builds/otp/arm64/ubuntu-20.04/builds.txt does not contain Erlang 19 any more...
1 parent bf1ce74 commit f8b54b5

File tree

2 files changed

+42
-21
lines changed

2 files changed

+42
-21
lines changed

.github/workflows/action.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ jobs:
6363

6464
unit_tests_ubuntu:
6565
name: Unit tests (Ubuntu)
66-
runs-on: ubuntu-latest
66+
strategy:
67+
matrix:
68+
os:
69+
- ubuntu-24.04-arm # ARM64
70+
- ubuntu-latest # x86_64
71+
runs-on: ${{ matrix.os }}
6772
steps:
6873
- uses: actions/checkout@v6.0.2
6974
- uses: actions/setup-node@v6.3.0
@@ -84,7 +89,12 @@ jobs:
8489

8590
unit_tests_windows:
8691
name: Unit tests (Windows)
87-
runs-on: windows-latest
92+
strategy:
93+
matrix:
94+
os:
95+
- windows-11-arm # ARM64
96+
- windows-latest # x86_64
97+
runs-on: ${{ matrix.os }}
8898
steps:
8999
- uses: actions/checkout@v6.0.2
90100
- uses: actions/setup-node@v6.3.0
@@ -105,7 +115,12 @@ jobs:
105115

106116
unit_tests_macos:
107117
name: Unit tests (macOS)
108-
runs-on: macos-latest
118+
strategy:
119+
matrix:
120+
os:
121+
- macos-latest # ARM64
122+
- macos-15-intel # x86_64
123+
runs-on: ${{ matrix.os }}
109124
steps:
110125
- uses: actions/checkout@v6.0.2
111126
- uses: actions/setup-node@v6.3.0

test/setup-beam.test.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,8 @@ describe('.getOTPVersion(_) - Erlang', () => {
177177
'https://repo.hex.pm, https://cdn.jsdelivr.net/hex',
178178
{ multiline: true },
179179
)
180-
const previousRunnerArch = process.env.RUNNER_ARCH
181180

182181
if (process.platform === 'linux') {
183-
process.env.RUNNER_ARCH = 'X64'
184-
185182
it('is Ok for known linux version', async () => {
186183
before = simulateInput('version-type', 'strict')
187184
spec = '27.0'
@@ -199,21 +196,21 @@ describe('.getOTPVersion(_) - Erlang', () => {
199196
assert.deepStrictEqual(got, expected)
200197
simulateInput('version-type', before)
201198

202-
spec = '19.3.x'
203-
osVersion = 'ubuntu-16.04'
204-
expected = 'OTP-19.3.6.13'
199+
spec = '20.3.x'
200+
osVersion = 'ubuntu-20.04'
201+
expected = 'OTP-20.3.8.26'
205202
got = await setupBeam.getOTPVersion(spec, osVersion)
206203
assert.deepStrictEqual(got, expected)
207204

208-
spec = '^19.3.6'
209-
osVersion = 'ubuntu-16.04'
210-
expected = 'OTP-19.3.6.13'
205+
spec = '^20.3.8'
206+
osVersion = 'ubuntu-20.04'
207+
expected = 'OTP-20.3.8.26'
211208
got = await setupBeam.getOTPVersion(spec, osVersion)
212209
assert.deepStrictEqual(got, expected)
213210

214-
spec = '^19.3'
215-
osVersion = 'ubuntu-18.04'
216-
expected = 'OTP-19.3.6.13'
211+
spec = '^20.3'
212+
osVersion = 'ubuntu-20.04'
213+
expected = 'OTP-20.3.8.26'
217214
got = await setupBeam.getOTPVersion(spec, osVersion)
218215
assert.deepStrictEqual(got, expected)
219216

@@ -309,6 +306,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
309306
if (process.platform === 'linux') {
310307
it('is main-... only if strict/maint-... is used as input', async () => {
311308
const arm64Options = setupBeam.githubARMRunnerArchs()
309+
const previousRunnerArch = process.env.RUNNER_ARCH
312310
process.env.RUNNER_ARCH =
313311
arm64Options[Math.floor(Math.random() * arm64Options.length)]
314312

@@ -344,6 +342,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
344342

345343
it('is Ok for known linux ARM64 version', async () => {
346344
const arm64Options = setupBeam.githubARMRunnerArchs()
345+
const previousRunnerArch = process.env.RUNNER_ARCH
347346
process.env.RUNNER_ARCH =
348347
arm64Options[Math.floor(Math.random() * arm64Options.length)]
349348

@@ -404,10 +403,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
404403
expected = 'master'
405404
got = await setupBeam.getOTPVersion(spec, osVersion)
406405
assert.deepStrictEqual(got, expected)
406+
407+
process.env.RUNNER_ARCH = previousRunnerArch
407408
})
408409

409410
it('is Ok for known linux AMD64 version', async () => {
410411
const amd64Options = setupBeam.githubAMDRunnerArchs()
412+
const previousRunnerArch = process.env.RUNNER_ARCH
411413
process.env.RUNNER_ARCH =
412414
amd64Options[Math.floor(Math.random() * amd64Options.length)]
413415

@@ -486,12 +488,15 @@ describe('.getOTPVersion(_) - Erlang', () => {
486488
expected = 'master'
487489
got = await setupBeam.getOTPVersion(spec, osVersion)
488490
assert.deepStrictEqual(got, expected)
491+
492+
process.env.RUNNER_ARCH = previousRunnerArch
489493
})
490494
}
491495

492496
if (process.platform === 'darwin') {
493497
it('is main-... only if strict/maint-... is used as input', async () => {
494498
const arm64Options = setupBeam.githubARMRunnerArchs()
499+
const previousRunnerArch = process.env.RUNNER_ARCH
495500
process.env.RUNNER_ARCH =
496501
arm64Options[Math.floor(Math.random() * arm64Options.length)]
497502

@@ -521,6 +526,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
521526

522527
it('is Ok for known macos ARM64 version', async () => {
523528
const arm64Options = setupBeam.githubARMRunnerArchs()
529+
const previousRunnerArch = process.env.RUNNER_ARCH
524530
process.env.RUNNER_ARCH =
525531
arm64Options[Math.floor(Math.random() * arm64Options.length)]
526532

@@ -531,10 +537,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
531537
got = await setupBeam.getOTPVersion(spec, osVersion)
532538
assert.deepStrictEqual(got, expected)
533539
simulateInput('version-type', before)
540+
541+
process.env.RUNNER_ARCH = previousRunnerArch
534542
})
535543

536544
it('is Ok for known macos AMD64 version', async () => {
537545
const amd64Options = setupBeam.githubARMRunnerArchs()
546+
const previousRunnerArch = process.env.RUNNER_ARCH
538547
process.env.RUNNER_ARCH =
539548
amd64Options[Math.floor(Math.random() * amd64Options.length)]
540549

@@ -545,11 +554,12 @@ describe('.getOTPVersion(_) - Erlang', () => {
545554
got = await setupBeam.getOTPVersion(spec, osVersion)
546555
assert.deepStrictEqual(got, expected)
547556
simulateInput('version-type', before)
557+
558+
process.env.RUNNER_ARCH = previousRunnerArch
548559
})
549560
}
550561

551562
simulateInput('hexpm-mirrors', hexMirrors, { multiline: true })
552-
process.env.RUNNER_ARCH = previousRunnerArch
553563
})
554564

555565
describe('OTP arch-specific install', () => {
@@ -572,6 +582,7 @@ describe('OTP arch-specific install', () => {
572582
`Fetching OTP Version with invalid Github runner architecture is supposed to fail`,
573583
)
574584
}
585+
575586
process.env.RUNNER_ARCH = previousRunnerArch
576587
})
577588
})
@@ -582,11 +593,8 @@ describe('.getOTPVersion(_) - Elixir', () => {
582593
let spec
583594
let otpVersion
584595
let before
585-
const previousRunnerArch = process.env.RUNNER_ARCH
586596

587597
if (process.platform === 'linux') {
588-
process.env.RUNNER_ARCH = 'X64'
589-
590598
it('returns the expected value', async () => {
591599
spec = '1.18.x'
592600
otpVersion = 'OTP-27'
@@ -644,8 +652,6 @@ describe('.getOTPVersion(_) - Elixir', () => {
644652
simulateInput('version-type', before)
645653
})
646654
}
647-
648-
process.env.RUNNER_ARCH = previousRunnerArch
649655
})
650656

651657
describe('.getOTPVersion(_) - Gleam', () => {

0 commit comments

Comments
 (0)