mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 15:16:08 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e7fdef09f | |||
| 1fe9179886 |
@@ -90,6 +90,14 @@ jobs:
|
||||
node-version: '20'
|
||||
- run: npm install --production
|
||||
- run: npm test
|
||||
- name: .tool-versions test
|
||||
id: setup-beam
|
||||
uses: ./
|
||||
with:
|
||||
install-rebar: false
|
||||
install-hex: false
|
||||
version-file: test/.tool-versions
|
||||
version-type: strict
|
||||
|
||||
unit_tests_macos:
|
||||
name: Unit tests (macOS)
|
||||
|
||||
Vendored
+2
-2
@@ -25933,7 +25933,7 @@ async function main() {
|
||||
await maybeInstallRebar3(rebar3Spec)
|
||||
|
||||
// undefined is replaced by a function, post- main branch merge
|
||||
const setupBeamVersion = '8fc1380'
|
||||
const setupBeamVersion = '1fe9179'
|
||||
core.setOutput('setup-beam-version', setupBeamVersion)
|
||||
}
|
||||
|
||||
@@ -26680,7 +26680,7 @@ function parseVersionFile(versionFilePath0) {
|
||||
// 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('\n').forEach((line) => {
|
||||
versions.split(/\r?\n/).forEach((line) => {
|
||||
const appVersion = line.match(/^([^ ]+)[ ]+(ref:v?)?([^ #]+)/)
|
||||
if (appVersion) {
|
||||
const app = appVersion[1]
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ async function main() {
|
||||
await maybeInstallRebar3(rebar3Spec)
|
||||
|
||||
// undefined is replaced by a function, post- main branch merge
|
||||
const setupBeamVersion = '8fc1380'
|
||||
const setupBeamVersion = '1fe9179'
|
||||
core.setOutput('setup-beam-version', setupBeamVersion)
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ function parseVersionFile(versionFilePath0) {
|
||||
// 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('\n').forEach((line) => {
|
||||
versions.split(/\r?\n/).forEach((line) => {
|
||||
const appVersion = line.match(/^([^ ]+)[ ]+(ref:v?)?([^ #]+)/)
|
||||
if (appVersion) {
|
||||
const app = appVersion[1]
|
||||
|
||||
@@ -938,15 +938,19 @@ describe('version file', () => {
|
||||
const gleamVersion = unsimulateInput('gleam-version')
|
||||
|
||||
it('is parsed correctly', async () => {
|
||||
const erlang = '27'
|
||||
const elixir = '1.17.0'
|
||||
const gleam = '0.23.0'
|
||||
const toolVersions = `# a comment
|
||||
erlang ref:v${erlang}# comment, no space, and ref:v
|
||||
const erlang = '27.3.4.1'
|
||||
const elixir = '1.18.4'
|
||||
const gleam = '1.9.1'
|
||||
let toolVersions = `# a comment
|
||||
erlang ref:v${erlang}
|
||||
elixir ref:${elixir} # comment, with space and ref:
|
||||
not-gleam 0.23 # not picked up
|
||||
gleam ${gleam} \n`
|
||||
const filename = 'test/.tool-versions'
|
||||
if (process.platform === 'win32') {
|
||||
// Force \r\n to test in Windows
|
||||
toolVersions = toolVersions.replace(/\n/g, '\r\n')
|
||||
}
|
||||
fs.writeFileSync(filename, toolVersions)
|
||||
process.env.GITHUB_WORKSPACE = ''
|
||||
const appVersions = setupBeam.parseVersionFile(filename)
|
||||
|
||||
Reference in New Issue
Block a user