mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 11:06:53 +08:00
Compare commits
17 Commits
releases/v
...
v1.3.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dcc911681 | ||
|
|
82b1b42f54 | ||
|
|
3503abc570 | ||
|
|
def57cde21 | ||
|
|
c639390e13 | ||
|
|
b469b93959 | ||
|
|
d622e3db7b | ||
|
|
8aadcc1915 | ||
|
|
01ebb7f57a | ||
|
|
44bf6b3b7d | ||
|
|
b4e544c83e | ||
|
|
fc275221aa | ||
|
|
f7961d5fc8 | ||
|
|
19781e4bbc | ||
|
|
1b9230a354 | ||
|
|
a2cbd4a70f | ||
|
|
28af8fd3e2 |
6
.github/workflows/example-builds-nightly.yml
vendored
6
.github/workflows/example-builds-nightly.yml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '59 * * * *'
|
||||
- cron: '37 17 * * *'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -22,9 +22,6 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1.0.0
|
||||
|
||||
- name: "Debugging info"
|
||||
run: curl ifconfig.me
|
||||
|
||||
- name: "Install dependencies"
|
||||
run: |
|
||||
npm install
|
||||
@@ -36,4 +33,5 @@ jobs:
|
||||
with:
|
||||
version: nightly
|
||||
arch: ${{ matrix.julia-arch }}
|
||||
show-versioninfo: 'true'
|
||||
- run: julia --version
|
||||
|
||||
2
.github/workflows/example-builds.yml
vendored
2
.github/workflows/example-builds.yml
vendored
@@ -26,8 +26,10 @@ jobs:
|
||||
npm run pack
|
||||
|
||||
- name: "Set up Julia"
|
||||
id: setup-julia
|
||||
uses: ./
|
||||
with:
|
||||
version: ${{ matrix.julia-version }}
|
||||
arch: ${{ matrix.julia-arch }}
|
||||
show-versioninfo: 'true'
|
||||
- run: julia --version
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
node_modules/
|
||||
__tests__/runner/*
|
||||
dist/
|
||||
!dist/
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "bin"]
|
||||
path = bin
|
||||
url = git@github.com:julia-actions/bin.git
|
||||
@@ -11,7 +11,7 @@ This action sets up a Julia environment for use in actions by downloading a spec
|
||||
- [Julia Versions](#julia-versions)
|
||||
- [Matrix Testing](#matrix-testing)
|
||||
- [Versioning](#versioning)
|
||||
- [Privacy Info](#privacy-info)
|
||||
- [Debug logs](#debug-logs)
|
||||
- [Third party information](#third-party-information)
|
||||
|
||||
## Usage
|
||||
@@ -150,6 +150,11 @@ steps:
|
||||
- uses: julia-actions/setup-julia@v0.1.0 # specific version tag
|
||||
```
|
||||
|
||||
## Debug logs
|
||||
|
||||
You can enable [Step Debug Logs](https://github.com/actions/toolkit/blob/main/docs/action-debugging.md#step-debug-logs) for more detailed logs.
|
||||
Note that when debug logs are enabled, a request will be sent to `https://httpbin.julialang.org/ip` and the runner's IP will be printed to the debug logs.
|
||||
|
||||
## Third party information
|
||||
Parts of this software have been derived from other open source software.
|
||||
See [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md) for details.
|
||||
|
||||
@@ -13,6 +13,9 @@ inputs:
|
||||
description: 'Display InteractiveUtils.versioninfo() after installing'
|
||||
required: 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:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
|
||||
1
bin
Submodule
1
bin
Submodule
Submodule bin added at 9ceca17c9c
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
branch_name="$(git symbolic-ref --short -q HEAD)"
|
||||
version="v$(jq -r .version package.json)"
|
||||
repo="$1"
|
||||
|
||||
if [ -z "$repo" ]; then
|
||||
echo "ERROR: must specify repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== debug info ==="
|
||||
echo "branch: $branch_name"
|
||||
echo "version: $version"
|
||||
echo "repo: $repo"
|
||||
echo "=================="
|
||||
echo ""
|
||||
|
||||
# Check that the version doesn't exist yet
|
||||
version_exists="$(curl -s https://api.github.com/repos/"$repo"/tags -H "Accept: application/vnd.github.v3.full+json" | jq -r '.[] | select(.name == "'"$version"'") | .name')"
|
||||
if [ -n "$version_exists" ]; then
|
||||
echo "ERROR: version $version already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git checkout -b releases/"$version"
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
npm test
|
||||
npm run pack
|
||||
|
||||
sed -i 's/dist/!dist/g' .gitignore
|
||||
git add dist
|
||||
git commit -a -m "Add production dependencies & build"
|
||||
|
||||
# Tags
|
||||
major_minor="$(sed 's/\.[^.]*$//' <<< "$version")"
|
||||
major="$(sed 's/\.[^.]*$//' <<< "$major_minor")"
|
||||
|
||||
git tag "$version"
|
||||
git tag -f "$major_minor"
|
||||
git tag -f "$major"
|
||||
git tag -f "latest"
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
branch_name="$(git symbolic-ref --short -q HEAD)"
|
||||
version="v$(jq -r .version package.json)"
|
||||
repo="$1"
|
||||
|
||||
if [ -z "$repo" ]; then
|
||||
echo "ERROR: must specify repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== debug info ==="
|
||||
echo "branch: $branch_name"
|
||||
echo "version: $version"
|
||||
echo "repo: $repo"
|
||||
echo "=================="
|
||||
echo ""
|
||||
|
||||
# Check that the version doesn't exist yet
|
||||
version_exists="$(curl -s https://api.github.com/repos/"$repo"/tags -H "Accept: application/vnd.github.v3.full+json" | jq -r '.[] | select(.name == "'"$version"'") | .name')"
|
||||
if [ -n "$version_exists" ]; then
|
||||
echo "ERROR: version $version already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git checkout -B test/"$branch_name"/releases/"$version"
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
npm test
|
||||
npm run pack
|
||||
|
||||
# Add dist/ to git and commit it
|
||||
sed -i 's/dist/!dist/g' .gitignore
|
||||
git add dist
|
||||
git commit -a -m "Add production dependencies & build"
|
||||
4748
dist/index.js
vendored
Normal file
4748
dist/index.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
dist/unzip
vendored
Normal file
BIN
dist/unzip
vendored
Normal file
Binary file not shown.
21
lib/installer.js
generated
21
lib/installer.js
generated
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const semver = __importStar(require("semver"));
|
||||
@@ -25,7 +26,7 @@ const semver = __importStar(require("semver"));
|
||||
const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS)
|
||||
core.debug(`platform: ${osPlat}`);
|
||||
// This is temporary until we have a better way of fetching releases (see #1, #4 for details)
|
||||
exports.juliaVersions = ['v1.5.0-rc2', 'v1.5.0-rc1', 'v1.5.0-beta1', 'v1.4.2', 'v1.4.1', 'v1.4.0', 'v1.4.0-rc2', 'v1.4.0-rc1', 'v1.3.1', 'v1.3.0', 'v1.3.0-rc5', 'v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0', 'v0.7.0', 'v1.0.0-rc1', 'v0.7.0-rc3', 'v0.7.0-rc2', 'v0.7.0-rc1', 'v0.7.0-beta2', 'v0.6.4', 'v0.7.0-beta', 'v0.7.0-alpha', 'v0.6.3', 'v0.6.2', 'v0.6.1', 'v0.6.0', 'v0.6.0-rc3', 'v0.6.0-rc2', 'v0.5.2', 'v0.6.0-rc1', 'v0.6.0-pre.beta', 'v0.5.1', 'v0.6.0-pre.alpha', 'v0.5.0', 'v0.4.7', 'v0.5.0-rc4', 'v0.5.0-rc3', 'v0.5.0-rc2', 'v0.5.0-rc1', 'v0.5.0-rc0', 'v0.4.6', 'v0.4.5', 'v0.4.4', 'v0.4.3', 'v0.4.2', 'v0.4.1', 'v0.3.12', 'v0.4.0', 'v0.4.0-rc4', 'v0.4.0-rc3', 'v0.4.0-rc2', 'v0.4.0-rc1', 'v0.3.11', 'v0.3.10', 'v0.3.9', 'v0.3.8', 'v0.3.7', 'v0.3.6', 'v0.3.5', 'v0.3.4', 'v0.3.3', 'v0.3.2', 'v0.3.1', 'v0.3.0', 'v0.3.0-rc4', 'v0.3.0-rc3', 'v0.3.0-rc2', 'v0.3.0-rc1', 'v0.2.0-rc1', 'v0.2.0-rc3', 'v0.2.0-rc4', 'v0.2.0', 'v0.2.0-rc2'];
|
||||
exports.juliaVersions = ['v1.5.2', 'v1.5.1', 'v1.5.0', 'v1.5.0-rc2', 'v1.5.0-rc1', 'v1.5.0-beta1', 'v1.4.2', 'v1.4.1', 'v1.4.0', 'v1.4.0-rc2', 'v1.4.0-rc1', 'v1.3.1', 'v1.3.0', 'v1.3.0-rc5', 'v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0', 'v0.7.0', 'v1.0.0-rc1', 'v0.7.0-rc3', 'v0.7.0-rc2', 'v0.7.0-rc1', 'v0.7.0-beta2', 'v0.6.4', 'v0.7.0-beta', 'v0.7.0-alpha', 'v0.6.3', 'v0.6.2', 'v0.6.1', 'v0.6.0', 'v0.6.0-rc3', 'v0.6.0-rc2', 'v0.5.2', 'v0.6.0-rc1', 'v0.6.0-pre.beta', 'v0.5.1', 'v0.6.0-pre.alpha', 'v0.5.0', 'v0.4.7', 'v0.5.0-rc4', 'v0.5.0-rc3', 'v0.5.0-rc2', 'v0.5.0-rc1', 'v0.5.0-rc0', 'v0.4.6', 'v0.4.5', 'v0.4.4', 'v0.4.3', 'v0.4.2', 'v0.4.1', 'v0.3.12', 'v0.4.0', 'v0.4.0-rc4', 'v0.4.0-rc3', 'v0.4.0-rc2', 'v0.4.0-rc1', 'v0.3.11', 'v0.3.10', 'v0.3.9', 'v0.3.8', 'v0.3.7', 'v0.3.6', 'v0.3.5', 'v0.3.4', 'v0.3.3', 'v0.3.2', 'v0.3.1', 'v0.3.0', 'v0.3.0-rc4', 'v0.3.0-rc3', 'v0.3.0-rc2', 'v0.3.0-rc1', 'v0.2.0-rc1', 'v0.2.0-rc3', 'v0.2.0-rc4', 'v0.2.0', 'v0.2.0-rc2'];
|
||||
function getJuliaVersion(availableReleases, versionInput) {
|
||||
if (semver.valid(versionInput) == versionInput) {
|
||||
// versionInput is a valid version, use it directly
|
||||
@@ -108,28 +109,26 @@ function installJulia(version, arch) {
|
||||
const downloadURL = getDownloadURL(version, arch);
|
||||
core.debug(`downloading Julia from ${downloadURL}`);
|
||||
const juliaDownloadPath = yield tc.downloadTool(downloadURL);
|
||||
const tempInstallDir = fs.mkdtempSync(`julia-${arch}-${version}-`);
|
||||
// Install it
|
||||
switch (osPlat) {
|
||||
case 'linux':
|
||||
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
||||
yield exec.exec('mkdir', [`${process.env.HOME}/julia`]);
|
||||
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', `${process.env.HOME}/julia`]);
|
||||
return `${process.env.HOME}/julia`;
|
||||
yield exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir]);
|
||||
return tempInstallDir;
|
||||
case 'win32':
|
||||
const juliaInstallationPath = path.join('C:', 'Julia');
|
||||
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
|
||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]);
|
||||
}
|
||||
else {
|
||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`]);
|
||||
}
|
||||
return juliaInstallationPath;
|
||||
return tempInstallDir;
|
||||
case 'darwin':
|
||||
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
||||
yield exec.exec('mkdir', [`${process.env.HOME}/julia`]);
|
||||
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`]);
|
||||
return `${process.env.HOME}/julia`;
|
||||
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`]);
|
||||
return path.join(tempInstallDir, 'julia');
|
||||
default:
|
||||
throw new Error(`Platform ${osPlat} is not supported`);
|
||||
}
|
||||
|
||||
21
lib/setup-julia.js
generated
21
lib/setup-julia.js
generated
@@ -18,11 +18,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const https = __importStar(require("https"));
|
||||
const path = __importStar(require("path"));
|
||||
const installer = __importStar(require("./installer"));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
// Debugging info
|
||||
if (core.isDebug()) {
|
||||
// Log Runner IP Address
|
||||
https.get('https://httpbin.julialang.org/ip', resp => {
|
||||
let data = '';
|
||||
resp.on('data', chunk => {
|
||||
data += chunk;
|
||||
});
|
||||
resp.on('end', () => {
|
||||
core.debug(`Runner IP address: ${JSON.parse(data).origin}`);
|
||||
});
|
||||
}).on('error', err => {
|
||||
core.debug(`ERROR: Could not retrieve runner IP: ${err}`);
|
||||
});
|
||||
}
|
||||
// Inputs
|
||||
const versionInput = core.getInput('version');
|
||||
const arch = core.getInput('arch');
|
||||
@@ -49,12 +66,16 @@ function run() {
|
||||
// Add it to cache
|
||||
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version, arch);
|
||||
core.debug(`added Julia to cache: ${juliaPath}`);
|
||||
// Remove temporary dir
|
||||
fs.rmdirSync(juliaInstallationPath, { recursive: true });
|
||||
}
|
||||
else {
|
||||
core.debug(`using cached version of Julia: ${juliaPath}`);
|
||||
}
|
||||
// Add it to PATH
|
||||
core.addPath(path.join(juliaPath, 'bin'));
|
||||
// Set output
|
||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'));
|
||||
// Test if Julia has been installed
|
||||
exec.exec('julia', ['--version']);
|
||||
// If enabled, also show the full version info
|
||||
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "setup-julia",
|
||||
"version": "1.1.11",
|
||||
"version": "1.3.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz",
|
||||
"integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA=="
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
||||
},
|
||||
"@actions/exec": {
|
||||
"version": "1.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-julia",
|
||||
"version": "1.1.11",
|
||||
"version": "1.3.1",
|
||||
"private": true,
|
||||
"description": "setup Julia action",
|
||||
"main": "lib/setup-julia.js",
|
||||
@@ -21,7 +21,7 @@
|
||||
"author": "Sascha Mann <git@mail.saschamann.eu>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.0.0",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/io": "^1.0.0",
|
||||
"@actions/tool-cache": "^1.0.0",
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
|
||||
import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
|
||||
@@ -12,7 +13,7 @@ const osPlat = os.platform() // possible values: win32 (Windows), linux (Linux),
|
||||
core.debug(`platform: ${osPlat}`)
|
||||
|
||||
// This is temporary until we have a better way of fetching releases (see #1, #4 for details)
|
||||
export const juliaVersions = ['v1.5.0-rc2', 'v1.5.0-rc1', 'v1.5.0-beta1', 'v1.4.2', 'v1.4.1', 'v1.4.0', 'v1.4.0-rc2', 'v1.4.0-rc1', 'v1.3.1', 'v1.3.0', 'v1.3.0-rc5', 'v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0', 'v0.7.0', 'v1.0.0-rc1', 'v0.7.0-rc3', 'v0.7.0-rc2', 'v0.7.0-rc1', 'v0.7.0-beta2', 'v0.6.4', 'v0.7.0-beta', 'v0.7.0-alpha', 'v0.6.3', 'v0.6.2', 'v0.6.1', 'v0.6.0', 'v0.6.0-rc3', 'v0.6.0-rc2', 'v0.5.2', 'v0.6.0-rc1', 'v0.6.0-pre.beta', 'v0.5.1', 'v0.6.0-pre.alpha', 'v0.5.0', 'v0.4.7', 'v0.5.0-rc4', 'v0.5.0-rc3', 'v0.5.0-rc2', 'v0.5.0-rc1', 'v0.5.0-rc0', 'v0.4.6', 'v0.4.5', 'v0.4.4', 'v0.4.3', 'v0.4.2', 'v0.4.1', 'v0.3.12', 'v0.4.0', 'v0.4.0-rc4', 'v0.4.0-rc3', 'v0.4.0-rc2', 'v0.4.0-rc1', 'v0.3.11', 'v0.3.10', 'v0.3.9', 'v0.3.8', 'v0.3.7', 'v0.3.6', 'v0.3.5', 'v0.3.4', 'v0.3.3', 'v0.3.2', 'v0.3.1', 'v0.3.0', 'v0.3.0-rc4', 'v0.3.0-rc3', 'v0.3.0-rc2', 'v0.3.0-rc1', 'v0.2.0-rc1', 'v0.2.0-rc3', 'v0.2.0-rc4', 'v0.2.0', 'v0.2.0-rc2']
|
||||
export const juliaVersions = ['v1.5.2', 'v1.5.1', 'v1.5.0', 'v1.5.0-rc2', 'v1.5.0-rc1', 'v1.5.0-beta1', 'v1.4.2', 'v1.4.1', 'v1.4.0', 'v1.4.0-rc2', 'v1.4.0-rc1', 'v1.3.1', 'v1.3.0', 'v1.3.0-rc5', 'v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0', 'v0.7.0', 'v1.0.0-rc1', 'v0.7.0-rc3', 'v0.7.0-rc2', 'v0.7.0-rc1', 'v0.7.0-beta2', 'v0.6.4', 'v0.7.0-beta', 'v0.7.0-alpha', 'v0.6.3', 'v0.6.2', 'v0.6.1', 'v0.6.0', 'v0.6.0-rc3', 'v0.6.0-rc2', 'v0.5.2', 'v0.6.0-rc1', 'v0.6.0-pre.beta', 'v0.5.1', 'v0.6.0-pre.alpha', 'v0.5.0', 'v0.4.7', 'v0.5.0-rc4', 'v0.5.0-rc3', 'v0.5.0-rc2', 'v0.5.0-rc1', 'v0.5.0-rc0', 'v0.4.6', 'v0.4.5', 'v0.4.4', 'v0.4.3', 'v0.4.2', 'v0.4.1', 'v0.3.12', 'v0.4.0', 'v0.4.0-rc4', 'v0.4.0-rc3', 'v0.4.0-rc2', 'v0.4.0-rc1', 'v0.3.11', 'v0.3.10', 'v0.3.9', 'v0.3.8', 'v0.3.7', 'v0.3.6', 'v0.3.5', 'v0.3.4', 'v0.3.3', 'v0.3.2', 'v0.3.1', 'v0.3.0', 'v0.3.0-rc4', 'v0.3.0-rc3', 'v0.3.0-rc2', 'v0.3.0-rc1', 'v0.2.0-rc1', 'v0.2.0-rc3', 'v0.2.0-rc4', 'v0.2.0', 'v0.2.0-rc2']
|
||||
|
||||
export function getJuliaVersion(availableReleases: string[], versionInput: string): string {
|
||||
if (semver.valid(versionInput) == versionInput) {
|
||||
@@ -102,27 +103,26 @@ export async function installJulia(version: string, arch: string): Promise<strin
|
||||
core.debug(`downloading Julia from ${downloadURL}`)
|
||||
const juliaDownloadPath = await tc.downloadTool(downloadURL)
|
||||
|
||||
const tempInstallDir = fs.mkdtempSync(`julia-${arch}-${version}-`)
|
||||
|
||||
// Install it
|
||||
switch (osPlat) {
|
||||
case 'linux':
|
||||
// tc.extractTar doesn't support stripping components, so we have to call tar manually
|
||||
await exec.exec('mkdir', [`${process.env.HOME}/julia`])
|
||||
await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', `${process.env.HOME}/julia`])
|
||||
return `${process.env.HOME}/julia`
|
||||
await exec.exec('tar', ['xf', juliaDownloadPath, '--strip-components=1', '-C', tempInstallDir])
|
||||
return tempInstallDir
|
||||
case 'win32':
|
||||
const juliaInstallationPath = path.join('C:', 'Julia')
|
||||
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
|
||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`])
|
||||
} else {
|
||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${path.join(process.cwd(), tempInstallDir)}" -NoNewWindow -Wait`])
|
||||
}
|
||||
return juliaInstallationPath
|
||||
return tempInstallDir
|
||||
case 'darwin':
|
||||
await exec.exec('hdiutil', ['attach', juliaDownloadPath])
|
||||
await exec.exec('mkdir', [`${process.env.HOME}/julia`])
|
||||
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`])
|
||||
return `${process.env.HOME}/julia`
|
||||
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`])
|
||||
return path.join(tempInstallDir, 'julia')
|
||||
default:
|
||||
throw new Error(`Platform ${osPlat} is not supported`)
|
||||
}
|
||||
|
||||
@@ -2,12 +2,32 @@ import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
|
||||
import * as fs from 'fs'
|
||||
import * as https from 'https'
|
||||
import * as path from 'path'
|
||||
|
||||
import * as installer from './installer'
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
// Debugging info
|
||||
if (core.isDebug()) {
|
||||
// Log Runner IP Address
|
||||
https.get('https://httpbin.julialang.org/ip', resp => {
|
||||
let data = ''
|
||||
|
||||
resp.on('data', chunk => {
|
||||
data += chunk
|
||||
})
|
||||
|
||||
resp.on('end', () => {
|
||||
core.debug(`Runner IP address: ${JSON.parse(data).origin}`)
|
||||
})
|
||||
}).on('error', err => {
|
||||
core.debug(`ERROR: Could not retrieve runner IP: ${err}`)
|
||||
})
|
||||
}
|
||||
|
||||
// Inputs
|
||||
const versionInput = core.getInput('version')
|
||||
const arch = core.getInput('arch')
|
||||
@@ -39,12 +59,18 @@ async function run() {
|
||||
// Add it to cache
|
||||
juliaPath = await tc.cacheDir(juliaInstallationPath, 'julia', version, arch)
|
||||
core.debug(`added Julia to cache: ${juliaPath}`)
|
||||
|
||||
// Remove temporary dir
|
||||
fs.rmdirSync(juliaInstallationPath, {recursive: true})
|
||||
} else {
|
||||
core.debug(`using cached version of Julia: ${juliaPath}`)
|
||||
}
|
||||
|
||||
// Add it to PATH
|
||||
core.addPath(path.join(juliaPath, 'bin'))
|
||||
|
||||
// Set output
|
||||
core.setOutput('julia-bindir', path.join(juliaPath, 'bin'))
|
||||
|
||||
// Test if Julia has been installed
|
||||
exec.exec('julia', ['--version'])
|
||||
|
||||
Reference in New Issue
Block a user