mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-14 03:56:53 +08:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fac69f5780 | ||
|
|
ead3831d7a | ||
|
|
8945494c8c | ||
|
|
a81735fc3d | ||
|
|
2c2ccf4805 | ||
|
|
0352b39425 | ||
|
|
5ed1ab9531 | ||
|
|
b440227ef4 | ||
|
|
e07eb0ff2a | ||
|
|
0c24e24eb5 | ||
|
|
abd4c5ae03 | ||
|
|
51f7dbcff0 | ||
|
|
06264a4b68 | ||
|
|
8f56a5b739 | ||
|
|
83f4f82909 | ||
|
|
eba5daa7a3 | ||
|
|
150b180e77 | ||
|
|
df27cccb6d | ||
|
|
4e8b9a1f06 | ||
|
|
960c1f45ca | ||
|
|
ca58c641a5 | ||
|
|
6c0c21977e | ||
|
|
6a79c57a32 | ||
|
|
2efcc69643 | ||
|
|
d8b4778b2d |
36
.github/workflows/example-builds-nightly.yml
vendored
Normal file
36
.github/workflows/example-builds-nightly.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Example builds (nightly)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 3 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
julia-arch: [x64, x86]
|
||||||
|
os: [ubuntu-latest, macOS-latest, windows-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: "Install dependencies"
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
npm run pack
|
||||||
|
|
||||||
|
- name: "Set up Julia (nightly)"
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: nightly
|
||||||
|
arch: ${{ matrix.julia-arch }}
|
||||||
|
- run: julia --version
|
||||||
33
.github/workflows/example-builds.yml
vendored
Normal file
33
.github/workflows/example-builds.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Example builds
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
julia-version: ['1.0.5', '1', '^1.5.0-beta1']
|
||||||
|
julia-arch: [x64, x86]
|
||||||
|
os: [ubuntu-latest, macOS-latest, windows-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: "Install dependencies"
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
npm run pack
|
||||||
|
|
||||||
|
- name: "Set up Julia"
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.julia-version }}
|
||||||
|
arch: ${{ matrix.julia-arch }}
|
||||||
|
- run: julia --version
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
|
dist/
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -40,10 +40,11 @@ You can either specify specific Julia versions or version ranges. If you specify
|
|||||||
|
|
||||||
- `1.2.0` is a valid semver version. The action will try to download exactly this version. If it's not available, the build step will fail.
|
- `1.2.0` is a valid semver version. The action will try to download exactly this version. If it's not available, the build step will fail.
|
||||||
- `1.0` is a version range that will match the highest available Julia version that starts with `1.0`, e.g. `1.0.5`.
|
- `1.0` is a version range that will match the highest available Julia version that starts with `1.0`, e.g. `1.0.5`.
|
||||||
- `^1.3.0-rc1` is a caret version range that includes preleases. It matches all versions `≥ 1.3.0-rc1` and `< 1.4.0`.
|
- `^1.3.0-rc1` is a caret version range that includes pre-releases starting at `rc1`. It matches all versions `≥ 1.3.0-rc1` and `< 1.4.0`.
|
||||||
|
- `^1.3-0` is a caret version range that includes _all_ pre-releases. It matches all versions `≥ 1.3.0-` and `< 1.4.0`.
|
||||||
- `nightly` will install the latest nightly build.
|
- `nightly` will install the latest nightly build.
|
||||||
|
|
||||||
Internally the action uses node's semver package to resolve version ranges. Its [documentation](https://github.com/npm/node-semver#advanced-range-syntax) contains more details on the version range syntax.
|
Internally the action uses node's semver package to resolve version ranges. Its [documentation](https://github.com/npm/node-semver#advanced-range-syntax) contains more details on the version range syntax. You can test what version will be selected for a given input in this JavaScript [REPL](https://repl.it/@SaschaMann/setup-julia-version-logic).
|
||||||
|
|
||||||
#### WARNING: Version ranges are experimental and potentially out of date
|
#### WARNING: Version ranges are experimental and potentially out of date
|
||||||
|
|
||||||
@@ -51,6 +52,8 @@ Currently the list of available versions is hardcoded. You have to use the lates
|
|||||||
|
|
||||||
### Matrix Testing
|
### Matrix Testing
|
||||||
|
|
||||||
|
`bash` is chosen as shell to enforce consistent behaviour across operating systems. [Other shells](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell) are available but you may have to escape quotation marks or otherwise adjust the syntax.
|
||||||
|
|
||||||
#### 64-bit Julia only
|
#### 64-bit Julia only
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -69,6 +72,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
- run: julia -e 'println("Hello, World!")'
|
- run: julia -e 'println("Hello, World!")'
|
||||||
|
shell: bash
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 32-bit Julia
|
#### 32-bit Julia
|
||||||
@@ -95,6 +99,7 @@ jobs:
|
|||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
arch: ${{ matrix.julia-arch }}
|
arch: ${{ matrix.julia-arch }}
|
||||||
- run: julia -e 'println("Hello, World!")'
|
- run: julia -e 'println("Hello, World!")'
|
||||||
|
shell: bash
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, you can include specific version and OS combinations that will use 32-bit Julia:
|
Alternatively, you can include specific version and OS combinations that will use 32-bit Julia:
|
||||||
@@ -120,6 +125,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
- run: julia -e 'println("Hello, World!")'
|
- run: julia -e 'println("Hello, World!")'
|
||||||
|
shell: bash
|
||||||
```
|
```
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|||||||
13
action.yml
13
action.yml
@@ -9,9 +9,20 @@ inputs:
|
|||||||
description: 'Architecture of the Julia binaries. Defaults to x64.'
|
description: 'Architecture of the Julia binaries. Defaults to x64.'
|
||||||
required: false
|
required: false
|
||||||
default: 'x64'
|
default: 'x64'
|
||||||
|
show-versioninfo:
|
||||||
|
description: 'Display InteractiveUtils.versioninfo() after installing'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
cache-artifacts:
|
||||||
|
description: 'Cache ~/.julia/artifacts. Will fail if no file matches **/Project.toml.'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
outputs:
|
||||||
|
artifacts-cache-id:
|
||||||
|
description: 'The cache id of the artifacts cache.'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/setup-julia.js'
|
main: 'dist/index.js'
|
||||||
branding:
|
branding:
|
||||||
icon: 'download'
|
icon: 'download'
|
||||||
color: 'green'
|
color: 'green'
|
||||||
|
|||||||
@@ -1,13 +1,44 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
git checkout -b releases/"$1"
|
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 install
|
||||||
npm run build
|
npm run build
|
||||||
npm test
|
npm test
|
||||||
npm prune --production
|
npm run pack
|
||||||
|
|
||||||
sed -i 's/node_modules/!node_modules/g' .gitignore
|
sed -i 's/dist/!dist/g' .gitignore
|
||||||
git add node_modules
|
git add dist
|
||||||
git commit -a -m "Add production dependencies & build"
|
git commit -a -m "Add production dependencies & build"
|
||||||
git tag "$1"
|
|
||||||
|
# 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,14 +1,36 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
branch_name="$(git symbolic-ref --short -q HEAD)"
|
branch_name="$(git symbolic-ref --short -q HEAD)"
|
||||||
|
version="v$(jq -r .version package.json)"
|
||||||
|
repo="$1"
|
||||||
|
|
||||||
git checkout -B test/"$branch_name"
|
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 install
|
||||||
npm run build
|
npm run build
|
||||||
npm test
|
npm test
|
||||||
npm prune --production
|
npm run pack
|
||||||
|
|
||||||
sed -i 's/node_modules/!node_modules/g' .gitignore
|
# Add dist/ to git and commit it
|
||||||
git add node_modules
|
sed -i 's/dist/!dist/g' .gitignore
|
||||||
|
git add dist
|
||||||
git commit -a -m "Add production dependencies & build"
|
git commit -a -m "Add production dependencies & build"
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
# Release checklist
|
|
||||||
|
|
||||||
Version: `1.b.c`
|
|
||||||
|
|
||||||
- [ ] Create release branch `releases/v1.b.c`
|
|
||||||
- [ ] Unignore `node_modules/` by adding `!` in front in `.gitignore`
|
|
||||||
- [ ] Delete `node_modules/`
|
|
||||||
- [ ] Install production dependencies: `npm install --production`
|
|
||||||
- [ ] Add `node_modules/`: `git add node_modules`
|
|
||||||
- [ ] Commit & push action: `git commit -a -m "Publish v1.b.c."`, then `git push`
|
|
||||||
- [ ] Test the action with an example package
|
|
||||||
- [ ] Create tags
|
|
||||||
- [ ] `v1.b.c` pointing at the last commit in `releases/v1.b.c`
|
|
||||||
- [ ] `latest` pointing at the latest version of the highest major version
|
|
||||||
- [ ] `v1` pointing at the latest `1.x.x` version
|
|
||||||
- [ ] Push tags
|
|
||||||
40
lib/caching.js
generated
Normal file
40
lib/caching.js
generated
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const cache = __importStar(require("@actions/cache"));
|
||||||
|
const glob = __importStar(require("@actions/glob"));
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
// TODO: Change to hashFiles once https://github.com/actions/toolkit/issues/472 has been resolved
|
||||||
|
const md5File = __importStar(require("md5-file"));
|
||||||
|
const JULIA_HOME = path.join(`${process.env.HOME}`, '.julia');
|
||||||
|
/**
|
||||||
|
* Cache the ~/.julia/artifacts directory.
|
||||||
|
*/
|
||||||
|
function cacheArtifacts() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// TODO: Add error handling in case no Project.toml files are present
|
||||||
|
const projectFiles = yield (yield glob.create('**/Project.toml')).glob();
|
||||||
|
let projectsHash = '';
|
||||||
|
projectFiles.forEach((f) => {
|
||||||
|
projectsHash.concat('-', md5File.sync(f));
|
||||||
|
});
|
||||||
|
const paths = [path.join(JULIA_HOME, 'artifacts')];
|
||||||
|
const key = `artifacts-${process.env.RUNNER_OS}-${projectsHash}`;
|
||||||
|
return cache.saveCache(paths, key);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.cacheArtifacts = cacheArtifacts;
|
||||||
2
lib/installer.js
generated
2
lib/installer.js
generated
@@ -25,7 +25,7 @@ const semver = __importStar(require("semver"));
|
|||||||
const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS)
|
const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS)
|
||||||
core.debug(`platform: ${osPlat}`);
|
core.debug(`platform: ${osPlat}`);
|
||||||
// This is temporary until we have a better way of fetching releases (see #1, #4 for details)
|
// This is temporary until we have a better way of fetching releases (see #1, #4 for details)
|
||||||
exports.juliaVersions = ['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.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) {
|
function getJuliaVersion(availableReleases, versionInput) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (semver.valid(versionInput) == versionInput) {
|
if (semver.valid(versionInput) == versionInput) {
|
||||||
|
|||||||
15
lib/setup-julia.js
generated
15
lib/setup-julia.js
generated
@@ -20,6 +20,7 @@ const exec = __importStar(require("@actions/exec"));
|
|||||||
const tc = __importStar(require("@actions/tool-cache"));
|
const tc = __importStar(require("@actions/tool-cache"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const installer = __importStar(require("./installer"));
|
const installer = __importStar(require("./installer"));
|
||||||
|
const jlcache = __importStar(require("./caching"));
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
@@ -43,8 +44,18 @@ function run() {
|
|||||||
}
|
}
|
||||||
// Add it to PATH
|
// Add it to PATH
|
||||||
core.addPath(path.join(juliaPath, 'bin'));
|
core.addPath(path.join(juliaPath, 'bin'));
|
||||||
// Test if Julia has been installed by showing versioninfo()
|
// Test if Julia has been installed
|
||||||
yield exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()']);
|
exec.exec('julia', ['--version']);
|
||||||
|
// If enabled, also show the full version info
|
||||||
|
if (core.getInput('show-versioninfo') == 'true') {
|
||||||
|
exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()']);
|
||||||
|
}
|
||||||
|
// Create caches
|
||||||
|
if (core.getInput('cache-artifacts') == 'true') {
|
||||||
|
core.debug('caching artifacts directory...');
|
||||||
|
const cacheId = yield jlcache.cacheArtifacts();
|
||||||
|
core.setOutput('artifacts-cache-id', cacheId.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
3701
package-lock.json
generated
3701
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,13 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-julia",
|
"name": "setup-julia",
|
||||||
"version": "0.1.0",
|
"version": "1.1.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup Julia action",
|
"description": "setup Julia action",
|
||||||
"main": "lib/setup-julia.js",
|
"main": "lib/setup-julia.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"format": "prettier --single-quote --print-width 120 --tab-width 4 --no-semi --write **/*.ts",
|
"pack": "ncc build",
|
||||||
"format-check": "prettier --single-quote --print-width 120 --tab-width 4 --no-semi --check **/*.ts",
|
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -22,21 +21,24 @@
|
|||||||
"author": "Sascha Mann <git@mail.saschamann.eu>",
|
"author": "Sascha Mann <git@mail.saschamann.eu>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@actions/cache": "^0.2.1",
|
||||||
"@actions/core": "^1.0.0",
|
"@actions/core": "^1.0.0",
|
||||||
"@actions/exec": "^1.0.0",
|
"@actions/exec": "^1.0.0",
|
||||||
"@actions/github": "^1.0.0",
|
"@actions/glob": "^0.1.0",
|
||||||
"@actions/io": "^1.0.0",
|
"@actions/io": "^1.0.0",
|
||||||
"@actions/tool-cache": "^1.0.0",
|
"@actions/tool-cache": "^1.0.0",
|
||||||
|
"md5-file": "^5.0.0",
|
||||||
"semver": "^6.3.0"
|
"semver": "^6.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.0.13",
|
"@types/jest": "^24.0.13",
|
||||||
"@types/node": "^12.12.7",
|
"@types/node": "^12.12.7",
|
||||||
"@types/semver": "^6.0.0",
|
"@types/semver": "^6.0.0",
|
||||||
|
"@zeit/ncc": "^0.22.0",
|
||||||
"jest": "^24.8.0",
|
"jest": "^24.8.0",
|
||||||
"jest-circus": "^24.7.1",
|
"jest-circus": "^24.7.1",
|
||||||
"prettier": "^1.17.1",
|
"prettier": "^1.17.1",
|
||||||
"ts-jest": "^24.0.2",
|
"ts-jest": "^26.0.0",
|
||||||
"typescript": "^3.5.1"
|
"typescript": "^3.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
src/caching.ts
Normal file
26
src/caching.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import * as cache from '@actions/cache'
|
||||||
|
import * as glob from '@actions/glob'
|
||||||
|
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
|
// TODO: Change to hashFiles once https://github.com/actions/toolkit/issues/472 has been resolved
|
||||||
|
import * as md5File from 'md5-file'
|
||||||
|
|
||||||
|
const JULIA_HOME = path.join(`${process.env.HOME}`, '.julia')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache the ~/.julia/artifacts directory.
|
||||||
|
*/
|
||||||
|
export async function cacheArtifacts(): Promise<number> {
|
||||||
|
// TODO: Add error handling in case no Project.toml files are present
|
||||||
|
const projectFiles = await (await glob.create('**/Project.toml')).glob()
|
||||||
|
let projectsHash = ''
|
||||||
|
projectFiles.forEach((f) => {
|
||||||
|
projectsHash.concat('-', md5File.sync(f))
|
||||||
|
})
|
||||||
|
|
||||||
|
const paths = [path.join(JULIA_HOME, 'artifacts')]
|
||||||
|
const key = `artifacts-${process.env.RUNNER_OS}-${projectsHash}`
|
||||||
|
|
||||||
|
return cache.saveCache(paths, key)
|
||||||
|
}
|
||||||
@@ -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 https from 'https'
|
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ const osPlat = os.platform() // possible values: win32 (Windows), linux (Linux),
|
|||||||
core.debug(`platform: ${osPlat}`)
|
core.debug(`platform: ${osPlat}`)
|
||||||
|
|
||||||
// This is temporary until we have a better way of fetching releases (see #1, #4 for details)
|
// This is temporary until we have a better way of fetching releases (see #1, #4 for details)
|
||||||
export const juliaVersions = ['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.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 async function getJuliaVersion(availableReleases: string[], versionInput: string): Promise<string> {
|
export async function getJuliaVersion(availableReleases: string[], versionInput: string): Promise<string> {
|
||||||
if (semver.valid(versionInput) == versionInput) {
|
if (semver.valid(versionInput) == versionInput) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import * as tc from '@actions/tool-cache'
|
|||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import * as installer from './installer'
|
import * as installer from './installer'
|
||||||
|
import * as jlcache from './caching'
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -32,8 +33,20 @@ async function run() {
|
|||||||
// Add it to PATH
|
// Add it to PATH
|
||||||
core.addPath(path.join(juliaPath, 'bin'))
|
core.addPath(path.join(juliaPath, 'bin'))
|
||||||
|
|
||||||
// Test if Julia has been installed by showing versioninfo()
|
// Test if Julia has been installed
|
||||||
await exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()'])
|
exec.exec('julia', ['--version'])
|
||||||
|
|
||||||
|
// If enabled, also show the full version info
|
||||||
|
if (core.getInput('show-versioninfo') == 'true') {
|
||||||
|
exec.exec('julia', ['-e', 'using InteractiveUtils; versioninfo()'])
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create caches
|
||||||
|
if (core.getInput('cache-artifacts') == 'true') {
|
||||||
|
core.debug('caching artifacts directory...')
|
||||||
|
const cacheId = await jlcache.cacheArtifacts()
|
||||||
|
core.setOutput('artifacts-cache-id', cacheId.toString())
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user