mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
Compare commits
111 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91bce83a29 | |||
| 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 | |||
| e6d7c94229 | |||
| fceaea9f54 | |||
| 2bb5b653d0 | |||
| 1d4efdd2e9 | |||
| 73f047e328 | |||
| 6dd8a1a852 | |||
| fd9a2e183f | |||
| 65085e37bc | |||
| 80c1659516 |
@@ -24,7 +24,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- 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@v6.0.2
|
||||
- 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@v6.0.2
|
||||
- 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@v6.0.2
|
||||
- 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,21 @@ 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@v4.2.2
|
||||
- uses: actions/setup-node@v4.4.0
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- 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 +115,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@v6.0.2
|
||||
- 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@v6.0.2
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
|
||||
@@ -43,14 +43,11 @@ jobs:
|
||||
elixir-version: '1.14.3'
|
||||
os: 'macos-latest'
|
||||
version-type: 'strict'
|
||||
- otp-version: '27'
|
||||
os: 'macos-15'
|
||||
version-type: 'strict'
|
||||
- otp-version: '26'
|
||||
os: 'macos-15'
|
||||
version-type: 'strict'
|
||||
- otp-version: '25'
|
||||
os: 'macos-15'
|
||||
- otp-version: '27'
|
||||
elixir-version: '1.18'
|
||||
os: 'macos-26'
|
||||
- otp-version: '26'
|
||||
elixir-version: '1.16'
|
||||
rebar3-version: '3.25'
|
||||
@@ -71,7 +68,7 @@ jobs:
|
||||
rebar3-version: 'latest'
|
||||
os: 'macos-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -124,7 +121,7 @@ jobs:
|
||||
rebar3-version: 3.24
|
||||
os: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
|
||||
@@ -53,12 +53,6 @@ jobs:
|
||||
elixir-version: '1.14.3'
|
||||
os: 'ubuntu-latest'
|
||||
version-type: 'strict'
|
||||
- otp-version: '27'
|
||||
os: 'ubuntu-24.04'
|
||||
version-type: 'strict'
|
||||
- otp-version: '26'
|
||||
os: 'ubuntu-24.04'
|
||||
version-type: 'strict'
|
||||
- otp-version: '25'
|
||||
os: 'ubuntu-24.04'
|
||||
- otp-version: '26'
|
||||
@@ -92,7 +86,7 @@ jobs:
|
||||
escript_script: 'protoc-gen-elixir --version'
|
||||
os: 'ubuntu-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -160,7 +154,7 @@ jobs:
|
||||
rebar3-version: 3.24
|
||||
os: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- 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@v6.0.2
|
||||
- run:
|
||||
./.github/workflows/update_3rd_party_licenses.sh
|
||||
env:
|
||||
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
escript_script: 'protoc-gen-elixir --version'
|
||||
os: 'windows-latest'
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- name: Use erlef/setup-beam
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
@@ -137,7 +137,7 @@ jobs:
|
||||
rebar3-version: 3.24
|
||||
os: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- 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
|
||||
|
||||
+1417
-7159
File diff suppressed because it is too large
Load Diff
@@ -84,13 +84,20 @@ and Erlang/OTP.
|
||||
| `ubuntu-24.04` | 24.3 - 28 | x86_64, arm64 | ✅
|
||||
| `windows-2019` | 21\* - 25 | x86_64, x86 | ✅
|
||||
| `windows-2022` | 21\* - 28 | x86_64, x86 | ✅
|
||||
| `windows-2025` | 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 | ✅
|
||||
| `macOS-26` | 25.0 - 28 | 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
|
||||
@@ -102,9 +109,11 @@ uses that to download assets:
|
||||
| `ubuntu24` | `ubuntu-24.04`
|
||||
| `win19` | `windows-2019`
|
||||
| `win22` | `windows-2022`
|
||||
| `win25` | `windows-2025`
|
||||
| `macos13` | `macOS-13`
|
||||
| `macos14` | `macOS-14`
|
||||
| `macos15` | `macOS-15`
|
||||
| `macos26` | `macOS-26`
|
||||
|
||||
as per the following example:
|
||||
|
||||
@@ -139,23 +148,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 +297,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 +333,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
+33947
-7021
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
+1273
-943
File diff suppressed because it is too large
Load Diff
+17
-15
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "setup-beam",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -16,25 +17,26 @@
|
||||
"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",
|
||||
"lodash": "4.17.23",
|
||||
"semver": "7.7.4",
|
||||
"smol-toml": "1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "0.38.3",
|
||||
"eslint": "9.30.0",
|
||||
"@eslint/js": "9.30.0",
|
||||
"globals": "16.2.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.1.0",
|
||||
"eslint-plugin-yml": "3.3.1",
|
||||
"globals": "17.4.0",
|
||||
"markdownlint-cli": "0.48.0",
|
||||
"prettier": "3.8.1",
|
||||
"shellcheck": "4.1.0",
|
||||
"yarn": "1.22.22"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
"node": ">=24"
|
||||
}
|
||||
}
|
||||
|
||||
+136
-66
@@ -1,14 +1,19 @@
|
||||
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 _ from 'lodash'
|
||||
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 +58,7 @@ async function main() {
|
||||
await maybeInstallRebar3(rebar3Spec)
|
||||
|
||||
// undefined is replaced by a function, post- main branch merge
|
||||
const setupBeamVersion = '1fe9179'
|
||||
const setupBeamVersion = '7a27046'
|
||||
core.setOutput('setup-beam-version', setupBeamVersion)
|
||||
}
|
||||
|
||||
@@ -75,6 +80,7 @@ async function installOTP(otpSpec) {
|
||||
},
|
||||
})
|
||||
core.setOutput('otp-version', otpVersion)
|
||||
maybeEnableProblemMatchers('erlang')
|
||||
core.endGroup()
|
||||
|
||||
return otpVersion
|
||||
@@ -96,7 +102,7 @@ async function maybeInstallElixir(elixirSpec) {
|
||||
},
|
||||
})
|
||||
core.setOutput('elixir-version', elixirVersion)
|
||||
maybeEnableElixirProblemMatchers()
|
||||
maybeEnableProblemMatchers('elixir')
|
||||
core.endGroup()
|
||||
|
||||
installed = true
|
||||
@@ -105,16 +111,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]}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,10 +178,14 @@ async function maybeInstallRebar3(rebar3Spec) {
|
||||
return installed
|
||||
}
|
||||
|
||||
function maybeRemoveOTPPrefix(otpSpec) {
|
||||
return otpSpec.replace(/^OTP-/, '')
|
||||
}
|
||||
|
||||
async function getOTPVersion(otpSpec0, osVersion) {
|
||||
const [otpVersions, originListing, hexMirrors] =
|
||||
await getOTPVersions(osVersion)
|
||||
let spec = otpSpec0.replace(/^OTP-/, '')
|
||||
let spec = maybeRemoveOTPPrefix(otpSpec0)
|
||||
const versions = otpVersions
|
||||
const otpVersion = getVersionFromSpec(spec, versions)
|
||||
|
||||
@@ -187,11 +199,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']
|
||||
@@ -349,12 +371,9 @@ async function getOTPVersions(osVersion) {
|
||||
.trim()
|
||||
.split('\n')
|
||||
.forEach((line) => {
|
||||
const otpMatch = line
|
||||
.match(/^([^ ]+)?( .+)/)[1]
|
||||
.match(/^([^-]+-)?(.+)$/)
|
||||
const otpVersion = otpMatch[2]
|
||||
const otpVersionOrig = otpMatch[0]
|
||||
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
|
||||
const otpVersionOrig = line.match(/^([^ ]+)?( .+)/)[1]
|
||||
const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig)
|
||||
debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig])
|
||||
otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference
|
||||
})
|
||||
} else if (process.platform === 'win32') {
|
||||
@@ -368,10 +387,10 @@ async function getOTPVersions(osVersion) {
|
||||
.flat()
|
||||
.filter((x) => x.name.match(file_regex))
|
||||
.forEach((x) => {
|
||||
const otpMatch = x.name.match(file_regex)
|
||||
const otpVersion = otpMatch[1]
|
||||
debugLog('OTP line and parsing', [otpMatch, otpVersion])
|
||||
otpVersions[otpVersion] = otpVersion
|
||||
const otpVersionOrig = x.name.match(file_regex)[1]
|
||||
const otpVersion = otpVersionOrig
|
||||
debugLog('OTP line and parsing', [x.name, otpVersion, otpVersionOrig])
|
||||
otpVersions[otpVersion] = otpVersionOrig
|
||||
})
|
||||
})
|
||||
} else if (process.platform === 'darwin') {
|
||||
@@ -380,10 +399,9 @@ async function getOTPVersions(osVersion) {
|
||||
columns: true,
|
||||
})
|
||||
.forEach((line) => {
|
||||
const otpMatch = line.ref_name.match(/^([^-]+-)?(.+)$/)
|
||||
const otpVersion = otpMatch[2]
|
||||
const otpVersionOrig = otpMatch[0]
|
||||
debugLog('OTP line and parsing', [line, otpVersion, otpMatch])
|
||||
const otpVersionOrig = line.ref_name
|
||||
const otpVersion = maybeRemoveOTPPrefix(otpVersionOrig)
|
||||
debugLog('OTP line and parsing', [line, otpVersion, otpVersionOrig])
|
||||
otpVersions[otpVersion] = otpVersionOrig // we keep the original for later reference
|
||||
})
|
||||
}
|
||||
@@ -509,7 +527,8 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
isKnownBranch(version) ||
|
||||
isKnownVerBranch(version)
|
||||
) {
|
||||
// If `version-type: strict` or version is RC, we just try to remove a potential initial v
|
||||
// If `version-type: strict`, version is an RC, or version is "a branch"
|
||||
// we just try to remove a potential initial v
|
||||
coerced = maybeRemoveVPrefix(version)
|
||||
} else {
|
||||
// Otherwise, we place the version into a version bucket
|
||||
@@ -526,18 +545,19 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
|
||||
let version = null
|
||||
|
||||
if (
|
||||
if (spec0 === 'latest') {
|
||||
version = versions0[versions0.latest]
|
||||
} else if (
|
||||
isStrictVersion() ||
|
||||
isRC(spec0) ||
|
||||
isKnownBranch(spec0) ||
|
||||
isKnownVerBranch(spec0)
|
||||
isKnownVerBranch(spec0) ||
|
||||
spec0 === 'nightly'
|
||||
) {
|
||||
if (versions0[spec]) {
|
||||
// We obtain it directly
|
||||
version = versions0[spec]
|
||||
}
|
||||
} else if (spec0 === 'latest') {
|
||||
version = versions0[versions0.latest]
|
||||
} else if (rangeMax !== null) {
|
||||
// Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest
|
||||
const thatVersion = spec
|
||||
@@ -564,7 +584,7 @@ function getVersionFromSpec(spec0, versions0) {
|
||||
}
|
||||
|
||||
function maybeCoerced(v) {
|
||||
let ret = null
|
||||
let ret
|
||||
try {
|
||||
if (!isRC(v)) {
|
||||
ret = semver.coerce(v).version
|
||||
@@ -644,11 +664,14 @@ function getRunnerOSVersion() {
|
||||
const ImageOSToContainer = {
|
||||
ubuntu22: 'ubuntu-22.04',
|
||||
ubuntu24: 'ubuntu-24.04',
|
||||
'win11-arm64': 'windows-11-arm',
|
||||
win19: 'windows-2019',
|
||||
win22: 'windows-2022',
|
||||
win25: 'windows-2025',
|
||||
macos13: 'macOS-13',
|
||||
macos14: 'macOS-14',
|
||||
macos15: 'macOS-15',
|
||||
macos26: 'macOS-26',
|
||||
}
|
||||
const deprecatedImageOSToContainer = {
|
||||
ubuntu18: 'ubuntu-18.04',
|
||||
@@ -788,28 +811,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)
|
||||
@@ -826,6 +835,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(
|
||||
@@ -1008,12 +1057,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`
|
||||
}
|
||||
@@ -1077,7 +1128,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 = {
|
||||
@@ -1224,7 +1294,7 @@ function debugLoggingEnabled() {
|
||||
return !!process.env.RUNNER_DEBUG
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
get,
|
||||
getElixirVersion,
|
||||
getGleamVersion,
|
||||
|
||||
+256
-67
@@ -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: {
|
||||
@@ -77,7 +81,7 @@ describe('OTP install', () => {
|
||||
const otpOSVersion = 'ubuntu-08.04'
|
||||
const otpVersion = 'OTP-23.2'
|
||||
|
||||
assert.rejects(
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.install('otp', {
|
||||
hexMirror: 'https://builds.hex.pm',
|
||||
@@ -97,7 +101,7 @@ describe('OTP install', () => {
|
||||
describe('Elixir install', () => {
|
||||
it('fails for version 0.11 without OTP', async () => {
|
||||
const exVersion = '0.11'
|
||||
assert.rejects(
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.install('elixir', {
|
||||
hexMirror: 'https://builds.hex.pm',
|
||||
@@ -114,7 +118,7 @@ describe('Elixir install', () => {
|
||||
|
||||
it('fails for version 1.0.0 on OTP 17 (without OTP)', async () => {
|
||||
const exVersion = 'v1.0.0-otp-17'
|
||||
assert.rejects(
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.install('elixir', {
|
||||
hexMirror: 'https://builds.hex.pm',
|
||||
@@ -133,7 +137,7 @@ describe('Elixir install', () => {
|
||||
describe('Gleam install', () => {
|
||||
it('fails for unknown OTP', async () => {
|
||||
const gleamVersion = '0.1.3'
|
||||
assert.rejects(
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.install('gleam', { gleamVersion })
|
||||
},
|
||||
@@ -149,7 +153,7 @@ describe('Gleam install', () => {
|
||||
describe('rebar3 install', () => {
|
||||
it('fails for unknown OTP', async () => {
|
||||
const r3Version = '0.14.4'
|
||||
assert.rejects(
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.install('rebar3', { r3Version })
|
||||
},
|
||||
@@ -173,20 +177,9 @@ 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 = '26'
|
||||
osVersion = 'ubuntu-24.04'
|
||||
expected = 'maint-26'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
simulateInput('version-type', before)
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = '27.0'
|
||||
osVersion = 'ubuntu-24.04'
|
||||
@@ -203,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)
|
||||
|
||||
@@ -311,19 +304,48 @@ describe('.getOTPVersion(_) - Erlang', () => {
|
||||
}
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
it('is Ok for known linux ARM64 version', async () => {
|
||||
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)]
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = '26'
|
||||
osVersion = 'ubuntu-24.04'
|
||||
expected = 'maint-26'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.getOTPVersion('27', 'ubuntu-24.04')
|
||||
},
|
||||
(err) => {
|
||||
assert.ok(err instanceof Error)
|
||||
return true
|
||||
},
|
||||
`Fetching strict OTP version maint-<v> with input <v> is supposed to fail`,
|
||||
)
|
||||
simulateInput('version-type', before)
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
assert.strictEqual(
|
||||
await setupBeam.getOTPVersion('maint-27', 'ubuntu-24.04'),
|
||||
'maint-27',
|
||||
)
|
||||
simulateInput('version-type', before)
|
||||
|
||||
before = simulateInput('version-type', 'loose')
|
||||
assert.strictEqual(
|
||||
await setupBeam.getOTPVersion('maint-27', 'ubuntu-24.04'),
|
||||
'maint-27',
|
||||
)
|
||||
simulateInput('version-type', before)
|
||||
|
||||
process.env.RUNNER_ARCH = previousRunnerArch
|
||||
})
|
||||
|
||||
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)]
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = '27.0'
|
||||
osVersion = 'ubuntu-24.04'
|
||||
@@ -381,21 +403,16 @@ 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)]
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = '26'
|
||||
osVersion = 'ubuntu-24.04'
|
||||
expected = 'maint-26'
|
||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
simulateInput('version-type', before)
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = '27.0'
|
||||
osVersion = 'ubuntu-24.04'
|
||||
@@ -471,12 +488,45 @@ 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)]
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.getOTPVersion('27')
|
||||
},
|
||||
(err) => {
|
||||
assert.ok(err instanceof Error)
|
||||
return true
|
||||
},
|
||||
`Fetching strict OTP version maint-<v> with input <v> is supposed to fail`,
|
||||
)
|
||||
simulateInput('version-type', before)
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
assert.strictEqual(await setupBeam.getOTPVersion('maint-27'), 'maint-27')
|
||||
simulateInput('version-type', before)
|
||||
|
||||
before = simulateInput('version-type', 'loose')
|
||||
assert.strictEqual(await setupBeam.getOTPVersion('maint-27'), 'maint-27')
|
||||
simulateInput('version-type', before)
|
||||
|
||||
process.env.RUNNER_ARCH = previousRunnerArch
|
||||
})
|
||||
|
||||
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)]
|
||||
|
||||
@@ -487,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)]
|
||||
|
||||
@@ -501,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', () => {
|
||||
@@ -517,7 +571,7 @@ describe('OTP arch-specific install', () => {
|
||||
const spec = '26'
|
||||
const osVersion = 'ubuntu-24.04'
|
||||
|
||||
assert.rejects(
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await setupBeam.getOTPVersion(spec, osVersion)
|
||||
},
|
||||
@@ -528,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
|
||||
})
|
||||
})
|
||||
@@ -538,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'
|
||||
@@ -583,7 +635,7 @@ describe('.getOTPVersion(_) - Elixir', () => {
|
||||
|
||||
before = simulateInput('version-type', 'strict')
|
||||
spec = 'v1.15.0-rc.2'
|
||||
otpVersion = 'OTP-26'
|
||||
otpVersion = 'OTP-26.0'
|
||||
expected = 'v1.15.0-rc.2-otp-26'
|
||||
await setupBeam.installOTP(otpVersion)
|
||||
got = await setupBeam.getElixirVersion(spec, otpVersion)
|
||||
@@ -600,8 +652,6 @@ describe('.getOTPVersion(_) - Elixir', () => {
|
||||
simulateInput('version-type', before)
|
||||
})
|
||||
}
|
||||
|
||||
process.env.RUNNER_ARCH = previousRunnerArch
|
||||
})
|
||||
|
||||
describe('.getOTPVersion(_) - Gleam', () => {
|
||||
@@ -617,6 +667,12 @@ describe('.getOTPVersion(_) - Gleam', () => {
|
||||
got = await setupBeam.getGleamVersion(spec, otpVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'nightly'
|
||||
otpVersion = '28'
|
||||
expected = 'nightly'
|
||||
got = await setupBeam.getGleamVersion(spec, otpVersion)
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '0.13.2'
|
||||
otpVersion = 'OTP-24'
|
||||
expected = 'v0.13.2'
|
||||
@@ -870,11 +926,6 @@ describe('.getVersionFromSpec(_)', () => {
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-20.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'maint-24'
|
||||
expected = 'maint-24'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '> 0'
|
||||
expected = 'OTP-26.2.5'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
@@ -885,11 +936,6 @@ describe('.getVersionFromSpec(_)', () => {
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = 'maint-26'
|
||||
expected = 'maint-26'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-22.04'])
|
||||
assert.deepStrictEqual(got, expected)
|
||||
|
||||
spec = '> 0'
|
||||
expected = 'OTP-27.0'
|
||||
got = setupBeam.getVersionFromSpec(spec, matrix.otp['ubuntu-24.04'])
|
||||
@@ -932,7 +978,7 @@ describe('.getVersionFromSpec(_)', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('version file', () => {
|
||||
describe('.tool-versions file', () => {
|
||||
const otpVersion = unsimulateInput('otp-version')
|
||||
const elixirVersion = unsimulateInput('elixir-version')
|
||||
const gleamVersion = unsimulateInput('gleam-version')
|
||||
@@ -981,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
|
||||
@@ -1072,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