Skip to content

Commit

Permalink
allow specifying the version as lts to install the latest LTS version
Browse files Browse the repository at this point in the history
for now, this just hardcodes the LTS version in the source (similar to how juliaup does it) since the latest LTS is not available in `versions.json`. Since the LTS is updated so rarely this might be ok for now.
  • Loading branch information
KristofferC committed Apr 15, 2024
1 parent d30adc4 commit ae3df50
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/example-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: ['1.0.5', '1.2', '^1.5.0-beta1', '1']
julia-version: ['1.0.5', '1.2', '^1.5.0-beta1', '1', 'lts']
julia-arch: [x64, x86]
os: [ubuntu-latest, macOS-latest, windows-latest]
# 32-bit Julia binaries are not available on macOS
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ You can either specify specific Julia versions or version ranges. If you specify
- `'~1.3.0-rc1'` is a **tilde** version range that includes pre-releases of `1.3.0` starting at `rc1`. It matches all versions `≥ 1.3.0-rc1` and `< 1.4.0`.
- `'^1.3.0-0'` is a **caret** version range that includes _all_ pre-releases of `1.3.0`. It matches all versions `≥ 1.3.0-` and `< 2.0.0`.
- `'~1.3.0-0'` is a **tilde** version range that includes _all_ pre-releases of `1.3.0`. It matches all versions `≥ 1.3.0-` and `< 1.4.0`.
- `'lts'` will install the latest LTS build.
- `'nightly'` will install the latest nightly build.
- `'1.7-nightly'` will install the latest nightly build for the upcoming 1.7 release. This version will only be available during certain phases of the Julia release cycle.

Expand Down
5 changes: 5 additions & 0 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ describe('version matching tests', () => {
expect(installer.getJuliaVersion([], 'nightly')).toEqual('nightly')
expect(installer.getJuliaVersion(testVersions, 'nightly')).toEqual('nightly')
})

it('LTS', () => {
// Update test when LTS is updated
expect(installer.getJuliaVersion(testVersions, 'lts')).toEqual(installer.getJuliaVersion(testVersions, '1.6'))
})
})

describe('version ranges', () => {
Expand Down
4 changes: 4 additions & 0 deletions lib/installer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import retry = require('async-retry')

import * as semver from 'semver'

const LTS_VERSION = '1.6'

// Translations between actions input and Julia arch names
const osMap = {
'win32': 'winnt',
Expand Down Expand Up @@ -82,6 +84,10 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin
return versionInput
}

if (versionInput == 'lts') {
return getJuliaVersion(availableReleases, LTS_VERSION, includePrerelease)
}

// Use the highest available version that matches versionInput
let version = semver.maxSatisfying(availableReleases, versionInput, {includePrerelease})
if (version == null) {
Expand Down
1 change: 0 additions & 1 deletion src/setup-julia.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as core from '@actions/core'
import * as exec from '@actions/exec'
import * as tc from '@actions/tool-cache'

import * as fs from 'fs'
Expand Down

0 comments on commit ae3df50

Please sign in to comment.