Compare commits

...

2 Commits

6 changed files with 89 additions and 9 deletions
+16 -4
View File
@@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12'
node-version: 12
- run: npm install -g npm
- run: npm install
- run: npm run build
@@ -31,12 +31,24 @@ jobs:
- name: Check if build left artifacts
run: git diff --exit-code
unit_test:
name: Unit tests
unit_tests_ubuntu:
name: Unit tests (Ubuntu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with: {node-version: '12'}
with:
node-version: 12
- run: npm ci
- run: npm test
unit_tests_windows:
name: Unit tests (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm install --production
- run: npm test
+3
View File
@@ -103,6 +103,9 @@ jobs:
- elixir-version: '1.10.3'
otp-version: '22.3.4.1'
os: 'ubuntu-20.04'
- elixir-version: 'master'
otp-version: '23.1'
os: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v2
- name: Use erlef/setup-beam
+29
View File
@@ -53,6 +53,35 @@ and Erlang/OTP.
**Note** *: prior to 23, Windows builds are only available for minor versions, e.g. 21.0, 21.3, 22.0, etc.
### Self-hosted runners
Self-hosted runners need to set env. variable `ImageOS` to one of the following, since the action
uses that to download assets:
| ImageOS | Operating system
|- |-
| ubuntu16 | ubuntu-16.04
| ubuntu18 | ubuntu-18.04
| ubuntu20 | ubuntu-20.04
| win16 | windows-2016
| win19 | windows-2019
as per the following example:
```yaml
...
jobs:
test:
runs-on: self-hosted
env:
ImageOS: ubuntu20 # equivalent to runs-on ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
...
```
### Basic example (Erlang/OTP + Elixir, on Ubuntu)
```yaml
+9 -1
View File
@@ -136,7 +136,7 @@ async function testOTPVersions() {
spec = '23.2.x'
osVersion = 'windows-2016'
expected = '23.2.7.4'
expected = '23.2.7'
got = await setupBeam.getOTPVersion(spec, osVersion)
assert.deepStrictEqual(got, expected)
@@ -187,6 +187,14 @@ async function testElixirVersions() {
got = await setupBeam.getElixirVersion(spec, otpVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', 'loose')
simulateInput('version-type', 'strict')
spec = 'master'
otpVersion = '23.1'
expected = 'master-otp-23'
got = await setupBeam.getElixirVersion(spec, otpVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', 'loose')
}
async function testRebar3Versions() {
+16 -2
View File
@@ -4830,7 +4830,10 @@ async function getElixirVersion(exSpec0, otpVersion) {
)
}
return `v${elixirVersionWithOTP}`
const DigitStart = new RegExp('^\\d+')
return DigitStart.test(elixirVersion)
? `v${elixirVersionWithOTP}`
: elixirVersionWithOTP
}
async function getRebar3Version(r3Spec) {
@@ -5001,8 +5004,19 @@ function getRunnerOSVersion() {
win16: 'windows-2016',
win19: 'windows-2019',
}
const containerFromEnvImageOS = ImageOSToContainer[process.env.ImageOS]
return ImageOSToContainer[process.env.ImageOS]
if (!containerFromEnvImageOS) {
throw new Error(
"Tried to map a target OS from env. variable 'ImageOS', but failed. If you're using a " +
"self-hosted runner, you should set 'env': 'ImageOS': ... to one of the following: " +
"['" +
`${Object.keys(ImageOSToContainer).join("', '")}` +
"']",
)
}
return containerFromEnvImageOS
}
async function get(url0, pageIdxs) {
+16 -2
View File
@@ -174,7 +174,10 @@ async function getElixirVersion(exSpec0, otpVersion) {
)
}
return `v${elixirVersionWithOTP}`
const DigitStart = new RegExp('^\\d+')
return DigitStart.test(elixirVersion)
? `v${elixirVersionWithOTP}`
: elixirVersionWithOTP
}
async function getRebar3Version(r3Spec) {
@@ -345,8 +348,19 @@ function getRunnerOSVersion() {
win16: 'windows-2016',
win19: 'windows-2019',
}
const containerFromEnvImageOS = ImageOSToContainer[process.env.ImageOS]
return ImageOSToContainer[process.env.ImageOS]
if (!containerFromEnvImageOS) {
throw new Error(
"Tried to map a target OS from env. variable 'ImageOS', but failed. If you're using a " +
"self-hosted runner, you should set 'env': 'ImageOS': ... to one of the following: " +
"['" +
`${Object.keys(ImageOSToContainer).join("', '")}` +
"']",
)
}
return containerFromEnvImageOS
}
async function get(url0, pageIdxs) {