Support release nightlies (#63)

* Support release nightlies

See #62

* Replace == nightly with endsWith nightly

* Use majorMinorMatch, not full match

* Replace more (in-)equality checks

* Reduce number of duplicate CI builds

* Add example to docs

* Tidy up nightly conditions
This commit is contained in:
Sascha Mann
2021-01-08 05:09:50 +01:00
committed by GitHub
parent 66addd1b2f
commit 531b2e0973
5 changed files with 35 additions and 26 deletions

View File

@@ -2,6 +2,7 @@ name: Example builds (nightly)
on: on:
push: push:
branches: ['main', 'master', 'releases/*']
pull_request: pull_request:
schedule: schedule:
- cron: '37 17 * * *' - cron: '37 17 * * *'
@@ -12,6 +13,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
julia-version: [nightly, 1.6-nightly]
julia-arch: [x64, x86] julia-arch: [x64, x86]
os: [ubuntu-latest, macOS-latest, windows-latest] os: [ubuntu-latest, macOS-latest, windows-latest]
# 32-bit Julia binaries are not available on macOS # 32-bit Julia binaries are not available on macOS
@@ -28,10 +30,10 @@ jobs:
npm run build npm run build
npm run pack npm run pack
- name: "Set up Julia (nightly)" - name: "Set up Julia (${{ matrix.julia-version }})"
uses: ./ uses: ./
with: with:
version: nightly version: ${{ matrix.julia-version }}
arch: ${{ matrix.julia-arch }} arch: ${{ matrix.julia-arch }}
show-versioninfo: 'true' show-versioninfo: 'true'
- run: julia --version - run: julia --version

View File

@@ -1,6 +1,9 @@
name: Example builds name: Example builds
on: [push, pull_request] on:
push:
branches: ['main', 'master', 'releases/*']
pull_request:
jobs: jobs:
test: test:

View File

@@ -93,6 +93,7 @@ You can either specify specific Julia versions or version ranges. If you specify
- `^1.3.0-0` is a **caret** version range that includes _all_ pre-releases. It matches all versions `≥ 1.3.0-` and `< 2.0.0`. - `^1.3.0-0` is a **caret** version range that includes _all_ pre-releases. 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. It matches all versions `≥ 1.3.0-` and `< 1.4.0`. - `~1.3.0-0` is a **tilde** version range that includes _all_ pre-releases. It matches all versions `≥ 1.3.0-` and `< 1.4.0`.
- `nightly` will install the latest nightly build. - `nightly` will install the latest nightly build.
- `1.6-nightly` will install the latest nightly build for the upcoming 1.6 release. This version will only be available during certain phases of the Julia release cycle.
Internally the action uses node's semver package to resolve version ranges. Its [documentation](https://github.com/npm/node-semver#advanced-range-syntax) contains more details on the version range syntax. You can test what version will be selected for a given input in this JavaScript [REPL](https://repl.it/@SaschaMann/setup-julia-version-logic). Internally the action uses node's semver package to resolve version ranges. Its [documentation](https://github.com/npm/node-semver#advanced-range-syntax) contains more details on the version range syntax. You can test what version will be selected for a given input in this JavaScript [REPL](https://repl.it/@SaschaMann/setup-julia-version-logic).

23
lib/installer.js generated
View File

@@ -78,14 +78,10 @@ function getJuliaVersions(versionInfo) {
} }
exports.getJuliaVersions = getJuliaVersions; exports.getJuliaVersions = getJuliaVersions;
function getJuliaVersion(availableReleases, versionInput) { function getJuliaVersion(availableReleases, versionInput) {
if (semver.valid(versionInput) == versionInput) { if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) {
// versionInput is a valid version, use it directly // versionInput is a valid version or a nightly version, use it directly
return versionInput; return versionInput;
} }
// nightlies
if (versionInput == 'nightly') {
return 'nightly';
}
// Use the highest available version that matches versionInput // Use the highest available version that matches versionInput
let version = semver.maxSatisfying(availableReleases, versionInput); let version = semver.maxSatisfying(availableReleases, versionInput);
if (version == null) { if (version == null) {
@@ -119,7 +115,7 @@ function getNightlyFileName(arch) {
return `julia-latest${versionExt}.${ext}`; return `julia-latest${versionExt}.${ext}`;
} }
function getFileInfo(versionInfo, version, arch) { function getFileInfo(versionInfo, version, arch) {
if (version == 'nightly') { if (version.endsWith('nightly')) {
return null; return null;
} }
for (let file of versionInfo[version].files) { for (let file of versionInfo[version].files) {
@@ -131,10 +127,15 @@ function getFileInfo(versionInfo, version, arch) {
} }
exports.getFileInfo = getFileInfo; exports.getFileInfo = getFileInfo;
function getDownloadURL(fileInfo, version, arch) { function getDownloadURL(fileInfo, version, arch) {
const baseURL = `https://julialangnightlies-s3.julialang.org/bin/${osMap[osPlat]}/${arch}`;
// release branch nightlies, e.g. 1.6-nightlies should return .../bin/linux/x64/1.6/julia-latest-linux64.tar.gz
const majorMinorMatches = /^(\d*.\d*)-nightly/.exec(version);
if (majorMinorMatches) {
return `${baseURL}/${majorMinorMatches[1]}/${getNightlyFileName(arch)}`;
}
// nightlies // nightlies
if (version == 'nightly') { if (version == 'nightly') {
const baseURL = 'https://julialangnightlies-s3.julialang.org/bin'; return `${baseURL}/${getNightlyFileName(arch)}`;
return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`;
} }
return fileInfo.url; return fileInfo.url;
} }
@@ -147,7 +148,7 @@ function installJulia(versionInfo, version, arch) {
core.debug(`downloading Julia from ${downloadURL}`); core.debug(`downloading Julia from ${downloadURL}`);
const juliaDownloadPath = yield tc.downloadTool(downloadURL); const juliaDownloadPath = yield tc.downloadTool(downloadURL);
// Verify checksum // Verify checksum
if (version != 'nightly') { if (!version.endsWith('nightly')) {
const checkSum = yield calculateChecksum(juliaDownloadPath); const checkSum = yield calculateChecksum(juliaDownloadPath);
if (fileInfo.sha256 != checkSum) { if (fileInfo.sha256 != checkSum) {
throw new Error(`Checksum of downloaded file does not match the expected checksum from versions.json.\nExpected: ${fileInfo.sha256}\nGot: ${checkSum}`); throw new Error(`Checksum of downloaded file does not match the expected checksum from versions.json.\nExpected: ${fileInfo.sha256}\nGot: ${checkSum}`);
@@ -165,7 +166,7 @@ function installJulia(versionInfo, version, arch) {
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]); yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]);
return tempInstallDir; return tempInstallDir;
case 'win32': case 'win32':
if (version == 'nightly' || semver.gtr(version, '1.3', { includePrerelease: true })) { if (version.endsWith('nightly') || semver.gtr(version, '1.3', { includePrerelease: true })) {
// The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes // The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]); yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]);
} }

View File

@@ -66,16 +66,11 @@ export async function getJuliaVersions(versionInfo): Promise<string[]> {
} }
export function getJuliaVersion(availableReleases: string[], versionInput: string): string { export function getJuliaVersion(availableReleases: string[], versionInput: string): string {
if (semver.valid(versionInput) == versionInput) { if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) {
// versionInput is a valid version, use it directly // versionInput is a valid version or a nightly version, use it directly
return versionInput return versionInput
} }
// nightlies
if (versionInput == 'nightly') {
return 'nightly'
}
// Use the highest available version that matches versionInput // Use the highest available version that matches versionInput
let version = semver.maxSatisfying(availableReleases, versionInput) let version = semver.maxSatisfying(availableReleases, versionInput)
if (version == null) { if (version == null) {
@@ -111,7 +106,7 @@ function getNightlyFileName(arch: string): string {
} }
export function getFileInfo(versionInfo, version: string, arch: string) { export function getFileInfo(versionInfo, version: string, arch: string) {
if (version == 'nightly') { if (version.endsWith('nightly')) {
return null return null
} }
@@ -125,10 +120,17 @@ export function getFileInfo(versionInfo, version: string, arch: string) {
} }
export function getDownloadURL(fileInfo, version: string, arch: string): string { export function getDownloadURL(fileInfo, version: string, arch: string): string {
const baseURL = `https://julialangnightlies-s3.julialang.org/bin/${osMap[osPlat]}/${arch}`
// release branch nightlies, e.g. 1.6-nightlies should return .../bin/linux/x64/1.6/julia-latest-linux64.tar.gz
const majorMinorMatches = /^(\d*.\d*)-nightly/.exec(version)
if (majorMinorMatches) {
return `${baseURL}/${majorMinorMatches[1]}/${getNightlyFileName(arch)}`
}
// nightlies // nightlies
if (version == 'nightly') { if (version == 'nightly') {
const baseURL = 'https://julialangnightlies-s3.julialang.org/bin' return `${baseURL}/${getNightlyFileName(arch)}`
return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`
} }
return fileInfo.url return fileInfo.url
@@ -142,7 +144,7 @@ export async function installJulia(versionInfo, version: string, arch: string):
const juliaDownloadPath = await tc.downloadTool(downloadURL) const juliaDownloadPath = await tc.downloadTool(downloadURL)
// Verify checksum // Verify checksum
if (version != 'nightly') { if (!version.endsWith('nightly')) {
const checkSum = await calculateChecksum(juliaDownloadPath) const checkSum = await calculateChecksum(juliaDownloadPath)
if (fileInfo.sha256 != checkSum) { if (fileInfo.sha256 != checkSum) {
throw new Error(`Checksum of downloaded file does not match the expected checksum from versions.json.\nExpected: ${fileInfo.sha256}\nGot: ${checkSum}`) throw new Error(`Checksum of downloaded file does not match the expected checksum from versions.json.\nExpected: ${fileInfo.sha256}\nGot: ${checkSum}`)
@@ -161,7 +163,7 @@ export async function installJulia(versionInfo, version: string, arch: string):
await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]) await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir])
return tempInstallDir return tempInstallDir
case 'win32': case 'win32':
if (version == 'nightly' || semver.gtr(version, '1.3', {includePrerelease: true})) { if (version.endsWith('nightly') || semver.gtr(version, '1.3', {includePrerelease: true})) {
// The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes // The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]) await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`])
} else { } else {