mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-15 20:46:53 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a072d0b2e4 | ||
|
|
5f6d33bda5 | ||
|
|
2a0ae40f1c | ||
|
|
295f753b1e | ||
|
|
a7c1edc063 | ||
|
|
6f01df9c38 | ||
|
|
a8a77e20fd | ||
|
|
58832d0813 | ||
|
|
7ac67b152e | ||
|
|
c11753280f | ||
|
|
3ebbe69222 |
91
README.md
91
README.md
@@ -1,6 +1,14 @@
|
|||||||
# setup-julia Action
|
# setup-julia Action
|
||||||
|
|
||||||
This action sets up a Julia environment for use in actions by download a specified version of Julia and adding it to PATH.
|
This action sets up a Julia environment for use in actions by downloading a specified version of Julia and adding it to PATH.
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
- [Table of Contents](#table-of-contents)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Versioning](#versioning)
|
||||||
|
- [Future plans & ideas](#future-plans--ideas)
|
||||||
|
- [Words of caution](#words-of-caution)
|
||||||
|
- [Licence info](#licence-info)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -13,7 +21,7 @@ Take a look at [github.com/exercism/julia](https://github.com/exercism/julia/pul
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1.0.0
|
- uses: actions/checkout@v1.0.0
|
||||||
- uses: julia-actions/setup-julia@v0.1.0
|
- uses: julia-actions/setup-julia@v0.2
|
||||||
with:
|
with:
|
||||||
version: 1.0.4
|
version: 1.0.4
|
||||||
- run: julia -e 'println("Hello, World!")'
|
- run: julia -e 'println("Hello, World!")'
|
||||||
@@ -21,6 +29,8 @@ steps:
|
|||||||
|
|
||||||
### Matrix Testing:
|
### Matrix Testing:
|
||||||
|
|
||||||
|
#### 64-bit Julia only
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -33,12 +43,82 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1.0.0
|
- uses: actions/checkout@v1.0.0
|
||||||
- name: "Set up Julia"
|
- name: "Set up Julia"
|
||||||
uses: julia-actions/setup-julia@v0.1.0
|
uses: julia-actions/setup-julia@v0.2
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
- run: julia -e 'println("Hello, World!")'
|
- run: julia -e 'println("Hello, World!")'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 32-bit Julia
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
julia-version: [1.0.4, 1.1.1, 1.2.0-rc3, 1.3.0-alpha]
|
||||||
|
julia-arch: [x64, x86]
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
# 32-bit Julia binaries are not available on macOS
|
||||||
|
exclude:
|
||||||
|
- os: macOS-latest
|
||||||
|
julia-arch: x86
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1.0.0
|
||||||
|
- name: "Set up Julia"
|
||||||
|
uses: julia-actions/setup-julia@v0.2
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.julia-version }}
|
||||||
|
arch: ${{ matrix.julia-arch }}
|
||||||
|
- run: julia -e 'println("Hello, World!")'
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can include specific version and OS combinations that will use 32-bit Julia:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
julia-version: [1.0.4, 1.1.1, 1.2.0-rc3, 1.3.0-alpha]
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
# Additionally create a job using 32-bit Julia 1.0.4 on windows-latest
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
julia-version: [1.0.4]
|
||||||
|
julia-arch: x86
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1.0.0
|
||||||
|
- name: "Set up Julia"
|
||||||
|
uses: julia-actions/setup-julia@v0.2
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.julia-version }}
|
||||||
|
- run: julia -e 'println("Hello, World!")'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
This action follows [GitHub's advice](https://help.github.com/en/articles/about-actions#versioning-your-action) on versioning actions, with an additional `latest` tag.
|
||||||
|
|
||||||
|
If you don't want to deal with updating the version of the action, similiarly to how Travis CI handles it, use `latest` or major version branches.
|
||||||
|
|
||||||
|
It's unlikely, but not impossible, that there will be breaking changes post-v1.0.0 unless a new major version of Julia is introduced.
|
||||||
|
|
||||||
|
You can specify commits, branches or tags in your workflows as follows:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: julia-actions/setup-julia@6ae948d # commit SHA
|
||||||
|
- uses: julia-actions/setup-julia@master # branch
|
||||||
|
- uses: julia-actions/setup-julia@latest # latest version tag (may break existing workflows)
|
||||||
|
- uses: julia-actions/setup-julia@v1 # major version tag
|
||||||
|
- uses: julia-actions/setup-julia@v0.1.0 # specific version tag
|
||||||
|
```
|
||||||
|
|
||||||
## Future plans & ideas
|
## Future plans & ideas
|
||||||
|
|
||||||
In no particular order:
|
In no particular order:
|
||||||
@@ -47,9 +127,8 @@ In no particular order:
|
|||||||
* Check if a cached version of Julia is available instead of installing it everytime CI runs.
|
* Check if a cached version of Julia is available instead of installing it everytime CI runs.
|
||||||
* Add version shortcuts like `1.x`, `1.1.x`, `latest` and `lts`.
|
* Add version shortcuts like `1.x`, `1.1.x`, `latest` and `lts`.
|
||||||
* Add support for nightly Julia builds.
|
* Add support for nightly Julia builds.
|
||||||
* Support 32-bit Julia on 64-bit windows.
|
|
||||||
* Write some unit tests for the action.
|
* Write some unit tests for the action.
|
||||||
* Figure out the best way to handle versioning.
|
* Add CI script that checks if tags have been updated on release.
|
||||||
* Hash and signature checks.
|
* Hash and signature checks.
|
||||||
|
|
||||||
### Other Julia-related actions:
|
### Other Julia-related actions:
|
||||||
@@ -67,7 +146,7 @@ This action will likely be updated quite frequently in the near future. I'm shar
|
|||||||
|
|
||||||
**DO NOT USE THIS AS YOUR ONLY FORM OF CI** (yet).
|
**DO NOT USE THIS AS YOUR ONLY FORM OF CI** (yet).
|
||||||
|
|
||||||
Unfortunately, because non-container actions must use JavaScript/TypeScript as scripting language, `npm` is involved. The dependencies are vendored but this action relies 100% on GitHub to audit the dependencies they add to their action toolkit.
|
Unfortunately, because non-container actions must use JavaScript/TypeScript as scripting language, `npm` is involved. The published action only uses the toolkit-dependencies maintained by GitHub but, as usual with `npm`, these load over 50 transitive dependencies. If this causes issues with your security policies, you might want to fork the action, so that you can audit and lock exact versions of all direct and transitive dependencies.
|
||||||
|
|
||||||
## Licence info
|
## Licence info
|
||||||
Parts of this software have been derived from the `setup-go` [action](https://github.com/actions/setup-go) and the [JavaScript Action Template](https://github.com/actions/javascript-template), both released by GitHub under the MIT licence.
|
Parts of this software have been derived from the `setup-go` [action](https://github.com/actions/setup-go) and the [JavaScript Action Template](https://github.com/actions/javascript-template), both released by GitHub under the MIT licence.
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ inputs:
|
|||||||
version:
|
version:
|
||||||
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.0.4'
|
default: '1.0.4'
|
||||||
|
arch:
|
||||||
|
description: 'Architecture of the Julia binaries. Defaults to x64.'
|
||||||
|
required: false
|
||||||
|
default: 'x64'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/setup-julia.js'
|
main: 'lib/setup-julia.js'
|
||||||
|
|||||||
16
docs/release-checklist.md
Normal file
16
docs/release-checklist.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Release checklist
|
||||||
|
|
||||||
|
Version: `1.b.c`
|
||||||
|
|
||||||
|
- [x] Create release branch `releases/v1.b.c`
|
||||||
|
- [x] Unignore `node_modules/` by adding `!` in front in `.gitignore`
|
||||||
|
- [x] Delete `node_modules/`
|
||||||
|
- [x] Install production dependencies: `npm install --production`
|
||||||
|
- [x] Add `node_modules/`: `git add node_modules`
|
||||||
|
- [x] Commit & push action: `git commit -a -m "Publish v1.b.c."`, then `git push`
|
||||||
|
- [x] Test the action with an example package
|
||||||
|
- [x] Create tags
|
||||||
|
- [x] `v1.b.c` pointing at the last commit in `releases/v1.b.c`
|
||||||
|
- [x] `latest` pointing at the latest version of the highest major version
|
||||||
|
- [x] `v1` pointing at the latest `1.x.x` version
|
||||||
|
- [x] Push tags
|
||||||
@@ -26,39 +26,42 @@ core.debug(`platform: ${osPlat}`);
|
|||||||
function getMajorMinorVersion(version) {
|
function getMajorMinorVersion(version) {
|
||||||
return version.split('.').slice(0, 2).join('.');
|
return version.split('.').slice(0, 2).join('.');
|
||||||
}
|
}
|
||||||
function getDownloadURL(version) {
|
function getDownloadURL(version, arch) {
|
||||||
const baseURL = 'https://julialang-s3.julialang.org/bin';
|
const baseURL = 'https://julialang-s3.julialang.org/bin';
|
||||||
let platform, arch;
|
let platform;
|
||||||
const versionDir = getMajorMinorVersion(version);
|
const versionDir = getMajorMinorVersion(version);
|
||||||
if (osPlat === 'win32') { // Windows
|
if (osPlat === 'win32') { // Windows
|
||||||
platform = 'winnt';
|
platform = 'winnt';
|
||||||
arch = 'x64';
|
|
||||||
}
|
}
|
||||||
else if (osPlat === 'darwin') { // macOS
|
else if (osPlat === 'darwin') { // macOS
|
||||||
|
if (arch == 'x86') {
|
||||||
|
throw '32-bit Julia is not available on macOS';
|
||||||
|
}
|
||||||
platform = 'mac';
|
platform = 'mac';
|
||||||
arch = 'x64';
|
|
||||||
}
|
}
|
||||||
else if (osPlat === 'linux') { // Linux
|
else if (osPlat === 'linux') { // Linux
|
||||||
platform = 'linux';
|
platform = 'linux';
|
||||||
arch = 'x64';
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw `Platform ${osPlat} is not supported`;
|
throw `Platform ${osPlat} is not supported`;
|
||||||
}
|
}
|
||||||
return `${baseURL}/${platform}/${arch}/${versionDir}/${getFileName(version)}`;
|
return `${baseURL}/${platform}/${arch}/${versionDir}/${getFileName(version, arch)}`;
|
||||||
}
|
}
|
||||||
function getFileName(version) {
|
function getFileName(version, arch) {
|
||||||
let versionExt, ext;
|
let versionExt, ext;
|
||||||
if (osPlat === 'win32') { // Windows
|
if (osPlat === 'win32') { // Windows
|
||||||
versionExt = '-win64';
|
versionExt = arch == 'x64' ? '-win64' : '-win32';
|
||||||
ext = 'exe';
|
ext = 'exe';
|
||||||
}
|
}
|
||||||
else if (osPlat === 'darwin') { // macOS
|
else if (osPlat === 'darwin') { // macOS
|
||||||
|
if (arch == 'x86') {
|
||||||
|
throw '32-bit Julia is not available on macOS';
|
||||||
|
}
|
||||||
versionExt = '-mac64';
|
versionExt = '-mac64';
|
||||||
ext = 'dmg';
|
ext = 'dmg';
|
||||||
}
|
}
|
||||||
else if (osPlat === 'linux') { // Linux
|
else if (osPlat === 'linux') { // Linux
|
||||||
versionExt = '-linux-x86_64';
|
versionExt = arch == 'x64' ? '-linux-x86_64' : '-linux-i686';
|
||||||
ext = 'tar.gz';
|
ext = 'tar.gz';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -66,34 +69,50 @@ function getFileName(version) {
|
|||||||
}
|
}
|
||||||
return `julia-${version}${versionExt}.${ext}`;
|
return `julia-${version}${versionExt}.${ext}`;
|
||||||
}
|
}
|
||||||
|
function installJulia(version, arch) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Download Julia
|
||||||
|
const downloadURL = getDownloadURL(version, arch);
|
||||||
|
core.debug(`downloading Julia from ${downloadURL}`);
|
||||||
|
const juliaDownloadPath = yield tc.downloadTool(downloadURL);
|
||||||
|
// Install it
|
||||||
|
switch (osPlat) {
|
||||||
|
case 'linux':
|
||||||
|
const juliaExtractedFolder = yield tc.extractTar(juliaDownloadPath);
|
||||||
|
return path.join(juliaExtractedFolder, `julia-${version}`);
|
||||||
|
case 'win32':
|
||||||
|
const juliaInstallationPath = path.join('C:', 'Julia');
|
||||||
|
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||||
|
return juliaInstallationPath;
|
||||||
|
case 'darwin':
|
||||||
|
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
||||||
|
return `/Volumes/Julia-${version}/Julia-${getMajorMinorVersion(version)}.app/Contents/Resources/julia`;
|
||||||
|
default:
|
||||||
|
throw `Platform ${osPlat} is not supported`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const version = core.getInput('version');
|
const version = core.getInput('version');
|
||||||
core.debug(`selected Julia version: ${version}`);
|
const arch = core.getInput('arch');
|
||||||
// Download Julia
|
core.debug(`selected Julia version: ${arch}/${version}`);
|
||||||
const downloadURL = getDownloadURL(version);
|
// Search in cache
|
||||||
core.debug(`download Julia from ${downloadURL}`);
|
let juliaPath;
|
||||||
const juliaDownloadPath = yield tc.downloadTool(downloadURL);
|
juliaPath = tc.find('julia', version, arch);
|
||||||
// Install Julia
|
if (!juliaPath) {
|
||||||
if (osPlat === 'linux') { // Linux
|
core.debug(`could not find Julia ${version} in cache`);
|
||||||
const juliaExtractedFolder = yield tc.extractTar(juliaDownloadPath);
|
const juliaInstallationPath = yield installJulia(version, arch);
|
||||||
const juliaCachedPath = yield tc.cacheDir(juliaExtractedFolder, 'julia', version);
|
// Add it to cache
|
||||||
const juliaPath = path.join(juliaCachedPath, `julia-${version}`);
|
juliaPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version, arch);
|
||||||
core.addPath(path.join(juliaPath, 'bin'));
|
core.debug(`added Julia to cache: ${juliaPath}`);
|
||||||
}
|
}
|
||||||
else if (osPlat === 'win32') { // Windows
|
else {
|
||||||
// Install Julia in C:\Julia
|
core.debug(`using cached version of Julia: ${juliaPath}`);
|
||||||
const juliaInstallationPath = path.join('C:', 'Julia');
|
|
||||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
|
||||||
const juliaCachedPath = yield tc.cacheDir(juliaInstallationPath, 'julia', version);
|
|
||||||
core.addPath(path.join(juliaCachedPath, 'bin'));
|
|
||||||
}
|
|
||||||
else if (osPlat === 'darwin') { // macOS
|
|
||||||
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
|
||||||
const juliaCachedPath = yield tc.cacheDir(`/Volumes/Julia-${version}/Julia-${getMajorMinorVersion(version)}.app/Contents/Resources/julia`, 'julia', version);
|
|
||||||
core.addPath(path.join(juliaCachedPath, 'bin'));
|
|
||||||
}
|
}
|
||||||
|
// Add it to PATH
|
||||||
|
core.addPath(path.join(juliaPath, 'bin'));
|
||||||
// Test if Julia has been installed by showing versioninfo()
|
// Test if Julia has been installed by showing versioninfo()
|
||||||
yield exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()']);
|
yield exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,38 +13,41 @@ function getMajorMinorVersion(version: string): string {
|
|||||||
return version.split('.').slice(0, 2).join('.')
|
return version.split('.').slice(0, 2).join('.')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDownloadURL(version: string): string {
|
function getDownloadURL(version: string, arch: string): string {
|
||||||
const baseURL = 'https://julialang-s3.julialang.org/bin'
|
const baseURL = 'https://julialang-s3.julialang.org/bin'
|
||||||
let platform: string, arch: string
|
let platform: string
|
||||||
const versionDir = getMajorMinorVersion(version)
|
const versionDir = getMajorMinorVersion(version)
|
||||||
|
|
||||||
if (osPlat === 'win32') { // Windows
|
if (osPlat === 'win32') { // Windows
|
||||||
platform = 'winnt'
|
platform = 'winnt'
|
||||||
arch = 'x64'
|
|
||||||
} else if (osPlat === 'darwin') { // macOS
|
} else if (osPlat === 'darwin') { // macOS
|
||||||
|
if (arch == 'x86') {
|
||||||
|
throw '32-bit Julia is not available on macOS'
|
||||||
|
}
|
||||||
platform = 'mac'
|
platform = 'mac'
|
||||||
arch = 'x64'
|
|
||||||
} else if (osPlat === 'linux') { // Linux
|
} else if (osPlat === 'linux') { // Linux
|
||||||
platform = 'linux'
|
platform = 'linux'
|
||||||
arch = 'x64'
|
|
||||||
} else {
|
} else {
|
||||||
throw `Platform ${osPlat} is not supported`
|
throw `Platform ${osPlat} is not supported`
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${baseURL}/${platform}/${arch}/${versionDir}/${getFileName(version)}`
|
return `${baseURL}/${platform}/${arch}/${versionDir}/${getFileName(version, arch)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileName(version: string): string {
|
function getFileName(version: string, arch: string): string {
|
||||||
let versionExt: string, ext: string
|
let versionExt: string, ext: string
|
||||||
|
|
||||||
if (osPlat === 'win32') { // Windows
|
if (osPlat === 'win32') { // Windows
|
||||||
versionExt = '-win64'
|
versionExt = arch == 'x64' ? '-win64' : '-win32'
|
||||||
ext = 'exe'
|
ext = 'exe'
|
||||||
} else if (osPlat === 'darwin') { // macOS
|
} else if (osPlat === 'darwin') { // macOS
|
||||||
|
if (arch == 'x86') {
|
||||||
|
throw '32-bit Julia is not available on macOS'
|
||||||
|
}
|
||||||
versionExt = '-mac64'
|
versionExt = '-mac64'
|
||||||
ext = 'dmg'
|
ext = 'dmg'
|
||||||
} else if (osPlat === 'linux') { // Linux
|
} else if (osPlat === 'linux') { // Linux
|
||||||
versionExt = '-linux-x86_64'
|
versionExt = arch == 'x64' ? '-linux-x86_64' : '-linux-i686'
|
||||||
ext = 'tar.gz'
|
ext = 'tar.gz'
|
||||||
} else {
|
} else {
|
||||||
throw `Platform ${osPlat} is not supported`
|
throw `Platform ${osPlat} is not supported`
|
||||||
@@ -53,36 +56,53 @@ function getFileName(version: string): string {
|
|||||||
return `julia-${version}${versionExt}.${ext}`
|
return `julia-${version}${versionExt}.${ext}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function installJulia(version: string, arch: string): Promise<string> {
|
||||||
|
// Download Julia
|
||||||
|
const downloadURL = getDownloadURL(version, arch)
|
||||||
|
core.debug(`downloading Julia from ${downloadURL}`)
|
||||||
|
const juliaDownloadPath = await tc.downloadTool(downloadURL)
|
||||||
|
|
||||||
|
// Install it
|
||||||
|
switch (osPlat) {
|
||||||
|
case 'linux':
|
||||||
|
const juliaExtractedFolder = await tc.extractTar(juliaDownloadPath)
|
||||||
|
return path.join(juliaExtractedFolder, `julia-${version}`)
|
||||||
|
case 'win32':
|
||||||
|
const juliaInstallationPath = path.join('C:', 'Julia')
|
||||||
|
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
||||||
|
return juliaInstallationPath
|
||||||
|
case 'darwin':
|
||||||
|
await exec.exec('hdiutil', ['attach', juliaDownloadPath])
|
||||||
|
return `/Volumes/Julia-${version}/Julia-${getMajorMinorVersion(version)}.app/Contents/Resources/julia`
|
||||||
|
default:
|
||||||
|
throw `Platform ${osPlat} is not supported`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const version = core.getInput('version')
|
const version = core.getInput('version')
|
||||||
core.debug(`selected Julia version: ${version}`)
|
const arch = core.getInput('arch')
|
||||||
|
core.debug(`selected Julia version: ${arch}/${version}`)
|
||||||
|
|
||||||
// Download Julia
|
// Search in cache
|
||||||
const downloadURL = getDownloadURL(version)
|
let juliaPath: string;
|
||||||
core.debug(`download Julia from ${downloadURL}`)
|
juliaPath = tc.find('julia', version, arch)
|
||||||
const juliaDownloadPath = await tc.downloadTool(downloadURL)
|
|
||||||
|
|
||||||
// Install Julia
|
if (!juliaPath) {
|
||||||
if (osPlat === 'linux') { // Linux
|
core.debug(`could not find Julia ${version} in cache`)
|
||||||
const juliaExtractedFolder = await tc.extractTar(juliaDownloadPath)
|
const juliaInstallationPath = await installJulia(version, arch);
|
||||||
const juliaCachedPath = await tc.cacheDir(juliaExtractedFolder, 'julia', version)
|
|
||||||
const juliaPath = path.join(juliaCachedPath, `julia-${version}`)
|
// Add it to cache
|
||||||
core.addPath(path.join(juliaPath, 'bin'))
|
juliaPath = await tc.cacheDir(juliaInstallationPath, 'julia', version, arch)
|
||||||
|
core.debug(`added Julia to cache: ${juliaPath}`)
|
||||||
} else if (osPlat === 'win32') { // Windows
|
} else {
|
||||||
// Install Julia in C:\Julia
|
core.debug(`using cached version of Julia: ${juliaPath}`)
|
||||||
const juliaInstallationPath = path.join('C:', 'Julia')
|
|
||||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
|
||||||
const juliaCachedPath = await tc.cacheDir(juliaInstallationPath, 'julia', version)
|
|
||||||
core.addPath(path.join(juliaCachedPath, 'bin'))
|
|
||||||
|
|
||||||
} else if (osPlat === 'darwin') { // macOS
|
|
||||||
await exec.exec('hdiutil', ['attach', juliaDownloadPath])
|
|
||||||
const juliaCachedPath = await tc.cacheDir(`/Volumes/Julia-${version}/Julia-${getMajorMinorVersion(version)}.app/Contents/Resources/julia`, 'julia', version)
|
|
||||||
core.addPath(path.join(juliaCachedPath, 'bin'))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add it to PATH
|
||||||
|
core.addPath(path.join(juliaPath, 'bin'))
|
||||||
|
|
||||||
// Test if Julia has been installed by showing versioninfo()
|
// Test if Julia has been installed by showing versioninfo()
|
||||||
await exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()'])
|
await exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()'])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user