From d45b91ea3b509837e7a29d26dc66232a800f523b Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Thu, 7 Jan 2021 10:42:36 +0100 Subject: [PATCH 1/7] Support release nightlies See #62 --- .github/workflows/example-builds-nightly.yml | 5 +++-- lib/installer.js | 13 +++++++++---- src/installer.ts | 15 +++++++++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/example-builds-nightly.yml b/.github/workflows/example-builds-nightly.yml index 7f6ba26f..f45ea340 100644 --- a/.github/workflows/example-builds-nightly.yml +++ b/.github/workflows/example-builds-nightly.yml @@ -12,6 +12,7 @@ jobs: strategy: fail-fast: false matrix: + julia-version: [nightly, 1.6-nightly] julia-arch: [x64, x86] os: [ubuntu-latest, macOS-latest, windows-latest] # 32-bit Julia binaries are not available on macOS @@ -28,10 +29,10 @@ jobs: npm run build npm run pack - - name: "Set up Julia (nightly)" + - name: "Set up Julia (${{ matrix.julia-version }})" uses: ./ with: - version: nightly + version: ${{ matrix.julia-version }} arch: ${{ matrix.julia-arch }} show-versioninfo: 'true' - run: julia --version diff --git a/lib/installer.js b/lib/installer.js index 371360fd..0d72d946 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -83,8 +83,8 @@ function getJuliaVersion(availableReleases, versionInput) { return versionInput; } // nightlies - if (versionInput == 'nightly') { - return 'nightly'; + if (versionInput.endsWith('nightly')) { + return versionInput; } // Use the highest available version that matches versionInput let version = semver.maxSatisfying(availableReleases, versionInput); @@ -131,10 +131,15 @@ function getFileInfo(versionInfo, version, arch) { } exports.getFileInfo = getFileInfo; 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[0]}/${getNightlyFileName(arch)}`; + } // nightlies if (version == 'nightly') { - const baseURL = 'https://julialangnightlies-s3.julialang.org/bin'; - return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`; + return `${baseURL}/${getNightlyFileName(arch)}`; } return fileInfo.url; } diff --git a/src/installer.ts b/src/installer.ts index ad2cdc34..dc4909d6 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -72,8 +72,8 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin } // nightlies - if (versionInput == 'nightly') { - return 'nightly' + if (versionInput.endsWith('nightly')) { + return versionInput } // Use the highest available version that matches versionInput @@ -125,10 +125,17 @@ export function getFileInfo(versionInfo, version: string, arch: 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[0]}/${getNightlyFileName(arch)}` + } + // nightlies if (version == 'nightly') { - const baseURL = 'https://julialangnightlies-s3.julialang.org/bin' - return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}` + return `${baseURL}/${getNightlyFileName(arch)}` } return fileInfo.url From db72d0c938ac47e14c278a83d68494db5189ca7e Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Thu, 7 Jan 2021 10:46:41 +0100 Subject: [PATCH 2/7] Replace == nightly with endsWith nightly --- lib/installer.js | 4 ++-- src/installer.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/installer.js b/lib/installer.js index 0d72d946..f50d3a2d 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -119,7 +119,7 @@ function getNightlyFileName(arch) { return `julia-latest${versionExt}.${ext}`; } function getFileInfo(versionInfo, version, arch) { - if (version == 'nightly') { + if (version.endsWith('nightly')) { return null; } for (let file of versionInfo[version].files) { @@ -170,7 +170,7 @@ function installJulia(versionInfo, version, arch) { yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]); return tempInstallDir; 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 yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]); } diff --git a/src/installer.ts b/src/installer.ts index dc4909d6..7fb9bba7 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -111,7 +111,7 @@ function getNightlyFileName(arch: string): string { } export function getFileInfo(versionInfo, version: string, arch: string) { - if (version == 'nightly') { + if (version.endsWith('nightly')) { return null } @@ -168,7 +168,7 @@ export async function installJulia(versionInfo, version: string, arch: string): await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]) return tempInstallDir 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 await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]) } else { From 3126ba31b45255ca5ca210e763f80c7ea9ca0a1b Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Thu, 7 Jan 2021 10:50:25 +0100 Subject: [PATCH 3/7] Use majorMinorMatch, not full match --- lib/installer.js | 2 +- src/installer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/installer.js b/lib/installer.js index f50d3a2d..b9d734a6 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -135,7 +135,7 @@ function getDownloadURL(fileInfo, version, 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[0]}/${getNightlyFileName(arch)}`; + return `${baseURL}/${majorMinorMatches[1]}/${getNightlyFileName(arch)}`; } // nightlies if (version == 'nightly') { diff --git a/src/installer.ts b/src/installer.ts index 7fb9bba7..d09a858c 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -130,7 +130,7 @@ export function getDownloadURL(fileInfo, version: string, arch: string): string // 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[0]}/${getNightlyFileName(arch)}` + return `${baseURL}/${majorMinorMatches[1]}/${getNightlyFileName(arch)}` } // nightlies From eb3e183cec148ea0c9dd95f2e82a8e6a54993522 Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Thu, 7 Jan 2021 10:54:02 +0100 Subject: [PATCH 4/7] Replace more (in-)equality checks --- lib/installer.js | 2 +- src/installer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/installer.js b/lib/installer.js index b9d734a6..fb8b7616 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -152,7 +152,7 @@ function installJulia(versionInfo, version, arch) { core.debug(`downloading Julia from ${downloadURL}`); const juliaDownloadPath = yield tc.downloadTool(downloadURL); // Verify checksum - if (version != 'nightly') { + if (!version.endsWith('nightly')) { const checkSum = yield calculateChecksum(juliaDownloadPath); 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}`); diff --git a/src/installer.ts b/src/installer.ts index d09a858c..01a138f1 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -149,7 +149,7 @@ export async function installJulia(versionInfo, version: string, arch: string): const juliaDownloadPath = await tc.downloadTool(downloadURL) // Verify checksum - if (version != 'nightly') { + if (!version.endsWith('nightly')) { const checkSum = await calculateChecksum(juliaDownloadPath) 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}`) From 656b6381a572d98daa03da9fed2d8281c080f7e0 Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Thu, 7 Jan 2021 10:56:29 +0100 Subject: [PATCH 5/7] Reduce number of duplicate CI builds --- .github/workflows/example-builds-nightly.yml | 1 + .github/workflows/example-builds.yml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/example-builds-nightly.yml b/.github/workflows/example-builds-nightly.yml index f45ea340..623a9ac9 100644 --- a/.github/workflows/example-builds-nightly.yml +++ b/.github/workflows/example-builds-nightly.yml @@ -2,6 +2,7 @@ name: Example builds (nightly) on: push: + branches: ['main', 'master', 'releases/*'] pull_request: schedule: - cron: '37 17 * * *' diff --git a/.github/workflows/example-builds.yml b/.github/workflows/example-builds.yml index 2e4bc86e..50c73864 100644 --- a/.github/workflows/example-builds.yml +++ b/.github/workflows/example-builds.yml @@ -1,6 +1,9 @@ name: Example builds -on: [push, pull_request] +on: + push: + branches: ['main', 'master', 'releases/*'] + pull_request: jobs: test: From 79edd6d41faef3c918cdb13de4acc325933f8024 Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Thu, 7 Jan 2021 11:00:04 +0100 Subject: [PATCH 6/7] Add example to docs --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bd8a9706..a5ce6759 100644 --- a/README.md +++ b/README.md @@ -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 **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. +- `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). From 423eaa94293b38d6ad8f2a1372f6fb745106bb09 Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Thu, 7 Jan 2021 11:06:03 +0100 Subject: [PATCH 7/7] Tidy up nightly conditions --- lib/installer.js | 8 ++------ src/installer.ts | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/installer.js b/lib/installer.js index fb8b7616..5ca85811 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -78,12 +78,8 @@ function getJuliaVersions(versionInfo) { } exports.getJuliaVersions = getJuliaVersions; function getJuliaVersion(availableReleases, versionInput) { - if (semver.valid(versionInput) == versionInput) { - // versionInput is a valid version, use it directly - return versionInput; - } - // nightlies - if (versionInput.endsWith('nightly')) { + if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) { + // versionInput is a valid version or a nightly version, use it directly return versionInput; } // Use the highest available version that matches versionInput diff --git a/src/installer.ts b/src/installer.ts index 01a138f1..907bfd71 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -66,13 +66,8 @@ export async function getJuliaVersions(versionInfo): Promise { } export function getJuliaVersion(availableReleases: string[], versionInput: string): string { - if (semver.valid(versionInput) == versionInput) { - // versionInput is a valid version, use it directly - return versionInput - } - - // nightlies - if (versionInput.endsWith('nightly')) { + if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) { + // versionInput is a valid version or a nightly version, use it directly return versionInput }