mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-15 20:46:53 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4469f5b9da |
1
.github/workflows/example-builds-nightly.yml
vendored
1
.github/workflows/example-builds-nightly.yml
vendored
@@ -33,5 +33,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: nightly
|
version: nightly
|
||||||
arch: ${{ matrix.julia-arch }}
|
arch: ${{ matrix.julia-arch }}
|
||||||
show-versioninfo: 'true'
|
|
||||||
- run: julia --version
|
- run: julia --version
|
||||||
|
|||||||
2
.github/workflows/example-builds.yml
vendored
2
.github/workflows/example-builds.yml
vendored
@@ -26,10 +26,8 @@ jobs:
|
|||||||
npm run pack
|
npm run pack
|
||||||
|
|
||||||
- name: "Set up Julia"
|
- name: "Set up Julia"
|
||||||
id: setup-julia
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
arch: ${{ matrix.julia-arch }}
|
arch: ${{ matrix.julia-arch }}
|
||||||
show-versioninfo: 'true'
|
|
||||||
- run: julia --version
|
- run: julia --version
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ inputs:
|
|||||||
description: 'Display InteractiveUtils.versioninfo() after installing'
|
description: 'Display InteractiveUtils.versioninfo() after installing'
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
outputs:
|
|
||||||
julia-bindir:
|
|
||||||
description: 'Path to the directory containing the Julia executable. Equivalent to JULIA_BINDIR: https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_BINDIR'
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
24
dist/index.js
vendored
24
dist/index.js
vendored
@@ -3904,7 +3904,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
const tc = __importStar(__webpack_require__(533));
|
const tc = __importStar(__webpack_require__(533));
|
||||||
const fs = __importStar(__webpack_require__(747));
|
|
||||||
const https = __importStar(__webpack_require__(211));
|
const https = __importStar(__webpack_require__(211));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const installer = __importStar(__webpack_require__(749));
|
const installer = __importStar(__webpack_require__(749));
|
||||||
@@ -3952,16 +3951,12 @@ function run() {
|
|||||||
// Add it to cache
|
// Add it to cache
|
||||||
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version, arch);
|
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version, arch);
|
||||||
core.debug(`added Julia to cache: ${juliaPath}`);
|
core.debug(`added Julia to cache: ${juliaPath}`);
|
||||||
// Remove temporary dir
|
|
||||||
fs.rmdirSync(juliaInstallationPath, { recursive: true });
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.debug(`using cached version of Julia: ${juliaPath}`);
|
core.debug(`using cached version of Julia: ${juliaPath}`);
|
||||||
}
|
}
|
||||||
// Add it to PATH
|
// Add it to PATH
|
||||||
core.addPath(path.join(juliaPath, 'bin'));
|
core.addPath(path.join(juliaPath, 'bin'));
|
||||||
// Set output
|
|
||||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
|
||||||
// Test if Julia has been installed
|
// Test if Julia has been installed
|
||||||
exec.exec('julia', ['--version']);
|
exec.exec('julia', ['--version']);
|
||||||
// If enabled, also show the full version info
|
// If enabled, also show the full version info
|
||||||
@@ -4010,7 +4005,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
const tc = __importStar(__webpack_require__(533));
|
const tc = __importStar(__webpack_require__(533));
|
||||||
const fs = __importStar(__webpack_require__(747));
|
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const semver = __importStar(__webpack_require__(280));
|
const semver = __importStar(__webpack_require__(280));
|
||||||
@@ -4101,26 +4095,28 @@ function installJulia(version, arch) {
|
|||||||
const downloadURL = getDownloadURL(version, arch);
|
const downloadURL = getDownloadURL(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);
|
||||||
const tempInstallDir = fs.mkdtempSync(`julia-${arch}-${version}-`);
|
|
||||||
// Install it
|
// Install it
|
||||||
switch (osPlat) {
|
switch (osPlat) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
||||||
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]);
|
yield exec.exec('mkdir', [`${process.env.HOME}/julia`]);
|
||||||
return tempInstallDir;
|
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', `${process.env.HOME}/julia`]);
|
||||||
|
return `${process.env.HOME}/julia`;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
const juliaInstallationPath = path.join('C:', 'Julia');
|
||||||
if (version == '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=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]);
|
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||||
}
|
}
|
||||||
return tempInstallDir;
|
return juliaInstallationPath;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
||||||
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`]);
|
yield exec.exec('mkdir', [`${process.env.HOME}/julia`]);
|
||||||
return path.join(tempInstallDir, 'julia');
|
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`]);
|
||||||
|
return `${process.env.HOME}/julia`;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Platform ${osPlat} is not supported`);
|
throw new Error(`Platform ${osPlat} is not supported`);
|
||||||
}
|
}
|
||||||
|
|||||||
19
lib/installer.js
generated
19
lib/installer.js
generated
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
const tc = __importStar(require("@actions/tool-cache"));
|
const tc = __importStar(require("@actions/tool-cache"));
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
@@ -109,26 +108,28 @@ function installJulia(version, arch) {
|
|||||||
const downloadURL = getDownloadURL(version, arch);
|
const downloadURL = getDownloadURL(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);
|
||||||
const tempInstallDir = fs.mkdtempSync(`julia-${arch}-${version}-`);
|
|
||||||
// Install it
|
// Install it
|
||||||
switch (osPlat) {
|
switch (osPlat) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
||||||
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]);
|
yield exec.exec('mkdir', [`${process.env.HOME}/julia`]);
|
||||||
return tempInstallDir;
|
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', `${process.env.HOME}/julia`]);
|
||||||
|
return `${process.env.HOME}/julia`;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
const juliaInstallationPath = path.join('C:', 'Julia');
|
||||||
if (version == '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=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]);
|
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||||
}
|
}
|
||||||
return tempInstallDir;
|
return juliaInstallationPath;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
||||||
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`]);
|
yield exec.exec('mkdir', [`${process.env.HOME}/julia`]);
|
||||||
return path.join(tempInstallDir, 'julia');
|
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`]);
|
||||||
|
return `${process.env.HOME}/julia`;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Platform ${osPlat} is not supported`);
|
throw new Error(`Platform ${osPlat} is not supported`);
|
||||||
}
|
}
|
||||||
|
|||||||
5
lib/setup-julia.js
generated
5
lib/setup-julia.js
generated
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
const tc = __importStar(require("@actions/tool-cache"));
|
const tc = __importStar(require("@actions/tool-cache"));
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const https = __importStar(require("https"));
|
const https = __importStar(require("https"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const installer = __importStar(require("./installer"));
|
const installer = __importStar(require("./installer"));
|
||||||
@@ -66,16 +65,12 @@ function run() {
|
|||||||
// Add it to cache
|
// Add it to cache
|
||||||
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version, arch);
|
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version, arch);
|
||||||
core.debug(`added Julia to cache: ${juliaPath}`);
|
core.debug(`added Julia to cache: ${juliaPath}`);
|
||||||
// Remove temporary dir
|
|
||||||
fs.rmdirSync(juliaInstallationPath, { recursive: true });
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.debug(`using cached version of Julia: ${juliaPath}`);
|
core.debug(`using cached version of Julia: ${juliaPath}`);
|
||||||
}
|
}
|
||||||
// Add it to PATH
|
// Add it to PATH
|
||||||
core.addPath(path.join(juliaPath, 'bin'));
|
core.addPath(path.join(juliaPath, 'bin'));
|
||||||
// Set output
|
|
||||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
|
||||||
// Test if Julia has been installed
|
// Test if Julia has been installed
|
||||||
exec.exec('julia', ['--version']);
|
exec.exec('julia', ['--version']);
|
||||||
// If enabled, also show the full version info
|
// If enabled, also show the full version info
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "1.3.0",
|
"version": "1.2.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "1.3.0",
|
"version": "1.2.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup Julia action",
|
"description": "setup Julia action",
|
||||||
"main": "lib/setup-julia.js",
|
"main": "lib/setup-julia.js",
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import * as core from '@actions/core'
|
|||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import * as tc from '@actions/tool-cache'
|
import * as tc from '@actions/tool-cache'
|
||||||
|
|
||||||
import * as fs from 'fs'
|
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
@@ -103,26 +102,27 @@ export async function installJulia(version: string, arch: string): Promise<strin
|
|||||||
core.debug(`downloading Julia from ${downloadURL}`)
|
core.debug(`downloading Julia from ${downloadURL}`)
|
||||||
const juliaDownloadPath = await tc.downloadTool(downloadURL)
|
const juliaDownloadPath = await tc.downloadTool(downloadURL)
|
||||||
|
|
||||||
const tempInstallDir = fs.mkdtempSync(`julia-${arch}-${version}-`)
|
|
||||||
|
|
||||||
// Install it
|
// Install it
|
||||||
switch (osPlat) {
|
switch (osPlat) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
||||||
await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir])
|
await exec.exec('mkdir', [`${process.env.HOME}/julia`])
|
||||||
return tempInstallDir
|
await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', `${process.env.HOME}/julia`])
|
||||||
|
return `${process.env.HOME}/julia`
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
const juliaInstallationPath = path.join('C:', 'Julia')
|
||||||
if (version == '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=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
||||||
} else {
|
} else {
|
||||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`])
|
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
||||||
}
|
}
|
||||||
return tempInstallDir
|
return juliaInstallationPath
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
await exec.exec('hdiutil', ['attach', juliaDownloadPath])
|
await exec.exec('hdiutil', ['attach', juliaDownloadPath])
|
||||||
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`])
|
await exec.exec('mkdir', [`${process.env.HOME}/julia`])
|
||||||
return path.join(tempInstallDir, 'julia')
|
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`])
|
||||||
|
return `${process.env.HOME}/julia`
|
||||||
default:
|
default:
|
||||||
throw new Error(`Platform ${osPlat} is not supported`)
|
throw new Error(`Platform ${osPlat} is not supported`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import * as core from '@actions/core'
|
|||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import * as tc from '@actions/tool-cache'
|
import * as tc from '@actions/tool-cache'
|
||||||
|
|
||||||
import * as fs from 'fs'
|
|
||||||
import * as https from 'https'
|
import * as https from 'https'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
@@ -59,18 +58,12 @@ async function run() {
|
|||||||
// Add it to cache
|
// Add it to cache
|
||||||
juliaPath = await tc.cacheDir(juliaInstallationPath, 'julia', version, arch)
|
juliaPath = await tc.cacheDir(juliaInstallationPath, 'julia', version, arch)
|
||||||
core.debug(`added Julia to cache: ${juliaPath}`)
|
core.debug(`added Julia to cache: ${juliaPath}`)
|
||||||
|
|
||||||
// Remove temporary dir
|
|
||||||
fs.rmdirSync(juliaInstallationPath, {recursive: true})
|
|
||||||
} else {
|
} else {
|
||||||
core.debug(`using cached version of Julia: ${juliaPath}`)
|
core.debug(`using cached version of Julia: ${juliaPath}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add it to PATH
|
// Add it to PATH
|
||||||
core.addPath(path.join(juliaPath, 'bin'))
|
core.addPath(path.join(juliaPath, 'bin'))
|
||||||
|
|
||||||
// Set output
|
|
||||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))
|
|
||||||
|
|
||||||
// Test if Julia has been installed
|
// Test if Julia has been installed
|
||||||
exec.exec('julia', ['--version'])
|
exec.exec('julia', ['--version'])
|
||||||
|
|||||||
Reference in New Issue
Block a user