Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ jobs:

unit_tests_ubuntu:
name: Unit tests (Ubuntu)
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-24.04-arm # ARM64
- ubuntu-latest # x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-node@v6.3.0
Expand All @@ -84,7 +89,12 @@ jobs:

unit_tests_windows:
name: Unit tests (Windows)
runs-on: windows-latest
strategy:
matrix:
os:
- windows-11-arm # ARM64
- windows-latest # x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-node@v6.3.0
Expand All @@ -105,7 +115,12 @@ jobs:

unit_tests_macos:
name: Unit tests (macOS)
runs-on: macos-latest
strategy:
matrix:
os:
- macos-latest # ARM64
- macos-15-intel # x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-node@v6.3.0
Expand Down
24 changes: 15 additions & 9 deletions test/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,8 @@ describe('.getOTPVersion(_) - Erlang', () => {
'https://repo.hex.pm, https://cdn.jsdelivr.net/hex',
{ multiline: true },
)
const previousRunnerArch = process.env.RUNNER_ARCH

if (process.platform === 'linux') {
process.env.RUNNER_ARCH = 'X64'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanna get rid of this type of manipulation.


it('is Ok for known linux version', async () => {
before = simulateInput('version-type', 'strict')
spec = '27.0'
Expand Down Expand Up @@ -309,6 +306,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
if (process.platform === 'linux') {
it('is main-... only if strict/maint-... is used as input', async () => {
const arm64Options = setupBeam.githubARMRunnerArchs()
const previousRunnerArch = process.env.RUNNER_ARCH
process.env.RUNNER_ARCH =
arm64Options[Math.floor(Math.random() * arm64Options.length)]

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

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

Expand Down Expand Up @@ -404,10 +403,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
expected = 'master'
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

process.env.RUNNER_ARCH = previousRunnerArch
})

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

Expand Down Expand Up @@ -486,12 +488,15 @@ describe('.getOTPVersion(_) - Erlang', () => {
expected = 'master'
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)

process.env.RUNNER_ARCH = previousRunnerArch
})
}

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

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

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

Expand All @@ -531,10 +537,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', before)

process.env.RUNNER_ARCH = previousRunnerArch
})

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

Expand All @@ -545,11 +554,12 @@ describe('.getOTPVersion(_) - Erlang', () => {
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', before)

process.env.RUNNER_ARCH = previousRunnerArch
})
}

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

describe('OTP arch-specific install', () => {
Expand All @@ -572,6 +582,7 @@ describe('OTP arch-specific install', () => {
`Fetching OTP Version with invalid Github runner architecture is supposed to fail`,
)
}

process.env.RUNNER_ARCH = previousRunnerArch
})
})
Expand All @@ -582,11 +593,8 @@ describe('.getOTPVersion(_) - Elixir', () => {
let spec
let otpVersion
let before
const previousRunnerArch = process.env.RUNNER_ARCH

if (process.platform === 'linux') {
process.env.RUNNER_ARCH = 'X64'

it('returns the expected value', async () => {
spec = '1.18.x'
otpVersion = 'OTP-27'
Expand Down Expand Up @@ -644,8 +652,6 @@ describe('.getOTPVersion(_) - Elixir', () => {
simulateInput('version-type', before)
})
}

process.env.RUNNER_ARCH = previousRunnerArch
})

describe('.getOTPVersion(_) - Gleam', () => {
Expand Down
Loading