mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
Compare commits
117 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 54075bcc5e | |||
| ea45c8043f | |||
| b4b8d851b6 | |||
| 20df794ab3 | |||
| 9d5c5ca125 | |||
| ad4294342c | |||
| 135c095dff | |||
| a04cfbb50e | |||
| cd1472f941 | |||
| c80fdc938c | |||
| aecd7abd75 | |||
| 6e9312bce0 | |||
| 3985c7c047 | |||
| 35f52551d2 | |||
| 0510550330 | |||
| 9eabb2c115 | |||
| e5f1a7b722 | |||
| 7a27046239 | |||
| fc68ffb904 | |||
| 190c3a5e7b | |||
| 92dab893ed | |||
| 5dfda65506 | |||
| ef385d6edc | |||
| bf3c3af135 | |||
| e7645e4102 | |||
| a36098e741 | |||
| 87781dc68a | |||
| d5f3979a5f | |||
| 930b3281ba | |||
| 30056ca086 | |||
| 1f3f354e6a | |||
| 3e49772722 | |||
| 2ac22cd739 | |||
| c4782c7b58 | |||
| 0afadf6bdd | |||
| e539b1ee26 | |||
| c5f0656346 | |||
| ee09b1e59b | |||
| f8b54b559e | |||
| bf1ce74034 | |||
| 559a930751 | |||
| 1380ebe712 | |||
| 0a549596b0 | |||
| 3a3c94fd9e | |||
| cfafb69ddd | |||
| b3cbb6afbf | |||
| 2abe6cda7a | |||
| d55fdba43f | |||
| eb86ad6523 | |||
| af6da5da48 | |||
| f018c1e6d8 | |||
| d843ebb78b | |||
| c8e09547a7 | |||
| 9d5b75ddfd | |||
| 98c13a9ed3 | |||
| 0f13bcf18a | |||
| c3137f5cd5 | |||
| 4cbacdb2a9 | |||
| 687000ab96 | |||
| 9ba6605098 | |||
| 722d91de6e | |||
| f79887d1ba | |||
| 30a0896082 | |||
| 41c0004487 | |||
| 9fc15d548d | |||
| 19003af5f4 | |||
| 53a564f4bb | |||
| 6ee130ce6b | |||
| 11a1f27b1e | |||
| 83bf0e8bac | |||
| 47d6c3c4af | |||
| 0d2a6cb44d | |||
| 0f6ba5d884 | |||
| 58166ce788 | |||
| 4a07ed84ac | |||
| de78da9a9d | |||
| 9928a16c11 | |||
| 3964390c66 | |||
| 1dacaf8a01 | |||
| fa8ba5f70e | |||
| daf8797d04 | |||
| de72677f00 | |||
| 334f76ce04 | |||
| 86b5ecbf21 | |||
| b8fc6e435e | |||
| e7fda7af4e | |||
| a50e3e2f89 | |||
| 7bc1e4ca67 | |||
| baf2bc3313 | |||
| 3580539cee | |||
| fe5485f1f6 | |||
| 98de8ffa90 | |||
| 6c5fe278e7 | |||
| 36214a49c0 | |||
| 972bec8037 | |||
| 10e998534e | |||
| 542d9a8e62 | |||
| b764149ef2 | |||
| cba803d7b7 | |||
| eda66a8458 | |||
| cf0aea912f | |||
| 13b647ed24 | |||
| d6f6c371de | |||
| 905cf79e7d | |||
| 4f85a51ca2 | |||
| fc1fdd6f00 | |||
| da184bc66d | |||
| 566deebc64 | |||
| b94e7d372a | |||
| 033f103421 | |||
| 9afaa6e45f | |||
| 4168d0bf3c | |||
| 8c38699ca8 | |||
| df4a3eca5d | |||
| db4f13ce18 | |||
| 1df7f7a827 | |||
| f350bf9e05 |
@@ -24,7 +24,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Version it!
|
||||
run: |
|
||||
# We expect a string such as const setupBeamVersion = 'undefined' in the code
|
||||
@@ -45,10 +45,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref != 'refs/heads/main'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/setup-node@v4.4.0
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- uses: actions/setup-node@v6.3.0
|
||||
with:
|
||||
node-version: '20'
|
||||
node-version: '24'
|
||||
- run: npm run build-dist
|
||||
- name: Check if build left artifacts
|
||||
run: git diff --exit-code --ignore-space-at-eol
|
||||
@@ -58,19 +58,26 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref != 'refs/heads/main'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: raven-actions/actionlint@v2.0.1
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- uses: raven-actions/actionlint@v2.1.2
|
||||
|
||||
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@v4.2.2
|
||||
- uses: actions/setup-node@v4.4.0
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- uses: actions/setup-node@v6.3.0
|
||||
with:
|
||||
node-version: '20'
|
||||
node-version: '24'
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
env:
|
||||
NODE_ENV: test
|
||||
- name: .tool-versions test
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -82,14 +89,20 @@ jobs:
|
||||
|
||||
unit_tests_windows:
|
||||
name: Unit tests (Windows)
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- windows-latest # x86_64
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/setup-node@v4.4.0
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- uses: actions/setup-node@v6.3.0
|
||||
with:
|
||||
node-version: '20'
|
||||
node-version: '24'
|
||||
- run: npm install --production
|
||||
- run: npm test
|
||||
env:
|
||||
NODE_ENV: test
|
||||
- name: .tool-versions test
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -101,11 +114,18 @@ 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@v4.2.2
|
||||
- uses: actions/setup-node@v4.4.0
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- uses: actions/setup-node@v6.3.0
|
||||
with:
|
||||
node-version: '20'
|
||||
node-version: '24'
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
install-rebar: [true, false]
|
||||
install-hex: [true, false]
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
|
||||
+21
-10
@@ -16,6 +16,7 @@ on:
|
||||
jobs:
|
||||
integration_test:
|
||||
name: >
|
||||
OS ${{matrix.combo.os}},
|
||||
OTP ${{matrix.combo.otp-version}},
|
||||
Elixir ${{matrix.combo.elixir-version}},
|
||||
rebar3 ${{matrix.combo.rebar3-version}}
|
||||
@@ -24,6 +25,22 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
combo:
|
||||
# macOS 14 - per README
|
||||
- otp-version: '25'
|
||||
os: 'macos-14'
|
||||
- otp-version: '29'
|
||||
os: 'macos-14'
|
||||
# macOS 15 - per README
|
||||
- otp-version: '25'
|
||||
os: 'macos-15'
|
||||
- otp-version: '29'
|
||||
os: 'macos-15'
|
||||
# macOS 26 - per README
|
||||
- otp-version: '25'
|
||||
os: 'macos-26'
|
||||
- otp-version: '29'
|
||||
os: 'macos-26'
|
||||
# macOS latest
|
||||
- otp-version: '27'
|
||||
elixir-version: 'v1.17.0'
|
||||
rebar3-version: '3.23'
|
||||
@@ -43,19 +60,13 @@ jobs:
|
||||
elixir-version: '1.14.3'
|
||||
os: 'macos-latest'
|
||||
version-type: 'strict'
|
||||
- otp-version: '25'
|
||||
os: 'macos-15'
|
||||
- otp-version: '26'
|
||||
elixir-version: '1.16'
|
||||
rebar3-version: '3.25'
|
||||
os: 'macos-14'
|
||||
- otp-version: '25.0'
|
||||
elixir-version: 'v1.13.4-otp-25'
|
||||
elixir-version: 'v1.16.3-otp-25'
|
||||
rebar3-version: '3.18.0'
|
||||
os: 'macos-latest'
|
||||
version-type: 'strict'
|
||||
- otp-version: '25.0'
|
||||
elixir-version: 'v1.13.4'
|
||||
elixir-version: 'v1.16.3'
|
||||
rebar3-version: '3.18.0'
|
||||
os: 'macos-latest'
|
||||
version-type: 'strict'
|
||||
@@ -65,7 +76,7 @@ jobs:
|
||||
rebar3-version: 'latest'
|
||||
os: 'macos-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -118,7 +129,7 @@ jobs:
|
||||
rebar3-version: 3.24
|
||||
os: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
|
||||
@@ -16,6 +16,7 @@ on:
|
||||
jobs:
|
||||
integration_test:
|
||||
name: >
|
||||
OS ${{matrix.combo.os}},
|
||||
OTP ${{matrix.combo.otp-version}},
|
||||
Elixir ${{matrix.combo.elixir-version}},
|
||||
Gleam ${{matrix.combo.gleam-version}},
|
||||
@@ -25,15 +26,22 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
combo:
|
||||
- otp-version: '<26'
|
||||
elixir-version: '<1.17'
|
||||
# Ubuntu 22.04 - per README
|
||||
- otp-version: '24.2'
|
||||
os: 'ubuntu-22.04'
|
||||
- otp-version: 'master'
|
||||
elixir-version: '> 0'
|
||||
- otp-version: '29'
|
||||
os: 'ubuntu-22.04'
|
||||
# Ubuntu 24.04 - per README
|
||||
- otp-version: '24.3'
|
||||
os: 'ubuntu-24.04'
|
||||
- otp-version: 'master'
|
||||
elixir-version: 'main'
|
||||
- otp-version: '29'
|
||||
os: 'ubuntu-24.04'
|
||||
# Ubuntu 26.04 - per README
|
||||
- otp-version: '26'
|
||||
os: 'ubuntu-26.04'
|
||||
- otp-version: '29'
|
||||
os: 'ubuntu-26.04'
|
||||
# Ubuntu latest
|
||||
- otp-version: '27'
|
||||
elixir-version: 'v1.17.0'
|
||||
rebar3-version: '3.23'
|
||||
@@ -53,19 +61,13 @@ jobs:
|
||||
elixir-version: '1.14.3'
|
||||
os: 'ubuntu-latest'
|
||||
version-type: 'strict'
|
||||
- otp-version: '25'
|
||||
os: 'ubuntu-24.04'
|
||||
- otp-version: '26'
|
||||
elixir-version: '1.16'
|
||||
rebar3-version: '3.25'
|
||||
os: 'ubuntu-22.04'
|
||||
- otp-version: '25.0'
|
||||
elixir-version: 'v1.13.4-otp-25'
|
||||
elixir-version: 'v1.16.2-otp-25'
|
||||
rebar3-version: '3.18.0'
|
||||
os: 'ubuntu-latest'
|
||||
version-type: 'strict'
|
||||
- otp-version: '25.0'
|
||||
elixir-version: 'v1.13.4'
|
||||
elixir-version: 'v1.16.3'
|
||||
rebar3-version: '3.18.0'
|
||||
os: 'ubuntu-latest'
|
||||
version-type: 'strict'
|
||||
@@ -80,13 +82,13 @@ jobs:
|
||||
otp-version: false
|
||||
os: 'ubuntu-latest'
|
||||
disable_problem_matchers: true
|
||||
- elixir-version: 'v1.13'
|
||||
- elixir-version: 'v1.16'
|
||||
otp-version: '24'
|
||||
escript_packages: 'hex protobuf'
|
||||
escript_script: 'protoc-gen-elixir --version'
|
||||
os: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -154,7 +156,7 @@ jobs:
|
||||
rebar3-version: 3.24
|
||||
os: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
|
||||
@@ -3,6 +3,7 @@ name: Update 3rd party licenses (automation)
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
schedule:
|
||||
@@ -14,7 +15,7 @@ jobs:
|
||||
name: Update 3rd party licenses
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- run:
|
||||
./.github/workflows/update_3rd_party_licenses.sh
|
||||
env:
|
||||
|
||||
@@ -16,6 +16,7 @@ on:
|
||||
jobs:
|
||||
integration_test:
|
||||
name: >
|
||||
OS ${{matrix.combo.os}},
|
||||
OTP ${{matrix.combo.otp-version}},
|
||||
Elixir ${{matrix.combo.elixir-version}},
|
||||
Gleam ${{matrix.combo.gleam-version}},
|
||||
@@ -25,12 +26,20 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
combo:
|
||||
# Windows 2022 - per README
|
||||
- otp-version: '26' # 21 is "so old", at this moment, we can't find it in latest 100
|
||||
os: 'windows-2022'
|
||||
- otp-version: '29'
|
||||
os: 'windows-2022'
|
||||
# Windows 2025 - per README
|
||||
- otp-version: '26' # 21 is "so old", at this moment, we can't find it in latest 100
|
||||
os: 'windows-2025'
|
||||
- otp-version: '29'
|
||||
os: 'windows-2025'
|
||||
# Windows latest
|
||||
- otp-version: '<26'
|
||||
elixir-version: '<1.17'
|
||||
os: 'ubuntu-22.04'
|
||||
- otp-version: 'master'
|
||||
elixir-version: '> 0'
|
||||
os: 'ubuntu-24.04'
|
||||
os: 'windows-latest'
|
||||
- otp-version: '27'
|
||||
elixir-version: 'v1.17.0'
|
||||
rebar3-version: '3.23'
|
||||
@@ -47,30 +56,24 @@ jobs:
|
||||
elixir-version: '1.14.5'
|
||||
os: 'windows-latest'
|
||||
version-type: 'strict'
|
||||
- otp-version: '24.0.2'
|
||||
rebar3-version: '3.16'
|
||||
os: 'windows-2022'
|
||||
- otp-version: '23.0'
|
||||
rebar3-version: '3.15'
|
||||
os: 'windows-2022'
|
||||
- elixir-version: 'v1.10'
|
||||
otp-version: '23'
|
||||
rebar3-version: '3.14'
|
||||
os: 'windows-latest'
|
||||
- elixir-version: 'v1.13'
|
||||
- elixir-version: 'v1.16'
|
||||
otp-version: '24'
|
||||
rebar3-version: '3.15'
|
||||
os: 'windows-latest'
|
||||
- gleam-version: '1.9.0'
|
||||
otp-version: '27'
|
||||
os: 'windows-latest'
|
||||
- elixir-version: 'v1.13'
|
||||
- elixir-version: 'v1.16'
|
||||
otp-version: '24'
|
||||
escript_packages: 'hex protobuf'
|
||||
escript_script: 'protoc-gen-elixir --version'
|
||||
os: 'windows-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -137,7 +140,7 @@ jobs:
|
||||
rebar3-version: 3.24
|
||||
os: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
|
||||
+4
-2
@@ -1,2 +1,4 @@
|
||||
node_modules/**
|
||||
test/.tool-versions
|
||||
/node_modules
|
||||
/test/.tool-versions
|
||||
/test/mise.toml
|
||||
/dist/package.json
|
||||
|
||||
+1169
-6911
File diff suppressed because it is too large
Load Diff
@@ -80,17 +80,23 @@ and Erlang/OTP.
|
||||
|
||||
| Operating system | Erlang/OTP | OTP Architecture | Status
|
||||
|- |- | - |-
|
||||
| `ubuntu-22.04` | 24.2 - 28 | x86_64, arm64 | ✅
|
||||
| `ubuntu-24.04` | 24.3 - 28 | x86_64, arm64 | ✅
|
||||
| `windows-2019` | 21\* - 25 | x86_64, x86 | ✅
|
||||
| `windows-2022` | 21\* - 28 | x86_64, x86 | ✅
|
||||
| `macOS-13` | 25.0 - 28 | x86_64, arm64 | ✅
|
||||
| `macOS-14` | 25.0 - 28 | x86_64, arm64 | ✅
|
||||
| `macOS-15` | 25.0 - 28 | x86_64, arm64 | ✅
|
||||
| `ubuntu-22.04` | 24.2 - 29 | x86_64, arm64 | ✅
|
||||
| `ubuntu-24.04` | 24.3 - 29 | x86_64, arm64 | ✅
|
||||
| `ubuntu-26.04` | 26 - 29 | x86_64, arm64 | ✅
|
||||
| `windows-2022` | 21\* - 29 | x86_64, x86 | ✅
|
||||
| `windows-2025` | 21\* - 29 | x86_64, x86 | ✅
|
||||
| `macOS-14` | 25 - 29 | x86_64, arm64 | ✅
|
||||
| `macOS-15` | 25 - 29 | x86_64, arm64 | ✅
|
||||
| `macOS-26` | 25 - 29 | x86_64, arm64 | ✅
|
||||
|
||||
**Note** \*: prior to 23, Windows builds are only available for minor versions, e.g. 21.0, 21.3,
|
||||
22.0, etc.
|
||||
|
||||
### Compatibility between Erlang/OTP and rebar3
|
||||
|
||||
Check [version compatibility](https://github.com/erlang/rebar3?tab=readme-ov-file#compatibility-between-rebar3-and-erlangotp)
|
||||
in `erlang/rebar3`.
|
||||
|
||||
### Self-hosted runners
|
||||
|
||||
Self-hosted runners need to set env. variable `ImageOS` to one of the following, since the action
|
||||
@@ -99,12 +105,17 @@ uses that to download assets:
|
||||
| ImageOS | Operating system
|
||||
|- |-
|
||||
| `ubuntu22` | `ubuntu-22.04`
|
||||
| `ubuntu22-arm64` | `ubuntu-22.04`
|
||||
| `ubuntu24` | `ubuntu-24.04`
|
||||
| `win19` | `windows-2019`
|
||||
| `ubuntu24-arm64` | `ubuntu-24.04`
|
||||
| `ubuntu26` | `ubuntu-26.04`
|
||||
| `ubuntu26-arm64` | `ubuntu-26.04`
|
||||
| `win22` | `windows-2022`
|
||||
| `macos13` | `macOS-13`
|
||||
| `win25` | `windows-2025`
|
||||
| `win25-vs2026` | `windows-2025`
|
||||
| `macos14` | `macOS-14`
|
||||
| `macos15` | `macOS-15`
|
||||
| `macos26` | `macOS-26`
|
||||
|
||||
as per the following example:
|
||||
|
||||
@@ -139,23 +150,22 @@ e.g. `${{steps.setup-beam.outputs.erlang-version}}`
|
||||
|
||||
### Version file
|
||||
|
||||
A version file is specified via input `version-file` (e.g.`.tool-versions`). This
|
||||
allows not having to use YML input for versions, though the action does check (and
|
||||
A version file is specified via input `version-file` (e.g. `.tool-versions` or `mise.toml`).
|
||||
The file type is inferred from the filename: files ending in `.toml` are parsed as
|
||||
[mise](https://mise.jdx.dev/configuration.html#tools-dev-tools) configuration, and all others
|
||||
are parsed as [`.tool-versions`](https://asdf-vm.com/manage/configuration.html) (asdf format).
|
||||
This allows not having to use YML input for versions, though the action does check (and
|
||||
will exit with error) if both inputs are set.
|
||||
|
||||
**Note**: if you're using a version file, option `version-type` is checked to be `strict`,
|
||||
and will make the action exit with error otherwise.
|
||||
|
||||
The following version file formats are supported:
|
||||
|
||||
- `.tool-versions`, as specified by [asdf: Configuration](https://asdf-vm.com/manage/configuration.html)
|
||||
|
||||
Supported version elements are the same as the ones defined for the YML portion of the action,
|
||||
with the following correspondence.
|
||||
|
||||
#### `.tool-versions` format
|
||||
#### `.tool-versions` / `mise.toml` format
|
||||
|
||||
| YML | `.tool-versions`
|
||||
| YML | Version file key
|
||||
|- |-
|
||||
| `otp-version` | `erlang`
|
||||
| `elixir-version` | `elixir`
|
||||
@@ -289,6 +299,34 @@ jobs:
|
||||
- run: rebar3 ct
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
|
||||
To execute matrix testing with specific dependency versions, configure the environment matrix to
|
||||
use pinned, compatible releases:
|
||||
|
||||
```yaml
|
||||
test:
|
||||
runs-on: ${{matrix.compat.os}}
|
||||
name: Erlang/OTP ${{matrix.compat.otp}} / rebar3 ${{matrix.compat.rebar3}}
|
||||
strategy:
|
||||
matrix:
|
||||
compat:
|
||||
- otp: "26.2.5.5"
|
||||
rebar3: "3.22.1"
|
||||
os: ubuntu-24.04
|
||||
- otp: "27.1.2"
|
||||
rebar3: "3.22.1"
|
||||
os: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: erlef/setup-beam@v1
|
||||
with:
|
||||
otp-version: ${{matrix.compat.otp}}
|
||||
rebar3-version: ${{matrix.compat.rebar3}}
|
||||
version-type: strict
|
||||
- run: rebar3 eunit
|
||||
```
|
||||
|
||||
### Erlang/OTP + `rebar3`, on Windows
|
||||
|
||||
```yaml
|
||||
@@ -297,7 +335,7 @@ on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: windows-2022
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: erlef/setup-beam@v1
|
||||
|
||||
+4
-2
@@ -69,7 +69,9 @@ inputs:
|
||||
required: false
|
||||
|
||||
version-file:
|
||||
description: a versions file (e.g. as used by `asdf`), which defines inputs
|
||||
description: >-
|
||||
a versions file (e.g. `.tool-versions` as used by `asdf`, or `mise.toml`
|
||||
as used by `mise`), which defines inputs
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
@@ -96,5 +98,5 @@ outputs:
|
||||
description: The commit unique id of the execution action version
|
||||
|
||||
runs:
|
||||
using: node20
|
||||
using: node24
|
||||
main: dist/index.js
|
||||
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "erlc-warning",
|
||||
"severity": "warning",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+):(\\d+):(\\d+): [wW]arning: (.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "erlc-error",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+):(\\d+):(\\d+): (?![wW]arning)(.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "ct-failure",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+) failed on line (\\d+)$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
},
|
||||
{
|
||||
"regexp": "^Reason: (.+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "eunit-failure",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\S+: .+\\.\\.\\.\\*failed\\*$"
|
||||
},
|
||||
{
|
||||
"regexp": "^in function .+ \\((.+), line (\\d+)\\)$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
},
|
||||
{
|
||||
"regexp": "^in call from .+$"
|
||||
},
|
||||
{
|
||||
"regexp": "^\\*\\*error:(.+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+33904
-24244
File diff suppressed because one or more lines are too long
+19
-22
@@ -1,30 +1,27 @@
|
||||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import { defineConfig } from 'eslint/config'
|
||||
import eslintPluginYml from 'eslint-plugin-yml'
|
||||
import yml from 'eslint-plugin-yml'
|
||||
import * as yamlParser from 'yaml-eslint-parser'
|
||||
|
||||
export default defineConfig([
|
||||
...eslintPluginYml.configs['flat/recommended'],
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
{
|
||||
extends: ['js/recommended'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
globals: globals.node,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.yml'],
|
||||
languageOptions: {
|
||||
parser: yamlParser,
|
||||
},
|
||||
plugins: {
|
||||
js,
|
||||
yml,
|
||||
},
|
||||
languageOptions: {
|
||||
ecmaVersion: 2022,
|
||||
globals: {
|
||||
...globals.node,
|
||||
rules: {
|
||||
...yml.configs.recommended.rules,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: eslintPluginYml.configs['flat/recommended'],
|
||||
files: ['*.yml'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
parser: 'yaml-eslint-parser',
|
||||
defaultYAMLVersion: '1.2',
|
||||
},
|
||||
},
|
||||
},
|
||||
])
|
||||
]
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "erlc-warning",
|
||||
"severity": "warning",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+):(\\d+):(\\d+): [wW]arning: (.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "erlc-error",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+):(\\d+):(\\d+): (?![wW]arning)(.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "ct-failure",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(\\S+) failed on line (\\d+)$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
},
|
||||
{
|
||||
"regexp": "^Reason: (.+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "eunit-failure",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\S+: .+\\.\\.\\.\\*failed\\*$"
|
||||
},
|
||||
{
|
||||
"regexp": "^in function .+ \\((.+), line (\\d+)\\)$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
},
|
||||
{
|
||||
"regexp": "^in call from .+$"
|
||||
},
|
||||
{
|
||||
"regexp": "^\\*\\*error:(.+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Generated
+1281
-942
File diff suppressed because it is too large
Load Diff
+16
-15
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "setup-beam",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -16,25 +17,25 @@
|
||||
"build-dist": "npm run clean-dist && npm install && npm run build && npm run format && npm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "1.11.1",
|
||||
"@actions/exec": "1.1.1",
|
||||
"@actions/tool-cache": "2.0.2",
|
||||
"csv-parse": "5.6.0",
|
||||
"semver": "7.7.2",
|
||||
"lodash": "4.17.21"
|
||||
"@actions/core": "3.0.0",
|
||||
"@actions/exec": "3.0.0",
|
||||
"@actions/tool-cache": "4.0.0",
|
||||
"csv-parse": "6.2.1",
|
||||
"semver": "7.7.4",
|
||||
"smol-toml": "1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "0.38.3",
|
||||
"eslint": "9.30.1",
|
||||
"@eslint/js": "9.30.1",
|
||||
"globals": "16.3.0",
|
||||
"markdownlint-cli": "0.45.0",
|
||||
"prettier": "3.6.2",
|
||||
"shellcheck": "3.1.0",
|
||||
"eslint-plugin-yml": "1.18.0",
|
||||
"@eslint/js": "10.0.1",
|
||||
"@vercel/ncc": "0.38.4",
|
||||
"eslint": "10.6.0",
|
||||
"eslint-plugin-yml": "3.3.1",
|
||||
"globals": "17.7.0",
|
||||
"markdownlint-cli": "0.48.0",
|
||||
"prettier": "3.9.1",
|
||||
"shellcheck": "4.1.0",
|
||||
"yarn": "1.22.22"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
"node": ">=24"
|
||||
}
|
||||
}
|
||||
|
||||
+127
-53
@@ -1,14 +1,18 @@
|
||||
const core = require('@actions/core')
|
||||
const { exec } = require('@actions/exec')
|
||||
const tc = require('@actions/tool-cache')
|
||||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
const fs = require('fs')
|
||||
const os = require('os')
|
||||
const csv = require('csv-parse/sync')
|
||||
const _ = require('lodash')
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import * as core from '@actions/core'
|
||||
import { exec } from '@actions/exec'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import * as semver from 'semver'
|
||||
import * as csv from 'csv-parse/sync'
|
||||
import toml from 'smol-toml'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const MAX_HTTP_RETRIES = 3
|
||||
const APPS = ['erlang', 'elixir', 'gleam', 'rebar']
|
||||
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
main().catch((err) => {
|
||||
@@ -53,7 +57,7 @@ async function main() {
|
||||
await maybeInstallRebar3(rebar3Spec)
|
||||
|
||||
// undefined is replaced by a function, post- main branch merge
|
||||
const setupBeamVersion = 'fceaea9'
|
||||
const setupBeamVersion = 'ea45c80'
|
||||
core.setOutput('setup-beam-version', setupBeamVersion)
|
||||
}
|
||||
|
||||
@@ -75,6 +79,7 @@ async function installOTP(otpSpec) {
|
||||
},
|
||||
})
|
||||
core.setOutput('otp-version', otpVersion)
|
||||
maybeEnableProblemMatchers('erlang')
|
||||
core.endGroup()
|
||||
|
||||
return otpVersion
|
||||
@@ -96,7 +101,7 @@ async function maybeInstallElixir(elixirSpec) {
|
||||
},
|
||||
})
|
||||
core.setOutput('elixir-version', elixirVersion)
|
||||
maybeEnableElixirProblemMatchers()
|
||||
maybeEnableProblemMatchers('elixir')
|
||||
core.endGroup()
|
||||
|
||||
installed = true
|
||||
@@ -105,16 +110,18 @@ async function maybeInstallElixir(elixirSpec) {
|
||||
return installed
|
||||
}
|
||||
|
||||
function maybeEnableElixirProblemMatchers() {
|
||||
const disableProblemMatchers = getInput('disable_problem_matchers', false)
|
||||
if (disableProblemMatchers === 'false') {
|
||||
const elixirMatchers = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'matchers',
|
||||
'elixir-matchers.json',
|
||||
)
|
||||
core.info(`##[add-matcher]${elixirMatchers}`)
|
||||
function problemMatchersEnabled() {
|
||||
return getInput('disable_problem_matchers', false) === 'false'
|
||||
}
|
||||
|
||||
// path.join with static strings helps ncc resolve and bundle the JSON files
|
||||
function maybeEnableProblemMatchers(language) {
|
||||
if (problemMatchersEnabled()) {
|
||||
const matcherFiles = {
|
||||
erlang: path.join(`${__dirname}/../matchers/erlang-matchers.json`),
|
||||
elixir: path.join(`${__dirname}/../matchers/elixir-matchers.json`),
|
||||
}
|
||||
core.info(`##[add-matcher]${matcherFiles[language]}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,11 +198,21 @@ async function getOTPVersion(otpSpec0, osVersion) {
|
||||
}
|
||||
|
||||
function requestedVersionFor(tool, version, originListing, mirrors) {
|
||||
return (
|
||||
`Requested ${tool} version (${version}) not found in version list, ` +
|
||||
`at ${originListing}${mirrors ? `, with mirrors ${mirrors}` : ''}; ` +
|
||||
"should you be using option 'version-type': 'strict'?"
|
||||
)
|
||||
const isVersionTypeStrict = isStrictVersion()
|
||||
|
||||
let versionType = 'loose'
|
||||
if (isVersionTypeStrict) {
|
||||
versionType = 'strict'
|
||||
}
|
||||
|
||||
let ret =
|
||||
`Requested ${versionType} ${tool} version (${version}) not found in version list, ` +
|
||||
`at ${originListing}${mirrors ? `, with mirrors ${mirrors}` : ''}.`
|
||||
if (!isVersionTypeStrict) {
|
||||
ret = `${ret} Should you be using option 'version-type': 'strict'?`
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
const knownBranches = ['main', 'master', 'maint']
|
||||
@@ -262,7 +279,7 @@ async function getElixirVersion(exSpec0) {
|
||||
if (!foundCombo) {
|
||||
throw new Error(
|
||||
`Requested Elixir / Erlang/OTP version (${exSpec0} / tried ${otpVersionsMajor}) not ` +
|
||||
'found in version list (did you check Compatibility between Elixir and Erlang/OTP?).' +
|
||||
'found in version list (did you check Compatibility between Elixir and Erlang/OTP?). ' +
|
||||
'Elixir and Erlang/OTP compatibility can be found at: ' +
|
||||
'https://hexdocs.pm/elixir/compatibility-and-deprecations.html',
|
||||
)
|
||||
@@ -360,9 +377,7 @@ async function getOTPVersions(osVersion) {
|
||||
})
|
||||
} else if (process.platform === 'win32') {
|
||||
const otpArch = otpArchitecture()
|
||||
const file_regex = new RegExp(
|
||||
`^otp_win${_.escapeRegExp(otpArch)}_(.*).exe$`,
|
||||
)
|
||||
const file_regex = new RegExp(`^otp_win${RegExp.escape(otpArch)}_(.*).exe$`)
|
||||
otpVersionsListings.forEach((otpVersionsListing) => {
|
||||
otpVersionsListing
|
||||
.map((x) => x.assets)
|
||||
@@ -566,7 +581,7 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
}
|
||||
|
||||
function maybeCoerced(v) {
|
||||
let ret = null
|
||||
let ret
|
||||
try {
|
||||
if (!isRC(v)) {
|
||||
ret = semver.coerce(v).version
|
||||
@@ -643,18 +658,30 @@ function getRunnerOSArchitecture() {
|
||||
|
||||
function getRunnerOSVersion() {
|
||||
// List from https://github.com/actions/runner-images?tab=readme-ov-file#available-images
|
||||
// at e065a395d52f491c58eb8fba8ab1dde2c7cfada1
|
||||
// Not considered, at the moment (though it might be easy to adapt to...):
|
||||
// - ubuntu-slim
|
||||
// - all macOS intel, large, and xlarge variants
|
||||
// - all win arm variants
|
||||
const ImageOSToContainer = {
|
||||
ubuntu22: 'ubuntu-22.04',
|
||||
'ubuntu22-arm64': 'ubuntu-22.04',
|
||||
ubuntu24: 'ubuntu-24.04',
|
||||
win19: 'windows-2019',
|
||||
'ubuntu24-arm64': 'ubuntu-24.04',
|
||||
ubuntu26: 'ubuntu-26.04',
|
||||
'ubuntu26-arm64': 'ubuntu-26.04',
|
||||
win22: 'windows-2022',
|
||||
macos13: 'macOS-13',
|
||||
win25: 'windows-2025',
|
||||
'win25-vs2026': 'windows-2025',
|
||||
macos14: 'macOS-14',
|
||||
macos15: 'macOS-15',
|
||||
macos26: 'macOS-26',
|
||||
}
|
||||
const deprecatedImageOSToContainer = {
|
||||
ubuntu18: 'ubuntu-18.04',
|
||||
ubuntu20: 'ubuntu-20.04',
|
||||
win19: 'windows-2019',
|
||||
macos13: 'macOS-13',
|
||||
}
|
||||
const containerFromEnvImageOS = ImageOSToContainer[process.env.ImageOS]
|
||||
if (!containerFromEnvImageOS) {
|
||||
@@ -790,28 +817,14 @@ alongside ${alternativeName}=${alternativeValue} \
|
||||
return input
|
||||
}
|
||||
|
||||
function parseVersionFile(versionFilePath0) {
|
||||
const versionFilePath = path.resolve(
|
||||
process.env.GITHUB_WORKSPACE,
|
||||
versionFilePath0,
|
||||
)
|
||||
if (!fs.existsSync(versionFilePath)) {
|
||||
throw new Error(
|
||||
`The specified version file, ${versionFilePath0}, does not exist`,
|
||||
)
|
||||
}
|
||||
|
||||
core.startGroup(`Parsing version file at ${versionFilePath0}`)
|
||||
function parseToolVersionsFile(versionFilePath) {
|
||||
const appVersions = new Map()
|
||||
const versions = fs.readFileSync(versionFilePath, 'utf8')
|
||||
// For the time being we parse .tool-versions
|
||||
// If we ever start parsing something else, this should
|
||||
// become default in a new option named e.g. version-file-type
|
||||
versions.split(/\r?\n/).forEach((line) => {
|
||||
const appVersion = line.match(/^([^ ]+)[ ]+(ref:v?)?([^ #]+)/)
|
||||
if (appVersion) {
|
||||
const app = appVersion[1]
|
||||
if (['erlang', 'elixir', 'gleam', 'rebar'].includes(app)) {
|
||||
if (APPS.includes(app)) {
|
||||
const [, , , version] = appVersion
|
||||
core.info(`Consuming ${app} at version ${version}`)
|
||||
appVersions.set(app, version)
|
||||
@@ -828,6 +841,46 @@ function parseVersionFile(versionFilePath0) {
|
||||
return appVersions
|
||||
}
|
||||
|
||||
function parseMiseTomlFile(versionFilePath) {
|
||||
const appVersions = new Map()
|
||||
const miseToml = fs.readFileSync(versionFilePath, 'utf8')
|
||||
const miseTomlParsed = toml.parse(miseToml)
|
||||
for (const app in miseTomlParsed.tools) {
|
||||
if (APPS.includes(app)) {
|
||||
const appVersion = miseTomlParsed.tools[app]
|
||||
const version =
|
||||
typeof appVersion == 'object' ? appVersion.version : appVersion
|
||||
|
||||
core.info(`Consuming ${app} at version ${version}`)
|
||||
appVersions.set(app, version)
|
||||
}
|
||||
}
|
||||
|
||||
return appVersions
|
||||
}
|
||||
|
||||
function parseVersionFile(versionFilePath0) {
|
||||
const versionFilePath = path.resolve(
|
||||
process.env.GITHUB_WORKSPACE,
|
||||
versionFilePath0,
|
||||
)
|
||||
if (!fs.existsSync(versionFilePath)) {
|
||||
throw new Error(
|
||||
`The specified version file, ${versionFilePath0}, does not exist`,
|
||||
)
|
||||
}
|
||||
|
||||
if (versionFilePath0.endsWith('.toml')) {
|
||||
core.startGroup(
|
||||
`Parsing ${path.basename(versionFilePath0)} file at ${versionFilePath0}`,
|
||||
)
|
||||
return parseMiseTomlFile(versionFilePath)
|
||||
}
|
||||
|
||||
core.startGroup(`Parsing .tool-versions file at ${versionFilePath0}`)
|
||||
return parseToolVersionsFile(versionFilePath)
|
||||
}
|
||||
|
||||
function debugLog(groupName, message) {
|
||||
const group = `Debugging for ${groupName}`
|
||||
core.debug(
|
||||
@@ -926,7 +979,7 @@ async function install(toolName, opts) {
|
||||
const otpArch = otpArchitecture()
|
||||
return (
|
||||
'https://github.com/erlang/otp/releases/download/' +
|
||||
`OTP-${toolVersion}/otp_win${_.escapeRegExp(otpArch)}_${toolVersion}.exe`
|
||||
`OTP-${toolVersion}/otp_win${otpArch}_${toolVersion}.exe`
|
||||
)
|
||||
},
|
||||
extract: async () => ['file', 'otp.exe'],
|
||||
@@ -1010,12 +1063,14 @@ async function install(toolName, opts) {
|
||||
tool: 'Gleam',
|
||||
linux: {
|
||||
downloadToolURL: () => {
|
||||
const arch = getRunnerOSArchitecture()
|
||||
let gz
|
||||
if (
|
||||
versionSpec === 'nightly' ||
|
||||
semver.gt(versionSpec, 'v0.22.1')
|
||||
) {
|
||||
gz = `gleam-${versionSpec}-x86_64-unknown-linux-musl.tar.gz`
|
||||
const target = arch === 'arm64' ? 'aarch64' : 'x86_64'
|
||||
gz = `gleam-${versionSpec}-${target}-unknown-linux-musl.tar.gz`
|
||||
} else {
|
||||
gz = `gleam-${versionSpec}-linux-amd64.tar.gz`
|
||||
}
|
||||
@@ -1079,7 +1134,26 @@ async function install(toolName, opts) {
|
||||
},
|
||||
},
|
||||
}
|
||||
installOpts.darwin = installOpts.linux
|
||||
installOpts.darwin = {
|
||||
downloadToolURL: () => {
|
||||
const arch = getRunnerOSArchitecture()
|
||||
let gz
|
||||
if (versionSpec === 'nightly' || semver.gt(versionSpec, 'v0.22.1')) {
|
||||
const target = arch === 'arm64' ? 'aarch64' : 'x86_64'
|
||||
gz = `gleam-${versionSpec}-${target}-apple-darwin.tar.gz`
|
||||
} else {
|
||||
gz =
|
||||
arch === 'arm64'
|
||||
? `gleam-${versionSpec}-macos-arm64.tar.gz`
|
||||
: `gleam-${versionSpec}-macos.tar.gz`
|
||||
}
|
||||
|
||||
return `https://github.com/gleam-lang/gleam/releases/download/${versionSpec}/${gz}`
|
||||
},
|
||||
extract: installOpts.linux.extract,
|
||||
postExtract: installOpts.linux.postExtract,
|
||||
reportVersion: installOpts.linux.reportVersion,
|
||||
}
|
||||
break
|
||||
case 'rebar3':
|
||||
installOpts = {
|
||||
@@ -1226,7 +1300,7 @@ function debugLoggingEnabled() {
|
||||
return !!process.env.RUNNER_DEBUG
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
get,
|
||||
getElixirVersion,
|
||||
getGleamVersion,
|
||||
|
||||
+869
-72
File diff suppressed because it is too large
Load Diff
+192
-39
@@ -1,3 +1,15 @@
|
||||
import assert from 'node:assert'
|
||||
import http from 'node:http'
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { describe, it } from 'node:test'
|
||||
import * as csv from 'csv-parse/sync'
|
||||
import elixirMatchers from '../matchers/elixir-matchers.json' with { type: 'json' }
|
||||
import erlangMatchers from '../matchers/erlang-matchers.json' with { type: 'json' }
|
||||
const { problemMatcher } = elixirMatchers
|
||||
const { problemMatcher: erlangProblemMatcher } = erlangMatchers
|
||||
|
||||
process.env.NODE_ENV = 'test'
|
||||
|
||||
simulateInput('otp-version', '25.1.2')
|
||||
@@ -9,15 +21,7 @@ simulateInput('install-hex', 'true')
|
||||
simulateInput('github-token', process.env.GITHUB_TOKEN)
|
||||
simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })
|
||||
|
||||
const assert = require('assert')
|
||||
const http = require('http')
|
||||
const fs = require('fs')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const setupBeam = require('../src/setup-beam')
|
||||
const { problemMatcher } = require('../matchers/elixir-matchers.json')
|
||||
const { describe, it } = require('node:test')
|
||||
const csv = require('csv-parse/sync')
|
||||
const { default: setupBeam } = await import('../src/setup-beam.js')
|
||||
|
||||
const matrix = {
|
||||
otp: {
|
||||
@@ -173,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'
|
||||
|
||||
it('is Ok for known linux version', async () => {
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = '27.0'
|
||||
@@ -195,21 +196,21 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
||||
assert.deepStrictEqual(got, expected)
|
||||
simulateInput('version-type', before)
|
||||
|
||||
spec = '19.3.x'
|
||||
osVersion = 'ubuntu-16.04'
|
||||
expected = 'OTP-19.3.6.13'
|
||||
spec = '20.3.x'
|
||||
osVersion = 'ubuntu-20.04'
|
||||
expected = 'OTP-20.3.8.26'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '^19.3.6'
|
||||
osVersion = 'ubuntu-16.04'
|
||||
expected = 'OTP-19.3.6.13'
|
||||
spec = '^20.3.8'
|
||||
osVersion = 'ubuntu-20.04'
|
||||
expected = 'OTP-20.3.8.26'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '^19.3'
|
||||
osVersion = 'ubuntu-18.04'
|
||||
expected = 'OTP-19.3.6.13'
|
||||
spec = '^20.3'
|
||||
osVersion = 'ubuntu-20.04'
|
||||
expected = 'OTP-20.3.8.26'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
@@ -272,7 +273,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '23.0'
|
||||
osVersion = 'windows-2019'
|
||||
osVersion = 'windows-2022'
|
||||
expected = '23.0.4'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
@@ -293,7 +294,7 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '23.0'
|
||||
osVersion = 'windows-2019'
|
||||
osVersion = 'windows-2022'
|
||||
expected = '23.0.4'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
@@ -305,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)]
|
||||
|
||||
@@ -340,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)]
|
||||
|
||||
@@ -400,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)]
|
||||
|
||||
@@ -482,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)]
|
||||
|
||||
@@ -517,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)]
|
||||
|
||||
@@ -527,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)]
|
||||
|
||||
@@ -541,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', () => {
|
||||
@@ -568,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
|
||||
})
|
||||
})
|
||||
@@ -578,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'
|
||||
@@ -613,9 +625,9 @@ describe('.getOTPVersion(_) - Elixir', () => {
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = '1.17'
|
||||
spec = '1.19'
|
||||
otpVersion = 'master'
|
||||
expected = 'v1.17-otp-27'
|
||||
expected = 'v1.19-otp-28'
|
||||
await setupBeam.installOTP(otpVersion)
|
||||
got = await setupBeam.getElixirVersion(spec, otpVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
@@ -640,8 +652,6 @@ describe('.getOTPVersion(_) - Elixir', () => {
|
||||
simulateInput('version-type', before)
|
||||
})
|
||||
}
|
||||
|
||||
process.env.RUNNER_ARCH = previousRunnerArch
|
||||
})
|
||||
|
||||
describe('.getOTPVersion(_) - Gleam', () => {
|
||||
@@ -685,18 +695,18 @@ describe('.getOTPVersion(_) - rebar3', () => {
|
||||
let spec
|
||||
|
||||
it('returns the expected value', async () => {
|
||||
spec = '3.10.x'
|
||||
expected = '3.10.0'
|
||||
spec = '3.26.x'
|
||||
expected = '3.26.0'
|
||||
got = await setupBeam.getRebar3Version(spec)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '3.11'
|
||||
expected = '3.11.1'
|
||||
spec = '3.25'
|
||||
expected = '3.25.1'
|
||||
got = await setupBeam.getRebar3Version(spec)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '3.10'
|
||||
expected = '3.10.0'
|
||||
spec = '3.26'
|
||||
expected = '3.26.0'
|
||||
got = await setupBeam.getRebar3Version(spec)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
})
|
||||
@@ -962,13 +972,13 @@ describe('.getVersionFromSpec(_)', () => {
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'latest'
|
||||
expected = '3.23.0'
|
||||
expected = '3.27.0'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.rebar3)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
})
|
||||
})
|
||||
|
||||
describe('version file', () => {
|
||||
describe('.tool-versions file', () => {
|
||||
const otpVersion = unsimulateInput('otp-version')
|
||||
const elixirVersion = unsimulateInput('elixir-version')
|
||||
const gleamVersion = unsimulateInput('gleam-version')
|
||||
@@ -1017,6 +1027,57 @@ gleam ${gleam} \n`
|
||||
simulateInput('gleam-version', gleamVersion)
|
||||
})
|
||||
|
||||
describe('mise.toml file', () => {
|
||||
const otpVersion = unsimulateInput('otp-version')
|
||||
const elixirVersion = unsimulateInput('elixir-version')
|
||||
const gleamVersion = unsimulateInput('gleam-version')
|
||||
|
||||
it('is parsed correctly', async () => {
|
||||
const erlang = '27.3.4.1'
|
||||
const elixir = '1.18.4'
|
||||
const gleam = '1.9.1'
|
||||
let miseToml = `[tools]
|
||||
"erlang" = "${erlang}"
|
||||
elixir = { version = "${elixir}", postinstall="mix deps.get" } # comment, with space and ref:
|
||||
"not-gleam" = 0.23 # not picked up
|
||||
"gleam" = "${gleam}"
|
||||
[env]
|
||||
_.file = ".env"\n`
|
||||
const filename = 'test/mise.toml'
|
||||
if (process.platform === 'win32') {
|
||||
// Force \r\n to test in Windows
|
||||
miseToml = miseToml.replace(/\n/g, '\r\n')
|
||||
}
|
||||
fs.writeFileSync(filename, miseToml)
|
||||
process.env.GITHUB_WORKSPACE = ''
|
||||
const appVersions = setupBeam.parseVersionFile(filename)
|
||||
assert.strictEqual(appVersions.get('erlang'), erlang)
|
||||
assert.strictEqual(appVersions.get('elixir'), elixir)
|
||||
|
||||
const absoluteFilename = path.join(os.tmpdir(), 'mise.toml')
|
||||
fs.writeFileSync(absoluteFilename, miseToml)
|
||||
|
||||
process.env.GITHUB_WORKSPACE = process.cwd()
|
||||
const absoluteAppVersions = setupBeam.parseVersionFile(absoluteFilename)
|
||||
assert.strictEqual(absoluteAppVersions.get('erlang'), erlang)
|
||||
assert.strictEqual(absoluteAppVersions.get('elixir'), elixir)
|
||||
|
||||
assert.ok(async () => {
|
||||
await setupBeam.install('otp', { toolVersion: erlang })
|
||||
})
|
||||
assert.ok(async () => {
|
||||
await setupBeam.install('elixir', { toolVersion: elixir })
|
||||
})
|
||||
assert.ok(async () => {
|
||||
await setupBeam.install('gleam', { toolVersion: gleam })
|
||||
})
|
||||
})
|
||||
|
||||
simulateInput('otp-version', otpVersion)
|
||||
simulateInput('elixir-version', elixirVersion)
|
||||
simulateInput('gleam-version', gleamVersion)
|
||||
})
|
||||
|
||||
describe('.get(_)', () => {
|
||||
it('retries as expected', async () => {
|
||||
let attempt = 0
|
||||
@@ -1108,6 +1169,98 @@ describe("Elixir Mix matcher's", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("Erlang matcher's", () => {
|
||||
it('erlc errors are properly matched', () => {
|
||||
const [matcher] = erlangProblemMatcher.find(
|
||||
({ owner }) => owner === 'erlc-error',
|
||||
).pattern
|
||||
|
||||
const output = 'src/mymod.erl:42:5: head mismatch'
|
||||
const match = output.match(matcher.regexp)
|
||||
assert.equal(match[1], 'src/mymod.erl')
|
||||
assert.equal(match[2], '42')
|
||||
assert.equal(match[3], '5')
|
||||
assert.equal(match[4], 'head mismatch')
|
||||
})
|
||||
|
||||
it('erlc errors do not match warnings', () => {
|
||||
const [matcher] = erlangProblemMatcher.find(
|
||||
({ owner }) => owner === 'erlc-error',
|
||||
).pattern
|
||||
|
||||
const output = 'src/mymod.erl:42:5: Warning: variable X is unused'
|
||||
const match = output.match(matcher.regexp)
|
||||
assert.equal(match, null)
|
||||
})
|
||||
|
||||
it('erlc warnings are properly matched', () => {
|
||||
const [matcher] = erlangProblemMatcher.find(
|
||||
({ owner }) => owner === 'erlc-warning',
|
||||
).pattern
|
||||
|
||||
const output = 'src/mymod.erl:10:3: Warning: variable X is unused'
|
||||
const match = output.match(matcher.regexp)
|
||||
assert.equal(match[1], 'src/mymod.erl')
|
||||
assert.equal(match[2], '10')
|
||||
assert.equal(match[3], '3')
|
||||
assert.equal(match[4], 'variable X is unused')
|
||||
})
|
||||
|
||||
it('dialyzer warnings are matched via erlc patterns', () => {
|
||||
const [matcher] = erlangProblemMatcher.find(
|
||||
({ owner }) => owner === 'erlc-warning',
|
||||
).pattern
|
||||
|
||||
const output =
|
||||
'src/mymod.erl:25:1: warning: Function foo/0 has no local return'
|
||||
const match = output.match(matcher.regexp)
|
||||
assert.equal(match[1], 'src/mymod.erl')
|
||||
assert.equal(match[2], '25')
|
||||
assert.equal(match[3], '1')
|
||||
assert.equal(match[4], 'Function foo/0 has no local return')
|
||||
})
|
||||
|
||||
it('CT failures are properly matched', () => {
|
||||
const [filePattern, reasonPattern] = erlangProblemMatcher.find(
|
||||
({ owner }) => owner === 'ct-failure',
|
||||
).pattern
|
||||
|
||||
const firstOutput = 'test/mymod_SUITE.erl failed on line 55'
|
||||
const secondOutput = 'Reason: {badmatch,{error,timeout}}'
|
||||
|
||||
const fileMatch = firstOutput.match(filePattern.regexp)
|
||||
assert.equal(fileMatch[1], 'test/mymod_SUITE.erl')
|
||||
assert.equal(fileMatch[2], '55')
|
||||
|
||||
const reasonMatch = secondOutput.match(reasonPattern.regexp)
|
||||
assert.equal(reasonMatch[1], '{badmatch,{error,timeout}}')
|
||||
})
|
||||
|
||||
it('EUnit failures are properly matched', () => {
|
||||
const [headerPattern, funcPattern, callPattern, errorPattern] =
|
||||
erlangProblemMatcher.find(
|
||||
({ owner }) => owner === 'eunit-failure',
|
||||
).pattern
|
||||
|
||||
const header = 'mymod_test: hello_test....*failed*'
|
||||
const func =
|
||||
'in function mymod_test:hello_test/0 (test/mymod_test.erl, line 12)'
|
||||
const call = 'in call from mymod_test:hello_test/0'
|
||||
const error = '**error:{badmatch,false}'
|
||||
|
||||
assert.ok(header.match(headerPattern.regexp))
|
||||
|
||||
const funcMatch = func.match(funcPattern.regexp)
|
||||
assert.equal(funcMatch[1], 'test/mymod_test.erl')
|
||||
assert.equal(funcMatch[2], '12')
|
||||
|
||||
assert.ok(call.match(callPattern.regexp))
|
||||
|
||||
const errorMatch = error.match(errorPattern.regexp)
|
||||
assert.equal(errorMatch[1], '{badmatch,false}')
|
||||
})
|
||||
})
|
||||
|
||||
function unsimulateInput(key) {
|
||||
return simulateInput(key, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user