Compare commits

...

16 Commits

Author SHA1 Message Date
Sascha Mann
e802804276 Add production dependencies & build 2022-10-13 15:46:23 +02:00
Sascha Mann
43c4e31075 Update @actions/core (#125)
* Update @actions/core

* Run npm i
2022-10-13 15:45:44 +02:00
dependabot[bot]
2bfca2816f Bump @actions/core from 1.2.6 to 1.9.1 (#118)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.6 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-12 16:38:20 -04:00
Sascha Mann
87fafcc1ec Bump version 2022-08-10 14:57:53 +02:00
Dilum Aluthge
57ce80e73c macOS: Default to tarball (.tar.gz) if available (#117)
* On macOS, first try to find a tarball (`.tar.gz`) file, but fall back to `.dmg` if we can't find a tarball

* Add an "Example builds" job for Julia 1.2
2022-08-10 14:54:47 +02:00
Sascha Mann
ffea8bb089 Bump version 2022-06-25 09:28:02 +02:00
Dilum Aluthge
3a89763b86 Fix the "default arch" code path with Julia nightly (and add a CI job for that code path) (#115) 2022-06-25 09:26:39 +02:00
Sascha Mann
40f50bc31f Bump version 2022-06-24 14:44:52 +02:00
Dilum Aluthge
8474f0e14d Default to ${{ runner.arch }} instead of to x64 (#114)
* If the user does not specify the `arch` input, default to `${{ runner.arch }}` (instead of defaulting to `x64`)

* Add a CI workflow that tests the default arch (i.e. tests what happens when the user does not specify the `arch` input)
2022-06-24 14:39:02 +02:00
Dilum Aluthge
76f26cb710 Document the architecture synonyms (#113) 2022-06-23 23:04:54 +00:00
Dilum Aluthge
40ab89a96a Allow X64 and X86 as synonyms for x64 and x86, respectively (#108) 2022-06-23 22:26:05 +00:00
Dilum Aluthge
631e68d88a Allow ARM64 as a synonym for aarch64 (#110) 2022-06-23 20:00:43 +02:00
Sascha Mann
a07a9b4c49 Use --legacy-peer-deps to avoid npm bullshit (#112) 2022-06-20 18:34:11 -04:00
Sascha Mann
67db496725 Update default runtime to node16 (#103)
EOL was almost a month ago. Woops.

I don't care about people using an old version of GitHub Enterprise, so I'm not going to annoy every single user of this action with a breaking update like GH did with their core actions. If you're a user of GHE: consider this a breaking update.
2022-05-21 22:10:35 +02:00
Sascha Mann
800ff44572 Bump version 2022-05-21 21:52:30 +02:00
Sascha Mann
6966335537 Add support for aarch64 (#102)
Setting the `arch` input to `aarch64` will install `aarch64` binaries,
intended to be used on aarch64-based self-hosted runners.

Please note that we currently don't run test builds on that
architecture, so we cannot guarantee that the input won't break
randomly, although there is no reason why it would.

In a future update, we may choose a default architecture based on the
arch of the runner.

Thanks to @giordano for providing a self-hosted runner for testing.

Co-authored-by: Mosè Giordano <mose@gnu.org>
2022-05-21 21:50:58 +02:00
18 changed files with 7891 additions and 54 deletions

View File

@@ -9,6 +9,7 @@ on:
jobs: jobs:
backup: backup:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 60
steps: steps:
- name: Configure cache - name: Configure cache

View File

@@ -1,14 +1,21 @@
name: "PR Checks" name: "PR Checks"
on: [pull_request, push] on: [pull_request, push]
concurrency:
# Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs: jobs:
check_pr: check_pr:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: "npm ci" - name: "npm ci"
run: npm ci run: npm ci --legacy-peer-deps
- name: "npm run build" - name: "npm run build"
run: npm run build run: npm run build

View File

@@ -11,6 +11,12 @@
# #
name: "CodeQL" name: "CodeQL"
concurrency:
# Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
on: on:
push: push:
branches: [ master, releases/* ] branches: [ master, releases/* ]
@@ -24,6 +30,7 @@ jobs:
analyze: analyze:
name: Analyze name: Analyze
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60
strategy: strategy:
fail-fast: false fail-fast: false

View File

@@ -0,0 +1,40 @@
name: Example builds (default arch)
concurrency:
# Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
on:
push:
branches: ['main', 'master', 'releases/*']
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
julia-version: ['1']
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v1.0.0
- name: "Install dependencies"
run: |
npm install --legacy-peer-deps
npm run build
npm run pack
- name: "Set up Julia"
id: setup-julia
uses: ./
with:
version: ${{ matrix.julia-version }}
- run: julia --version
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'

View File

@@ -0,0 +1,38 @@
name: Example builds (nightly, default arch)
concurrency:
# Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
on:
push:
branches: ['main', 'master', 'releases/*']
pull_request:
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
julia-version: [nightly, 1.8-nightly]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v1.0.0
- name: "Install dependencies"
run: |
npm install --legacy-peer-deps
npm run build
npm run pack
- name: "Set up Julia (${{ matrix.julia-version }})"
uses: ./
with:
version: ${{ matrix.julia-version }}
- run: julia --version
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'

View File

@@ -1,5 +1,11 @@
name: Example builds (nightly) name: Example builds (nightly)
concurrency:
# Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
on: on:
push: push:
branches: ['main', 'master', 'releases/*'] branches: ['main', 'master', 'releases/*']
@@ -10,6 +16,7 @@ on:
jobs: jobs:
test: test:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -20,13 +27,13 @@ jobs:
exclude: exclude:
- os: macOS-latest - os: macOS-latest
julia-arch: x86 julia-arch: x86
steps: steps:
- uses: actions/checkout@v1.0.0 - uses: actions/checkout@v1.0.0
- name: "Install dependencies" - name: "Install dependencies"
run: | run: |
npm install npm install --legacy-peer-deps
npm run build npm run build
npm run pack npm run pack

View File

@@ -1,5 +1,11 @@
name: Example builds name: Example builds
concurrency:
# Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
on: on:
push: push:
branches: ['main', 'master', 'releases/*'] branches: ['main', 'master', 'releases/*']
@@ -9,23 +15,24 @@ on:
jobs: jobs:
test: test:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
julia-version: ['1.0.5', '1', '^1.5.0-beta1'] julia-version: ['1.0.5', '1.2', '^1.5.0-beta1', '1']
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
exclude: exclude:
- os: macOS-latest - os: macOS-latest
julia-arch: x86 julia-arch: x86
steps: steps:
- uses: actions/checkout@v1.0.0 - uses: actions/checkout@v1.0.0
- name: "Install dependencies" - name: "Install dependencies"
run: | run: |
npm install npm install --legacy-peer-deps
npm run build npm run build
npm run pack npm run pack

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
node_modules/ node_modules/
__tests__/runner/* __tests__/runner/*
dist/ !dist/

View File

@@ -38,9 +38,15 @@ This action sets up a Julia environment for use in actions by downloading a spec
# The architecture of the Julia binaries. # The architecture of the Julia binaries.
# #
# Supported values: x64 | x86 # Please note that installing aarch64 binaries only makes sense on self-hosted aarch64 runners.
# We currently don't run test builds on that architecture, so we cannot guarantee that the input won't break randomly,
# although there is no reason why it would.
# #
# Default: x64 # Supported values: x64 | x86 | aarch64 (untested)
#
# Note: you can use X64, X86, and ARM64 as synonyms for x64, x86, and aarch64, respectively.
#
# Defaults to the architecture of the runner executing the job.
arch: '' arch: ''
# Set the display setting for printing InteractiveUtils.versioninfo() after installing. # Set the display setting for printing InteractiveUtils.versioninfo() after installing.
@@ -123,7 +129,7 @@ jobs:
matrix: matrix:
julia-version: ['1.0', '1.2.0', '^1.3.0-rc1'] julia-version: ['1.0', '1.2.0', '^1.3.0-rc1']
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
steps: steps:
- uses: actions/checkout@v1.0.0 - uses: actions/checkout@v1.0.0
- name: "Set up Julia" - name: "Set up Julia"
@@ -149,7 +155,7 @@ jobs:
exclude: exclude:
- os: macOS-latest - os: macOS-latest
julia-arch: x86 julia-arch: x86
steps: steps:
- uses: actions/checkout@v1.0.0 - uses: actions/checkout@v1.0.0
- name: "Set up Julia" - name: "Set up Julia"
@@ -176,7 +182,7 @@ jobs:
- os: windows-latest - os: windows-latest
julia-version: ['1.0.4'] julia-version: ['1.0.4']
julia-arch: x86 julia-arch: x86
steps: steps:
- uses: actions/checkout@v1.0.0 - uses: actions/checkout@v1.0.0
- name: "Set up Julia" - name: "Set up Julia"

View File

@@ -6,9 +6,9 @@ inputs:
description: 'The Julia version to download (if necessary) and use. Example: 1.0.4' description: 'The Julia version to download (if necessary) and use. Example: 1.0.4'
default: '1' default: '1'
arch: arch:
description: 'Architecture of the Julia binaries. Defaults to x64.' description: 'Architecture of the Julia binaries. Defaults to the architecture of the runner executing the job.'
required: false required: false
default: 'x64' default: '${{ runner.arch }}'
show-versioninfo: show-versioninfo:
description: 'Display InteractiveUtils.versioninfo() after installing' description: 'Display InteractiveUtils.versioninfo() after installing'
required: false required: false
@@ -19,7 +19,7 @@ outputs:
julia-bindir: 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' 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: 'node16'
main: 'dist/index.js' main: 'dist/index.js'
branding: branding:
icon: 'download' icon: 'download'

7554
dist/index.js vendored Normal file

File diff suppressed because it is too large Load Diff

BIN
dist/unzip vendored Normal file

Binary file not shown.

68
lib/installer.js generated
View File

@@ -32,7 +32,8 @@ const osMap = {
}; };
const archMap = { const archMap = {
'x86': 'i686', 'x86': 'i686',
'x64': 'x86_64' 'x64': 'x86_64',
'aarch64': 'aarch64'
}; };
// Store information about the environment // Store information about the environment
const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS) const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS)
@@ -101,30 +102,57 @@ function getJuliaVersion(availableReleases, versionInput) {
return version; return version;
} }
exports.getJuliaVersion = getJuliaVersion; exports.getJuliaVersion = getJuliaVersion;
function getDesiredFileExts() {
let fileExt1;
let hasFileExt2;
let fileExt2;
if (osPlat == 'win32') {
fileExt1 = 'exe';
hasFileExt2 = false;
fileExt2 = '';
}
else if (osPlat == 'darwin') {
fileExt1 = 'tar.gz';
hasFileExt2 = true;
fileExt2 = 'dmg';
}
else if (osPlat === 'linux') {
fileExt1 = 'tar.gz';
hasFileExt2 = false;
fileExt2 = '';
}
else {
throw new Error(`Platform ${osPlat} is not supported`);
}
return [fileExt1, hasFileExt2, fileExt2];
}
function getNightlyFileName(arch) { function getNightlyFileName(arch) {
let versionExt, ext; let versionExt;
let fileExt1;
[fileExt1, ,] = getDesiredFileExts();
if (osPlat == 'win32') { if (osPlat == 'win32') {
versionExt = arch == 'x64' ? '-win64' : '-win32'; versionExt = arch == 'x64' ? '-win64' : '-win32';
ext = 'exe';
} }
else if (osPlat == 'darwin') { else if (osPlat == 'darwin') {
if (arch == 'x86') { if (arch == 'x86') {
throw new Error('32-bit Julia is not available on macOS'); throw new Error('32-bit Julia is not available on macOS');
} }
versionExt = '-mac64'; versionExt = '-mac64';
ext = 'dmg';
} }
else if (osPlat === 'linux') { else if (osPlat === 'linux') {
versionExt = arch == 'x64' ? '-linux64' : '-linux32'; versionExt = arch == 'x64' ? '-linux64' : '-linux32';
ext = 'tar.gz';
} }
else { else {
throw new Error(`Platform ${osPlat} is not supported`); throw new Error(`Platform ${osPlat} is not supported`);
} }
return `julia-latest${versionExt}.${ext}`; return `julia-latest${versionExt}.${fileExt1}`;
} }
function getFileInfo(versionInfo, version, arch) { function getFileInfo(versionInfo, version, arch) {
const err = `Could not find ${archMap[arch]}/${version} binaries`; const err = `Could not find ${archMap[arch]}/${version} binaries`;
let fileExt1;
let hasFileExt2;
let fileExt2;
[fileExt1, hasFileExt2, fileExt2] = getDesiredFileExts();
if (version.endsWith('nightly')) { if (version.endsWith('nightly')) {
return null; return null;
} }
@@ -133,7 +161,19 @@ function getFileInfo(versionInfo, version, arch) {
} }
for (let file of versionInfo[version].files) { for (let file of versionInfo[version].files) {
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) { if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
return file; if (file.extension == fileExt1) {
return file;
}
}
}
if (hasFileExt2) {
core.debug(`Could not find ${fileExt1}; trying to find ${fileExt2} instead`);
for (let file of versionInfo[version].files) {
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
if (file.extension == fileExt2) {
return file;
}
}
} }
} }
throw err; throw err;
@@ -200,9 +240,17 @@ function installJulia(versionInfo, version, arch) {
} }
return tempInstallDir; return tempInstallDir;
case 'darwin': case 'darwin':
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]); if (fileInfo !== null && fileInfo.extension == 'dmg') {
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`]); core.debug(`Support for .dmg files is deprecated and may be removed in a future release`);
return path.join(tempInstallDir, 'julia'); yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`]);
return path.join(tempInstallDir, 'julia');
}
else {
// 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]);
return tempInstallDir;
}
default: default:
throw new Error(`Platform ${osPlat} is not supported`); throw new Error(`Platform ${osPlat} is not supported`);
} }

13
lib/setup-julia.js generated
View File

@@ -21,6 +21,14 @@ 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"));
const archSynonyms = {
'x86': 'x86',
'X86': 'x86',
'x64': 'x64',
'X64': 'x64',
'aarch64': 'aarch64',
'ARM64': 'aarch64'
};
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
@@ -41,7 +49,7 @@ function run() {
} }
// Inputs // Inputs
const versionInput = core.getInput('version'); const versionInput = core.getInput('version');
const arch = core.getInput('arch'); const originalArchInput = core.getInput('arch');
// It can easily happen that, for example, a workflow file contains an input `version: ${{ matrix.julia-version }}` // It can easily happen that, for example, a workflow file contains an input `version: ${{ matrix.julia-version }}`
// while the strategy matrix only contains a key `${{ matrix.version }}`. // while the strategy matrix only contains a key `${{ matrix.version }}`.
// In that case, we want the action to fail, rather than trying to download julia from an URL that's missing parts and 404ing. // In that case, we want the action to fail, rather than trying to download julia from an URL that's missing parts and 404ing.
@@ -50,9 +58,10 @@ function run() {
if (!versionInput) { if (!versionInput) {
throw new Error('Version input must not be null'); throw new Error('Version input must not be null');
} }
if (!arch) { if (!originalArchInput) {
throw new Error(`Arch input must not be null`); throw new Error(`Arch input must not be null`);
} }
const arch = archSynonyms[originalArchInput];
const versionInfo = yield installer.getJuliaVersionInfo(); const versionInfo = yield installer.getJuliaVersionInfo();
const availableReleases = yield installer.getJuliaVersions(versionInfo); const availableReleases = yield installer.getJuliaVersions(versionInfo);
const version = installer.getJuliaVersion(availableReleases, versionInput); const version = installer.getJuliaVersion(availableReleases, versionInput);

76
package-lock.json generated
View File

@@ -1,14 +1,15 @@
{ {
"name": "setup-julia", "name": "setup-julia",
"version": "1.6.1", "version": "1.8.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "1.6.1", "name": "setup-julia",
"version": "1.8.3",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.10.0",
"@actions/exec": "^1.0.0", "@actions/exec": "^1.0.0",
"@actions/io": "^1.0.0", "@actions/io": "^1.0.0",
"@actions/tool-cache": "^1.0.0", "@actions/tool-cache": "^1.0.0",
@@ -30,15 +31,43 @@
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "1.2.6", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"dependencies": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"node_modules/@actions/core/node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
}, },
"node_modules/@actions/exec": { "node_modules/@actions/exec": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz",
"integrity": "sha512-nquH0+XKng+Ll7rZfCojN7NWSbnGh+ltwUJhzfbLkmOJgxocGX2/yXcZLMyT9fa7+tByEow/NSTrBExNlEj9fw==" "integrity": "sha512-nquH0+XKng+Ll7rZfCojN7NWSbnGh+ltwUJhzfbLkmOJgxocGX2/yXcZLMyT9fa7+tByEow/NSTrBExNlEj9fw=="
}, },
"node_modules/@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"dependencies": {
"tunnel": "^0.0.6"
}
},
"node_modules/@actions/http-client/node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/@actions/io": { "node_modules/@actions/io": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.0.tgz",
@@ -8493,15 +8522,41 @@
}, },
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.2.6", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"requires": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
},
"dependencies": {
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
}, },
"@actions/exec": { "@actions/exec": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz",
"integrity": "sha512-nquH0+XKng+Ll7rZfCojN7NWSbnGh+ltwUJhzfbLkmOJgxocGX2/yXcZLMyT9fa7+tByEow/NSTrBExNlEj9fw==" "integrity": "sha512-nquH0+XKng+Ll7rZfCojN7NWSbnGh+ltwUJhzfbLkmOJgxocGX2/yXcZLMyT9fa7+tByEow/NSTrBExNlEj9fw=="
}, },
"@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"requires": {
"tunnel": "^0.0.6"
},
"dependencies": {
"tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
}
}
},
"@actions/io": { "@actions/io": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.0.tgz",
@@ -12926,8 +12981,7 @@
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz",
"integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==", "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==",
"dev": true, "dev": true
"requires": {}
}, },
"jest-regex-util": { "jest-regex-util": {
"version": "24.3.0", "version": "24.3.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "setup-julia", "name": "setup-julia",
"version": "1.6.1", "version": "1.8.3",
"private": true, "private": true,
"description": "setup Julia action", "description": "setup Julia action",
"main": "lib/setup-julia.js", "main": "lib/setup-julia.js",
@@ -21,7 +21,7 @@
"author": "Sascha Mann <git@mail.saschamann.eu>", "author": "Sascha Mann <git@mail.saschamann.eu>",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.10.0",
"@actions/exec": "^1.0.0", "@actions/exec": "^1.0.0",
"@actions/io": "^1.0.0", "@actions/io": "^1.0.0",
"@actions/tool-cache": "^1.0.0", "@actions/tool-cache": "^1.0.0",

View File

@@ -18,7 +18,8 @@ const osMap = {
} }
const archMap = { const archMap = {
'x86': 'i686', 'x86': 'i686',
'x64': 'x86_64' 'x64': 'x86_64',
'aarch64': 'aarch64'
} }
// Store information about the environment // Store information about the environment
@@ -92,31 +93,59 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin
return version return version
} }
function getDesiredFileExts(): [string, boolean, string] {
let fileExt1: string
let hasFileExt2: boolean
let fileExt2: string
if (osPlat == 'win32') {
fileExt1 = 'exe'
hasFileExt2 = false
fileExt2 = ''
} else if (osPlat == 'darwin') {
fileExt1 = 'tar.gz'
hasFileExt2 = true
fileExt2 = 'dmg'
} else if (osPlat === 'linux') {
fileExt1 = 'tar.gz'
hasFileExt2 = false
fileExt2 = ''
} else {
throw new Error(`Platform ${osPlat} is not supported`)
}
return [fileExt1, hasFileExt2, fileExt2]
}
function getNightlyFileName(arch: string): string { function getNightlyFileName(arch: string): string {
let versionExt: string, ext: string let versionExt: string
let fileExt1: string
[fileExt1, , ] = getDesiredFileExts()
if (osPlat == 'win32') { if (osPlat == 'win32') {
versionExt = arch == 'x64' ? '-win64' : '-win32' versionExt = arch == 'x64' ? '-win64' : '-win32'
ext = 'exe'
} else if (osPlat == 'darwin') { } else if (osPlat == 'darwin') {
if (arch == 'x86') { if (arch == 'x86') {
throw new Error('32-bit Julia is not available on macOS') throw new Error('32-bit Julia is not available on macOS')
} }
versionExt = '-mac64' versionExt = '-mac64'
ext = 'dmg'
} else if (osPlat === 'linux') { } else if (osPlat === 'linux') {
versionExt = arch == 'x64' ? '-linux64' : '-linux32' versionExt = arch == 'x64' ? '-linux64' : '-linux32'
ext = 'tar.gz'
} else { } else {
throw new Error(`Platform ${osPlat} is not supported`) throw new Error(`Platform ${osPlat} is not supported`)
} }
return `julia-latest${versionExt}.${ext}` return `julia-latest${versionExt}.${fileExt1}`
} }
export function getFileInfo(versionInfo, version: string, arch: string) { export function getFileInfo(versionInfo, version: string, arch: string) {
const err = `Could not find ${archMap[arch]}/${version} binaries` const err = `Could not find ${archMap[arch]}/${version} binaries`
let fileExt1: string
let hasFileExt2: boolean
let fileExt2: string
[fileExt1, hasFileExt2, fileExt2] = getDesiredFileExts()
if (version.endsWith('nightly')) { if (version.endsWith('nightly')) {
return null return null
} }
@@ -127,7 +156,20 @@ export function getFileInfo(versionInfo, version: string, arch: string) {
for (let file of versionInfo[version].files) { for (let file of versionInfo[version].files) {
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) { if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
return file if (file.extension == fileExt1) {
return file
}
}
}
if (hasFileExt2) {
core.debug(`Could not find ${fileExt1}; trying to find ${fileExt2} instead`)
for (let file of versionInfo[version].files) {
if (file.os == osMap[osPlat] && file.arch == archMap[arch]) {
if (file.extension == fileExt2) {
return file
}
}
} }
} }
@@ -171,7 +213,6 @@ export async function installJulia(versionInfo, version: string, arch: string):
} }
}) })
// Verify checksum // Verify checksum
if (!version.endsWith('nightly')) { if (!version.endsWith('nightly')) {
const checkSum = await calculateChecksum(juliaDownloadPath) const checkSum = await calculateChecksum(juliaDownloadPath)
@@ -200,9 +241,16 @@ export async function installJulia(versionInfo, version: string, arch: string):
} }
return tempInstallDir return tempInstallDir
case 'darwin': case 'darwin':
await exec.exec('hdiutil', ['attach', juliaDownloadPath]) if (fileInfo !== null && fileInfo.extension == 'dmg') {
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`]) core.debug(`Support for .dmg files is deprecated and may be removed in a future release`)
return path.join(tempInstallDir, 'julia') await exec.exec('hdiutil', ['attach', juliaDownloadPath])
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${tempInstallDir}`])
return path.join(tempInstallDir, 'julia')
} else {
// 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])
return tempInstallDir
}
default: default:
throw new Error(`Platform ${osPlat} is not supported`) throw new Error(`Platform ${osPlat} is not supported`)
} }

View File

@@ -8,6 +8,15 @@ import * as path from 'path'
import * as installer from './installer' import * as installer from './installer'
const archSynonyms = {
'x86': 'x86',
'X86': 'x86',
'x64': 'x64',
'X64': 'x64',
'aarch64': 'aarch64',
'ARM64': 'aarch64'
}
async function run() { async function run() {
try { try {
// Debugging info // Debugging info
@@ -30,7 +39,7 @@ async function run() {
// Inputs // Inputs
const versionInput = core.getInput('version') const versionInput = core.getInput('version')
const arch = core.getInput('arch') const originalArchInput = core.getInput('arch')
// It can easily happen that, for example, a workflow file contains an input `version: ${{ matrix.julia-version }}` // It can easily happen that, for example, a workflow file contains an input `version: ${{ matrix.julia-version }}`
// while the strategy matrix only contains a key `${{ matrix.version }}`. // while the strategy matrix only contains a key `${{ matrix.version }}`.
@@ -40,10 +49,12 @@ async function run() {
if (!versionInput) { if (!versionInput) {
throw new Error('Version input must not be null') throw new Error('Version input must not be null')
} }
if (!arch) { if (!originalArchInput) {
throw new Error(`Arch input must not be null`) throw new Error(`Arch input must not be null`)
} }
const arch = archSynonyms[originalArchInput]
const versionInfo = await installer.getJuliaVersionInfo() const versionInfo = await installer.getJuliaVersionInfo()
const availableReleases = await installer.getJuliaVersions(versionInfo) const availableReleases = await installer.getJuliaVersions(versionInfo)
const version = installer.getJuliaVersion(availableReleases, versionInput) const version = installer.getJuliaVersion(availableReleases, versionInput)