mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-27 10:10:49 +00:00
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...
This commit is contained in:
@@ -63,7 +63,12 @@ jobs:
|
|||||||
|
|
||||||
unit_tests_ubuntu:
|
unit_tests_ubuntu:
|
||||||
name: 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:
|
steps:
|
||||||
- uses: actions/checkout@v6.0.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: actions/setup-node@v6.3.0
|
- uses: actions/setup-node@v6.3.0
|
||||||
@@ -84,7 +89,12 @@ jobs:
|
|||||||
|
|
||||||
unit_tests_windows:
|
unit_tests_windows:
|
||||||
name: 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:
|
steps:
|
||||||
- uses: actions/checkout@v6.0.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: actions/setup-node@v6.3.0
|
- uses: actions/setup-node@v6.3.0
|
||||||
@@ -105,7 +115,12 @@ jobs:
|
|||||||
|
|
||||||
unit_tests_macos:
|
unit_tests_macos:
|
||||||
name: 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:
|
steps:
|
||||||
- uses: actions/checkout@v6.0.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: actions/setup-node@v6.3.0
|
- uses: actions/setup-node@v6.3.0
|
||||||
|
|||||||
+24
-18
@@ -177,11 +177,8 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
'https://repo.hex.pm, https://cdn.jsdelivr.net/hex',
|
'https://repo.hex.pm, https://cdn.jsdelivr.net/hex',
|
||||||
{ multiline: true },
|
{ multiline: true },
|
||||||
)
|
)
|
||||||
const previousRunnerArch = process.env.RUNNER_ARCH
|
|
||||||
|
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
process.env.RUNNER_ARCH = 'X64'
|
|
||||||
|
|
||||||
it('is Ok for known linux version', async () => {
|
it('is Ok for known linux version', async () => {
|
||||||
before = simulateInput('version-type', 'strict')
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '27.0'
|
spec = '27.0'
|
||||||
@@ -199,21 +196,21 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
spec = '19.3.x'
|
spec = '20.3.x'
|
||||||
osVersion = 'ubuntu-16.04'
|
osVersion = 'ubuntu-20.04'
|
||||||
expected = 'OTP-19.3.6.13'
|
expected = 'OTP-20.3.8.26'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
spec = '^19.3.6'
|
spec = '^20.3.8'
|
||||||
osVersion = 'ubuntu-16.04'
|
osVersion = 'ubuntu-20.04'
|
||||||
expected = 'OTP-19.3.6.13'
|
expected = 'OTP-20.3.8.26'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
spec = '^19.3'
|
spec = '^20.3'
|
||||||
osVersion = 'ubuntu-18.04'
|
osVersion = 'ubuntu-20.04'
|
||||||
expected = 'OTP-19.3.6.13'
|
expected = 'OTP-20.3.8.26'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
@@ -309,6 +306,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
it('is main-... only if strict/maint-... is used as input', async () => {
|
it('is main-... only if strict/maint-... is used as input', async () => {
|
||||||
const arm64Options = setupBeam.githubARMRunnerArchs()
|
const arm64Options = setupBeam.githubARMRunnerArchs()
|
||||||
|
const previousRunnerArch = process.env.RUNNER_ARCH
|
||||||
process.env.RUNNER_ARCH =
|
process.env.RUNNER_ARCH =
|
||||||
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
||||||
|
|
||||||
@@ -344,6 +342,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
|
|
||||||
it('is Ok for known linux ARM64 version', async () => {
|
it('is Ok for known linux ARM64 version', async () => {
|
||||||
const arm64Options = setupBeam.githubARMRunnerArchs()
|
const arm64Options = setupBeam.githubARMRunnerArchs()
|
||||||
|
const previousRunnerArch = process.env.RUNNER_ARCH
|
||||||
process.env.RUNNER_ARCH =
|
process.env.RUNNER_ARCH =
|
||||||
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
||||||
|
|
||||||
@@ -404,10 +403,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
expected = 'master'
|
expected = 'master'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
|
process.env.RUNNER_ARCH = previousRunnerArch
|
||||||
})
|
})
|
||||||
|
|
||||||
it('is Ok for known linux AMD64 version', async () => {
|
it('is Ok for known linux AMD64 version', async () => {
|
||||||
const amd64Options = setupBeam.githubAMDRunnerArchs()
|
const amd64Options = setupBeam.githubAMDRunnerArchs()
|
||||||
|
const previousRunnerArch = process.env.RUNNER_ARCH
|
||||||
process.env.RUNNER_ARCH =
|
process.env.RUNNER_ARCH =
|
||||||
amd64Options[Math.floor(Math.random() * amd64Options.length)]
|
amd64Options[Math.floor(Math.random() * amd64Options.length)]
|
||||||
|
|
||||||
@@ -486,12 +488,15 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
expected = 'master'
|
expected = 'master'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
|
process.env.RUNNER_ARCH = previousRunnerArch
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
it('is main-... only if strict/maint-... is used as input', async () => {
|
it('is main-... only if strict/maint-... is used as input', async () => {
|
||||||
const arm64Options = setupBeam.githubARMRunnerArchs()
|
const arm64Options = setupBeam.githubARMRunnerArchs()
|
||||||
|
const previousRunnerArch = process.env.RUNNER_ARCH
|
||||||
process.env.RUNNER_ARCH =
|
process.env.RUNNER_ARCH =
|
||||||
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
||||||
|
|
||||||
@@ -521,6 +526,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
|
|
||||||
it('is Ok for known macos ARM64 version', async () => {
|
it('is Ok for known macos ARM64 version', async () => {
|
||||||
const arm64Options = setupBeam.githubARMRunnerArchs()
|
const arm64Options = setupBeam.githubARMRunnerArchs()
|
||||||
|
const previousRunnerArch = process.env.RUNNER_ARCH
|
||||||
process.env.RUNNER_ARCH =
|
process.env.RUNNER_ARCH =
|
||||||
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
arm64Options[Math.floor(Math.random() * arm64Options.length)]
|
||||||
|
|
||||||
@@ -531,10 +537,13 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
process.env.RUNNER_ARCH = previousRunnerArch
|
||||||
})
|
})
|
||||||
|
|
||||||
it('is Ok for known macos AMD64 version', async () => {
|
it('is Ok for known macos AMD64 version', async () => {
|
||||||
const amd64Options = setupBeam.githubARMRunnerArchs()
|
const amd64Options = setupBeam.githubARMRunnerArchs()
|
||||||
|
const previousRunnerArch = process.env.RUNNER_ARCH
|
||||||
process.env.RUNNER_ARCH =
|
process.env.RUNNER_ARCH =
|
||||||
amd64Options[Math.floor(Math.random() * amd64Options.length)]
|
amd64Options[Math.floor(Math.random() * amd64Options.length)]
|
||||||
|
|
||||||
@@ -545,11 +554,12 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
|||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
process.env.RUNNER_ARCH = previousRunnerArch
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
simulateInput('hexpm-mirrors', hexMirrors, { multiline: true })
|
simulateInput('hexpm-mirrors', hexMirrors, { multiline: true })
|
||||||
process.env.RUNNER_ARCH = previousRunnerArch
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('OTP arch-specific install', () => {
|
describe('OTP arch-specific install', () => {
|
||||||
@@ -572,6 +582,7 @@ describe('OTP arch-specific install', () => {
|
|||||||
`Fetching OTP Version with invalid Github runner architecture is supposed to fail`,
|
`Fetching OTP Version with invalid Github runner architecture is supposed to fail`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env.RUNNER_ARCH = previousRunnerArch
|
process.env.RUNNER_ARCH = previousRunnerArch
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -582,11 +593,8 @@ describe('.getOTPVersion(_) - Elixir', () => {
|
|||||||
let spec
|
let spec
|
||||||
let otpVersion
|
let otpVersion
|
||||||
let before
|
let before
|
||||||
const previousRunnerArch = process.env.RUNNER_ARCH
|
|
||||||
|
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
process.env.RUNNER_ARCH = 'X64'
|
|
||||||
|
|
||||||
it('returns the expected value', async () => {
|
it('returns the expected value', async () => {
|
||||||
spec = '1.18.x'
|
spec = '1.18.x'
|
||||||
otpVersion = 'OTP-27'
|
otpVersion = 'OTP-27'
|
||||||
@@ -644,8 +652,6 @@ describe('.getOTPVersion(_) - Elixir', () => {
|
|||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env.RUNNER_ARCH = previousRunnerArch
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('.getOTPVersion(_) - Gleam', () => {
|
describe('.getOTPVersion(_) - Gleam', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user