Run ARM-specific tests consistently (#434)

f8b54b5 · Paulo F. Oliveira · 2026-03-14 20:10

2 files +42 -21
Message
{commit_body(@commit)}

Files changed

modified .github/workflows/action.yml
+18 −3
@@ -63,7 +63,12 @@ jobs:
63 63
64 64 unit_tests_ubuntu:
65 65 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 }}
67 72 steps:
68 73 - uses: actions/checkout@v6.0.2
69 74 - uses: actions/setup-node@v6.3.0
@@ -84,7 +89,12 @@ jobs:
84 89
85 90 unit_tests_windows:
86 91 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 }}
88 98 steps:
89 99 - uses: actions/checkout@v6.0.2
90 100 - uses: actions/setup-node@v6.3.0
@@ -105,7 +115,12 @@ jobs:
105 115
106 116 unit_tests_macos:
107 117 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 }}
109 124 steps:
110 125 - uses: actions/checkout@v6.0.2
111 126 - uses: actions/setup-node@v6.3.0
modified test/setup-beam.test.js
+24 −18
@@ -177,11 +177,8 @@ describe('.getOTPVersion(_) - Erlang', () => {
177 177 'https://repo.hex.pm, https://cdn.jsdelivr.net/hex',
178 178 { multiline: true },
179 179 )
180 const previousRunnerArch = process.env.RUNNER_ARCH
181 180
182 181 if (process.platform === 'linux') {
183 process.env.RUNNER_ARCH = 'X64'
184
185 182 it('is Ok for known linux version', async () => {
186 183 before = simulateInput('version-type', 'strict')
187 184 spec = '27.0'
@@ -199,21 +196,21 @@ describe('.getOTPVersion(_) - Erlang', () => {
199 196 assert.deepStrictEqual(got, expected)
200 197 simulateInput('version-type', before)
201 198
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'
205 202 got = await setupBeam.getOTPVersion(spec, osVersion)
206 203 assert.deepStrictEqual(got, expected)
207 204
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'
211 208 got = await setupBeam.getOTPVersion(spec, osVersion)
212 209 assert.deepStrictEqual(got, expected)
213 210
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'
217 214 got = await setupBeam.getOTPVersion(spec, osVersion)
218 215 assert.deepStrictEqual(got, expected)
219 216
@@ -309,6 +306,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
309 306 if (process.platform === 'linux') {
310 307 it('is main-... only if strict/maint-... is used as input', async () => {
311 308 const arm64Options = setupBeam.githubARMRunnerArchs()
309 + const previousRunnerArch = process.env.RUNNER_ARCH
312 310 process.env.RUNNER_ARCH =
313 311 arm64Options[Math.floor(Math.random() * arm64Options.length)]
314 312
@@ -344,6 +342,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
344 342
345 343 it('is Ok for known linux ARM64 version', async () => {
346 344 const arm64Options = setupBeam.githubARMRunnerArchs()
345 + const previousRunnerArch = process.env.RUNNER_ARCH
347 346 process.env.RUNNER_ARCH =
348 347 arm64Options[Math.floor(Math.random() * arm64Options.length)]
349 348
@@ -404,10 +403,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
404 403 expected = 'master'
405 404 got = await setupBeam.getOTPVersion(spec, osVersion)
406 405 assert.deepStrictEqual(got, expected)
406 +
407 + process.env.RUNNER_ARCH = previousRunnerArch
407 408 })
408 409
409 410 it('is Ok for known linux AMD64 version', async () => {
410 411 const amd64Options = setupBeam.githubAMDRunnerArchs()
412 + const previousRunnerArch = process.env.RUNNER_ARCH
411 413 process.env.RUNNER_ARCH =
412 414 amd64Options[Math.floor(Math.random() * amd64Options.length)]
413 415
@@ -486,12 +488,15 @@ describe('.getOTPVersion(_) - Erlang', () => {
486 488 expected = 'master'
487 489 got = await setupBeam.getOTPVersion(spec, osVersion)
488 490 assert.deepStrictEqual(got, expected)
491 +
492 + process.env.RUNNER_ARCH = previousRunnerArch
489 493 })
490 494 }
491 495
492 496 if (process.platform === 'darwin') {
493 497 it('is main-... only if strict/maint-... is used as input', async () => {
494 498 const arm64Options = setupBeam.githubARMRunnerArchs()
499 + const previousRunnerArch = process.env.RUNNER_ARCH
495 500 process.env.RUNNER_ARCH =
496 501 arm64Options[Math.floor(Math.random() * arm64Options.length)]
497 502
@@ -521,6 +526,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
521 526
522 527 it('is Ok for known macos ARM64 version', async () => {
523 528 const arm64Options = setupBeam.githubARMRunnerArchs()
529 + const previousRunnerArch = process.env.RUNNER_ARCH
524 530 process.env.RUNNER_ARCH =
525 531 arm64Options[Math.floor(Math.random() * arm64Options.length)]
526 532
@@ -531,10 +537,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
531 537 got = await setupBeam.getOTPVersion(spec, osVersion)
532 538 assert.deepStrictEqual(got, expected)
533 539 simulateInput('version-type', before)
540 +
541 + process.env.RUNNER_ARCH = previousRunnerArch
534 542 })
535 543
536 544 it('is Ok for known macos AMD64 version', async () => {
537 545 const amd64Options = setupBeam.githubARMRunnerArchs()
546 + const previousRunnerArch = process.env.RUNNER_ARCH
538 547 process.env.RUNNER_ARCH =
539 548 amd64Options[Math.floor(Math.random() * amd64Options.length)]
540 549
@@ -545,11 +554,12 @@ describe('.getOTPVersion(_) - Erlang', () => {
545 554 got = await setupBeam.getOTPVersion(spec, osVersion)
546 555 assert.deepStrictEqual(got, expected)
547 556 simulateInput('version-type', before)
557 +
558 + process.env.RUNNER_ARCH = previousRunnerArch
548 559 })
549 560 }
550 561
551 562 simulateInput('hexpm-mirrors', hexMirrors, { multiline: true })
552 process.env.RUNNER_ARCH = previousRunnerArch
553 563 })
554 564
555 565 describe('OTP arch-specific install', () => {
@@ -572,6 +582,7 @@ describe('OTP arch-specific install', () => {
572 582 `Fetching OTP Version with invalid Github runner architecture is supposed to fail`,
573 583 )
574 584 }
585 +
575 586 process.env.RUNNER_ARCH = previousRunnerArch
576 587 })
577 588 })
@@ -582,11 +593,8 @@ describe('.getOTPVersion(_) - Elixir', () => {
582 593 let spec
583 594 let otpVersion
584 595 let before
585 const previousRunnerArch = process.env.RUNNER_ARCH
586 596
587 597 if (process.platform === 'linux') {
588 process.env.RUNNER_ARCH = 'X64'
589
590 598 it('returns the expected value', async () => {
591 599 spec = '1.18.x'
592 600 otpVersion = 'OTP-27'
@@ -644,8 +652,6 @@ describe('.getOTPVersion(_) - Elixir', () => {
644 652 simulateInput('version-type', before)
645 653 })
646 654 }
647
648 process.env.RUNNER_ARCH = previousRunnerArch
649 655 })
650 656
651 657 describe('.getOTPVersion(_) - Gleam', () => {

Parents: bf1ce74