mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-22 22:56:07 +00:00
Support mise.toml (#415)
* add support for mise.toml version file type * changes from review * Keep versioning consistent * fix default value for version-file-type input * Use single `version-file`, autodetect type * Update src/setup-beam.js Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com> * Improve log output for mise version files * Rebuild dist * Run build-dist * add support for mise.toml version file type * changes from review * Keep versioning consistent * fix default value for version-file-type input * Use single `version-file`, autodetect type * Update src/setup-beam.js Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com> * Improve log output for mise version files * Rebuild dist * Run build-dist --------- Co-authored-by: Michael Ruoss <michael.ruoss@cradle.bio> Co-authored-by: Michael Ruoss <michael@michaelruoss.ch> Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com>
This commit is contained in:
+50
-1
@@ -969,7 +969,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')
|
||||
@@ -1018,6 +1018,55 @@ 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}" \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
|
||||
|
||||
Reference in New Issue
Block a user