mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-16 04:56:53 +08:00
Compare commits
1 Commits
v1.5.2
...
SaschaMann
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
175aa3a1b8 |
6
.github/workflows/example-builds-nightly.yml
vendored
6
.github/workflows/example-builds-nightly.yml
vendored
@@ -2,7 +2,6 @@ name: Example builds (nightly)
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ['main', 'master', 'releases/*']
|
|
||||||
pull_request:
|
pull_request:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '37 17 * * *'
|
- cron: '37 17 * * *'
|
||||||
@@ -13,7 +12,6 @@ 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
|
||||||
@@ -30,10 +28,10 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
npm run pack
|
npm run pack
|
||||||
|
|
||||||
- name: "Set up Julia (${{ matrix.julia-version }})"
|
- name: "Set up Julia (nightly)"
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: nightly
|
||||||
arch: ${{ matrix.julia-arch }}
|
arch: ${{ matrix.julia-arch }}
|
||||||
show-versioninfo: 'true'
|
show-versioninfo: 'true'
|
||||||
- run: julia --version
|
- run: julia --version
|
||||||
|
|||||||
9
.github/workflows/example-builds.yml
vendored
9
.github/workflows/example-builds.yml
vendored
@@ -1,9 +1,6 @@
|
|||||||
name: Example builds
|
name: Example builds
|
||||||
|
|
||||||
on:
|
on: [push, pull_request]
|
||||||
push:
|
|
||||||
branches: ['main', 'master', 'releases/*']
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -36,3 +33,7 @@ jobs:
|
|||||||
arch: ${{ matrix.julia-arch }}
|
arch: ${{ matrix.julia-arch }}
|
||||||
show-versioninfo: 'true'
|
show-versioninfo: 'true'
|
||||||
- run: julia --version
|
- run: julia --version
|
||||||
|
- run: time julia --compile=min -O0 -e 'using InteractiveUtils; versioninfo()'
|
||||||
|
shell: bash
|
||||||
|
- run: time julia -e 'using InteractiveUtils; versioninfo()'
|
||||||
|
shell: bash
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
!dist/
|
dist/
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ 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).
|
||||||
|
|
||||||
|
|||||||
4803
dist/index.js
vendored
4803
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
BIN
dist/unzip
vendored
BIN
dist/unzip
vendored
Binary file not shown.
23
lib/installer.js
generated
23
lib/installer.js
generated
@@ -78,10 +78,14 @@ function getJuliaVersions(versionInfo) {
|
|||||||
}
|
}
|
||||||
exports.getJuliaVersions = getJuliaVersions;
|
exports.getJuliaVersions = getJuliaVersions;
|
||||||
function getJuliaVersion(availableReleases, versionInput) {
|
function getJuliaVersion(availableReleases, versionInput) {
|
||||||
if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) {
|
if (semver.valid(versionInput) == versionInput) {
|
||||||
// versionInput is a valid version or a nightly version, use it directly
|
// versionInput is a valid 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) {
|
||||||
@@ -115,7 +119,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.endsWith('nightly')) {
|
if (version == 'nightly') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (let file of versionInfo[version].files) {
|
for (let file of versionInfo[version].files) {
|
||||||
@@ -127,15 +131,10 @@ 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') {
|
||||||
return `${baseURL}/${getNightlyFileName(arch)}`;
|
const baseURL = 'https://julialangnightlies-s3.julialang.org/bin';
|
||||||
|
return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`;
|
||||||
}
|
}
|
||||||
return fileInfo.url;
|
return fileInfo.url;
|
||||||
}
|
}
|
||||||
@@ -148,7 +147,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.endsWith('nightly')) {
|
if (version != '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}`);
|
||||||
@@ -166,7 +165,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.endsWith('nightly') || semver.gtr(version, '1.3', { includePrerelease: true })) {
|
if (version == '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`]);
|
||||||
}
|
}
|
||||||
|
|||||||
12
lib/setup-julia.js
generated
12
lib/setup-julia.js
generated
@@ -78,15 +78,11 @@ function run() {
|
|||||||
core.addPath(path.join(juliaPath, 'bin'));
|
core.addPath(path.join(juliaPath, 'bin'));
|
||||||
// Set output
|
// Set output
|
||||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
||||||
// Test if Julia has been installed and print the version
|
// Test if Julia has been installed
|
||||||
|
exec.exec('julia', ['--version']);
|
||||||
|
// If enabled, also show the full version info
|
||||||
if (core.getInput('show-versioninfo') == 'true') {
|
if (core.getInput('show-versioninfo') == 'true') {
|
||||||
// If enabled, show the full version info
|
exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()']);
|
||||||
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
|
||||||
exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Otherwise only print julia --version to save time
|
|
||||||
exec.exec('julia', ['--version']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "1.5.2",
|
"version": "1.5.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "1.5.2",
|
"version": "1.5.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup Julia action",
|
"description": "setup Julia action",
|
||||||
"main": "lib/setup-julia.js",
|
"main": "lib/setup-julia.js",
|
||||||
|
|||||||
@@ -66,11 +66,16 @@ 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 || versionInput.endsWith('nightly')) {
|
if (semver.valid(versionInput) == versionInput) {
|
||||||
// versionInput is a valid version or a nightly version, use it directly
|
// versionInput is a valid 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) {
|
||||||
@@ -106,7 +111,7 @@ function getNightlyFileName(arch: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getFileInfo(versionInfo, version: string, arch: string) {
|
export function getFileInfo(versionInfo, version: string, arch: string) {
|
||||||
if (version.endsWith('nightly')) {
|
if (version == 'nightly') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,17 +125,10 @@ 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') {
|
||||||
return `${baseURL}/${getNightlyFileName(arch)}`
|
const baseURL = 'https://julialangnightlies-s3.julialang.org/bin'
|
||||||
|
return `${baseURL}/${osMap[osPlat]}/${arch}/${getNightlyFileName(arch)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileInfo.url
|
return fileInfo.url
|
||||||
@@ -144,7 +142,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.endsWith('nightly')) {
|
if (version != '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}`)
|
||||||
@@ -163,7 +161,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.endsWith('nightly') || semver.gtr(version, '1.3', {includePrerelease: true})) {
|
if (version == '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 {
|
||||||
|
|||||||
@@ -73,15 +73,13 @@ async function run() {
|
|||||||
|
|
||||||
// Set output
|
// Set output
|
||||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))
|
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))
|
||||||
|
|
||||||
|
// Test if Julia has been installed
|
||||||
|
exec.exec('julia', ['--version'])
|
||||||
|
|
||||||
// Test if Julia has been installed and print the version
|
// If enabled, also show the full version info
|
||||||
if (core.getInput('show-versioninfo') == 'true') {
|
if (core.getInput('show-versioninfo') == 'true') {
|
||||||
// If enabled, show the full version info
|
exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()'])
|
||||||
// --compile=min -O0 reduces the time from ~1.8-1.9s to ~0.8-0.9s
|
|
||||||
exec.exec('julia', ['--compile=min', '-O0', '-e', 'using InteractiveUtils; versioninfo()'])
|
|
||||||
} else {
|
|
||||||
// Otherwise only print julia --version to save time
|
|
||||||
exec.exec('julia', ['--version'])
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
|
|||||||
Reference in New Issue
Block a user