mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Version it!
|
- name: Version it!
|
||||||
run: |
|
run: |
|
||||||
# We expect a string such as const setupBeamVersion = 'undefined' in the code
|
# We expect a string such as const setupBeamVersion = 'undefined' in the code
|
||||||
@@ -45,8 +45,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.ref != 'refs/heads/main'
|
if: github.ref != 'refs/heads/main'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: actions/setup-node@v4.4.0
|
- uses: actions/setup-node@v6.3.0
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
- run: npm run build-dist
|
- run: npm run build-dist
|
||||||
@@ -58,19 +58,21 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.ref != 'refs/heads/main'
|
if: github.ref != 'refs/heads/main'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: raven-actions/actionlint@v2.0.1
|
- uses: raven-actions/actionlint@v2.1.2
|
||||||
|
|
||||||
unit_tests_ubuntu:
|
unit_tests_ubuntu:
|
||||||
name: Unit tests (Ubuntu)
|
name: Unit tests (Ubuntu)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: actions/setup-node@v4.4.0
|
- uses: actions/setup-node@v6.3.0
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
env:
|
||||||
|
NODE_ENV: test
|
||||||
- name: .tool-versions test
|
- name: .tool-versions test
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -84,12 +86,14 @@ jobs:
|
|||||||
name: Unit tests (Windows)
|
name: Unit tests (Windows)
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: actions/setup-node@v4.4.0
|
- uses: actions/setup-node@v6.3.0
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
- run: npm install --production
|
- run: npm install --production
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
env:
|
||||||
|
NODE_ENV: test
|
||||||
- name: .tool-versions test
|
- name: .tool-versions test
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -103,9 +107,11 @@ jobs:
|
|||||||
name: Unit tests (macOS)
|
name: Unit tests (macOS)
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- uses: actions/setup-node@v4.4.0
|
- uses: actions/setup-node@v6.3.0
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
env:
|
||||||
|
NODE_ENV: test
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
install-rebar: [true, false]
|
install-rebar: [true, false]
|
||||||
install-hex: [true, false]
|
install-hex: [true, false]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Use erlef/setup-beam
|
- name: Use erlef/setup-beam
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ jobs:
|
|||||||
rebar3-version: 'latest'
|
rebar3-version: 'latest'
|
||||||
os: 'macos-latest'
|
os: 'macos-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Use erlef/setup-beam
|
- name: Use erlef/setup-beam
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -118,7 +118,7 @@ jobs:
|
|||||||
rebar3-version: 3.24
|
rebar3-version: 3.24
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Use erlef/setup-beam
|
- name: Use erlef/setup-beam
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ jobs:
|
|||||||
escript_script: 'protoc-gen-elixir --version'
|
escript_script: 'protoc-gen-elixir --version'
|
||||||
os: 'ubuntu-latest'
|
os: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Use erlef/setup-beam
|
- name: Use erlef/setup-beam
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -154,7 +154,7 @@ jobs:
|
|||||||
rebar3-version: 3.24
|
rebar3-version: 3.24
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Use erlef/setup-beam
|
- name: Use erlef/setup-beam
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ name: Update 3rd party licenses (automation)
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
@@ -14,7 +15,7 @@ jobs:
|
|||||||
name: Update 3rd party licenses
|
name: Update 3rd party licenses
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- run:
|
- run:
|
||||||
./.github/workflows/update_3rd_party_licenses.sh
|
./.github/workflows/update_3rd_party_licenses.sh
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ jobs:
|
|||||||
escript_script: 'protoc-gen-elixir --version'
|
escript_script: 'protoc-gen-elixir --version'
|
||||||
os: 'windows-latest'
|
os: 'windows-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Use erlef/setup-beam
|
- name: Use erlef/setup-beam
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -137,7 +137,7 @@ jobs:
|
|||||||
rebar3-version: 3.24
|
rebar3-version: 3.24
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v6.0.2
|
||||||
- name: Use erlef/setup-beam
|
- name: Use erlef/setup-beam
|
||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
+4
-2
@@ -1,2 +1,4 @@
|
|||||||
node_modules/**
|
/node_modules
|
||||||
test/.tool-versions
|
/test/.tool-versions
|
||||||
|
/test/mise.toml
|
||||||
|
/dist/package.json
|
||||||
|
|||||||
+1192
-6936
File diff suppressed because it is too large
Load Diff
@@ -84,6 +84,7 @@ and Erlang/OTP.
|
|||||||
| `ubuntu-24.04` | 24.3 - 28 | x86_64, arm64 | ✅
|
| `ubuntu-24.04` | 24.3 - 28 | x86_64, arm64 | ✅
|
||||||
| `windows-2019` | 21\* - 25 | x86_64, x86 | ✅
|
| `windows-2019` | 21\* - 25 | x86_64, x86 | ✅
|
||||||
| `windows-2022` | 21\* - 28 | 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-13` | 25.0 - 28 | x86_64, arm64 | ✅
|
||||||
| `macOS-14` | 25.0 - 28 | x86_64, arm64 | ✅
|
| `macOS-14` | 25.0 - 28 | x86_64, arm64 | ✅
|
||||||
| `macOS-15` | 25.0 - 28 | x86_64, arm64 | ✅
|
| `macOS-15` | 25.0 - 28 | x86_64, arm64 | ✅
|
||||||
@@ -102,6 +103,7 @@ uses that to download assets:
|
|||||||
| `ubuntu24` | `ubuntu-24.04`
|
| `ubuntu24` | `ubuntu-24.04`
|
||||||
| `win19` | `windows-2019`
|
| `win19` | `windows-2019`
|
||||||
| `win22` | `windows-2022`
|
| `win22` | `windows-2022`
|
||||||
|
| `win25` | `windows-2025`
|
||||||
| `macos13` | `macOS-13`
|
| `macos13` | `macOS-13`
|
||||||
| `macos14` | `macOS-14`
|
| `macos14` | `macOS-14`
|
||||||
| `macos15` | `macOS-15`
|
| `macos15` | `macOS-15`
|
||||||
@@ -139,23 +141,22 @@ e.g. `${{steps.setup-beam.outputs.erlang-version}}`
|
|||||||
|
|
||||||
### Version file
|
### Version file
|
||||||
|
|
||||||
A version file is specified via input `version-file` (e.g.`.tool-versions`). This
|
A version file is specified via input `version-file` (e.g. `.tool-versions` or `mise.toml`).
|
||||||
allows not having to use YML input for versions, though the action does check (and
|
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.
|
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`,
|
**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.
|
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,
|
Supported version elements are the same as the ones defined for the YML portion of the action,
|
||||||
with the following correspondence.
|
with the following correspondence.
|
||||||
|
|
||||||
#### `.tool-versions` format
|
#### `.tool-versions` / `mise.toml` format
|
||||||
|
|
||||||
| YML | `.tool-versions`
|
| YML | Version file key
|
||||||
|- |-
|
|- |-
|
||||||
| `otp-version` | `erlang`
|
| `otp-version` | `erlang`
|
||||||
| `elixir-version` | `elixir`
|
| `elixir-version` | `elixir`
|
||||||
@@ -297,7 +298,7 @@ on: push
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: windows-2022
|
runs-on: windows-2025
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: erlef/setup-beam@v1
|
- uses: erlef/setup-beam@v1
|
||||||
|
|||||||
+3
-1
@@ -69,7 +69,9 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
|
|
||||||
version-file:
|
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: ''
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
|||||||
Vendored
+36741
-7032
File diff suppressed because one or more lines are too long
+19
-22
@@ -1,30 +1,27 @@
|
|||||||
import js from '@eslint/js'
|
import js from '@eslint/js'
|
||||||
import globals from 'globals'
|
import globals from 'globals'
|
||||||
import { defineConfig } from 'eslint/config'
|
import yml from 'eslint-plugin-yml'
|
||||||
import eslintPluginYml from 'eslint-plugin-yml'
|
import * as yamlParser from 'yaml-eslint-parser'
|
||||||
|
|
||||||
export default defineConfig([
|
export default [
|
||||||
...eslintPluginYml.configs['flat/recommended'],
|
js.configs.recommended,
|
||||||
{
|
{
|
||||||
extends: ['js/recommended'],
|
languageOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
sourceType: 'module',
|
||||||
|
globals: globals.node,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.yml'],
|
||||||
|
languageOptions: {
|
||||||
|
parser: yamlParser,
|
||||||
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
js,
|
yml,
|
||||||
},
|
},
|
||||||
languageOptions: {
|
rules: {
|
||||||
ecmaVersion: 2022,
|
...yml.configs.recommended.rules,
|
||||||
globals: {
|
|
||||||
...globals.node,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
]
|
||||||
extends: eslintPluginYml.configs['flat/recommended'],
|
|
||||||
files: ['*.yml'],
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
parser: 'yaml-eslint-parser',
|
|
||||||
defaultYAMLVersion: '1.2',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|||||||
Generated
+1278
-942
File diff suppressed because it is too large
Load Diff
+16
-14
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-beam",
|
"name": "setup-beam",
|
||||||
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -16,22 +17,23 @@
|
|||||||
"build-dist": "npm run clean-dist && npm install && npm run build && npm run format && npm run lint"
|
"build-dist": "npm run clean-dist && npm install && npm run build && npm run format && npm run lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.11.1",
|
"@actions/core": "3.0.0",
|
||||||
"@actions/exec": "1.1.1",
|
"@actions/exec": "3.0.0",
|
||||||
"@actions/tool-cache": "2.0.2",
|
"@actions/tool-cache": "4.0.0",
|
||||||
"csv-parse": "5.6.0",
|
"csv-parse": "6.1.0",
|
||||||
"semver": "7.7.2",
|
"lodash": "4.17.23",
|
||||||
"lodash": "4.17.21"
|
"semver": "7.7.4",
|
||||||
|
"toml": "3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "0.38.3",
|
"@eslint/js": "10.0.1",
|
||||||
"eslint": "9.30.1",
|
"@vercel/ncc": "0.38.4",
|
||||||
"@eslint/js": "9.30.1",
|
"eslint": "10.0.3",
|
||||||
"globals": "16.3.0",
|
"eslint-plugin-yml": "3.3.1",
|
||||||
"markdownlint-cli": "0.45.0",
|
"globals": "17.4.0",
|
||||||
"prettier": "3.6.2",
|
"markdownlint-cli": "0.48.0",
|
||||||
"shellcheck": "3.1.0",
|
"prettier": "3.8.1",
|
||||||
"eslint-plugin-yml": "1.18.0",
|
"shellcheck": "4.1.0",
|
||||||
"yarn": "1.22.22"
|
"yarn": "1.22.22"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
+77
-37
@@ -1,14 +1,19 @@
|
|||||||
const core = require('@actions/core')
|
import path from 'node:path'
|
||||||
const { exec } = require('@actions/exec')
|
import fs from 'node:fs'
|
||||||
const tc = require('@actions/tool-cache')
|
import os from 'node:os'
|
||||||
const path = require('path')
|
import { fileURLToPath } from 'node:url'
|
||||||
const semver = require('semver')
|
import * as core from '@actions/core'
|
||||||
const fs = require('fs')
|
import { exec } from '@actions/exec'
|
||||||
const os = require('os')
|
import * as tc from '@actions/tool-cache'
|
||||||
const csv = require('csv-parse/sync')
|
import * as semver from 'semver'
|
||||||
const _ = require('lodash')
|
import * as csv from 'csv-parse/sync'
|
||||||
|
import _ from 'lodash'
|
||||||
|
import toml from 'toml'
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
|
||||||
const MAX_HTTP_RETRIES = 3
|
const MAX_HTTP_RETRIES = 3
|
||||||
|
const APPS = ['erlang', 'elixir', 'gleam', 'rebar']
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'test') {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
main().catch((err) => {
|
main().catch((err) => {
|
||||||
@@ -53,7 +58,7 @@ async function main() {
|
|||||||
await maybeInstallRebar3(rebar3Spec)
|
await maybeInstallRebar3(rebar3Spec)
|
||||||
|
|
||||||
// undefined is replaced by a function, post- main branch merge
|
// undefined is replaced by a function, post- main branch merge
|
||||||
const setupBeamVersion = 'fceaea9'
|
const setupBeamVersion = '98c13a9'
|
||||||
core.setOutput('setup-beam-version', setupBeamVersion)
|
core.setOutput('setup-beam-version', setupBeamVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,11 +113,9 @@ async function maybeInstallElixir(elixirSpec) {
|
|||||||
function maybeEnableElixirProblemMatchers() {
|
function maybeEnableElixirProblemMatchers() {
|
||||||
const disableProblemMatchers = getInput('disable_problem_matchers', false)
|
const disableProblemMatchers = getInput('disable_problem_matchers', false)
|
||||||
if (disableProblemMatchers === 'false') {
|
if (disableProblemMatchers === 'false') {
|
||||||
|
// path.join helps ncc figure this out
|
||||||
const elixirMatchers = path.join(
|
const elixirMatchers = path.join(
|
||||||
__dirname,
|
`${__dirname}/../matchers/elixir-matchers.json`,
|
||||||
'..',
|
|
||||||
'matchers',
|
|
||||||
'elixir-matchers.json',
|
|
||||||
)
|
)
|
||||||
core.info(`##[add-matcher]${elixirMatchers}`)
|
core.info(`##[add-matcher]${elixirMatchers}`)
|
||||||
}
|
}
|
||||||
@@ -191,11 +194,21 @@ async function getOTPVersion(otpSpec0, osVersion) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function requestedVersionFor(tool, version, originListing, mirrors) {
|
function requestedVersionFor(tool, version, originListing, mirrors) {
|
||||||
return (
|
const isVersionTypeStrict = isStrictVersion()
|
||||||
`Requested ${tool} version (${version}) not found in version list, ` +
|
|
||||||
`at ${originListing}${mirrors ? `, with mirrors ${mirrors}` : ''}; ` +
|
let versionType = 'loose'
|
||||||
"should you be using option 'version-type': 'strict'?"
|
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']
|
const knownBranches = ['main', 'master', 'maint']
|
||||||
@@ -566,7 +579,7 @@ function getVersionFromSpec(spec0, versions0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function maybeCoerced(v) {
|
function maybeCoerced(v) {
|
||||||
let ret = null
|
let ret
|
||||||
try {
|
try {
|
||||||
if (!isRC(v)) {
|
if (!isRC(v)) {
|
||||||
ret = semver.coerce(v).version
|
ret = semver.coerce(v).version
|
||||||
@@ -648,6 +661,7 @@ function getRunnerOSVersion() {
|
|||||||
ubuntu24: 'ubuntu-24.04',
|
ubuntu24: 'ubuntu-24.04',
|
||||||
win19: 'windows-2019',
|
win19: 'windows-2019',
|
||||||
win22: 'windows-2022',
|
win22: 'windows-2022',
|
||||||
|
win25: 'windows-2025',
|
||||||
macos13: 'macOS-13',
|
macos13: 'macOS-13',
|
||||||
macos14: 'macOS-14',
|
macos14: 'macOS-14',
|
||||||
macos15: 'macOS-15',
|
macos15: 'macOS-15',
|
||||||
@@ -790,28 +804,14 @@ alongside ${alternativeName}=${alternativeValue} \
|
|||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseVersionFile(versionFilePath0) {
|
function parseToolVersionsFile(versionFilePath) {
|
||||||
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}`)
|
|
||||||
const appVersions = new Map()
|
const appVersions = new Map()
|
||||||
const versions = fs.readFileSync(versionFilePath, 'utf8')
|
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) => {
|
versions.split(/\r?\n/).forEach((line) => {
|
||||||
const appVersion = line.match(/^([^ ]+)[ ]+(ref:v?)?([^ #]+)/)
|
const appVersion = line.match(/^([^ ]+)[ ]+(ref:v?)?([^ #]+)/)
|
||||||
if (appVersion) {
|
if (appVersion) {
|
||||||
const app = appVersion[1]
|
const app = appVersion[1]
|
||||||
if (['erlang', 'elixir', 'gleam', 'rebar'].includes(app)) {
|
if (APPS.includes(app)) {
|
||||||
const [, , , version] = appVersion
|
const [, , , version] = appVersion
|
||||||
core.info(`Consuming ${app} at version ${version}`)
|
core.info(`Consuming ${app} at version ${version}`)
|
||||||
appVersions.set(app, version)
|
appVersions.set(app, version)
|
||||||
@@ -828,6 +828,46 @@ function parseVersionFile(versionFilePath0) {
|
|||||||
return appVersions
|
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) {
|
function debugLog(groupName, message) {
|
||||||
const group = `Debugging for ${groupName}`
|
const group = `Debugging for ${groupName}`
|
||||||
core.debug(
|
core.debug(
|
||||||
@@ -1226,7 +1266,7 @@ function debugLoggingEnabled() {
|
|||||||
return !!process.env.RUNNER_DEBUG
|
return !!process.env.RUNNER_DEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export default {
|
||||||
get,
|
get,
|
||||||
getElixirVersion,
|
getElixirVersion,
|
||||||
getGleamVersion,
|
getGleamVersion,
|
||||||
|
|||||||
+60
-10
@@ -9,15 +9,16 @@ simulateInput('install-hex', 'true')
|
|||||||
simulateInput('github-token', process.env.GITHUB_TOKEN)
|
simulateInput('github-token', process.env.GITHUB_TOKEN)
|
||||||
simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })
|
simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })
|
||||||
|
|
||||||
const assert = require('assert')
|
import assert from 'node:assert'
|
||||||
const http = require('http')
|
import http from 'node:http'
|
||||||
const fs = require('fs')
|
import fs from 'node:fs'
|
||||||
const os = require('os')
|
import os from 'node:os'
|
||||||
const path = require('path')
|
import path from 'node:path'
|
||||||
const setupBeam = require('../src/setup-beam')
|
import { describe, it } from 'node:test'
|
||||||
const { problemMatcher } = require('../matchers/elixir-matchers.json')
|
import * as csv from 'csv-parse/sync'
|
||||||
const { describe, it } = require('node:test')
|
import setupBeam from '../src/setup-beam.js'
|
||||||
const csv = require('csv-parse/sync')
|
import elixirMatchers from '../matchers/elixir-matchers.json' with { type: 'json' }
|
||||||
|
const { problemMatcher } = elixirMatchers
|
||||||
|
|
||||||
const matrix = {
|
const matrix = {
|
||||||
otp: {
|
otp: {
|
||||||
@@ -968,7 +969,7 @@ describe('.getVersionFromSpec(_)', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('version file', () => {
|
describe('.tool-versions file', () => {
|
||||||
const otpVersion = unsimulateInput('otp-version')
|
const otpVersion = unsimulateInput('otp-version')
|
||||||
const elixirVersion = unsimulateInput('elixir-version')
|
const elixirVersion = unsimulateInput('elixir-version')
|
||||||
const gleamVersion = unsimulateInput('gleam-version')
|
const gleamVersion = unsimulateInput('gleam-version')
|
||||||
@@ -1017,6 +1018,55 @@ gleam ${gleam} \n`
|
|||||||
simulateInput('gleam-version', gleamVersion)
|
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}" \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(_)', () => {
|
describe('.get(_)', () => {
|
||||||
it('retries as expected', async () => {
|
it('retries as expected', async () => {
|
||||||
let attempt = 0
|
let attempt = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user