mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-03-05 21:23:19 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c2e035e86 | ||
|
|
210e196714 | ||
|
|
c8ff8a1937 | ||
|
|
101e139aea | ||
|
|
44a615affb |
29
.github/workflows/example-builds-nightly.yml
vendored
29
.github/workflows/example-builds-nightly.yml
vendored
@@ -20,13 +20,23 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
julia-version: [nightly, 1.13-nightly]
|
||||
julia-arch: [x64, x86]
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
julia-version:
|
||||
- nightly
|
||||
- 1.13-nightly
|
||||
julia-wordsize:
|
||||
- 64
|
||||
- 32
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- macos-15-intel # Intel
|
||||
- macos-latest # Apple Silicon
|
||||
# 32-bit Julia binaries are not available on macOS
|
||||
exclude:
|
||||
- os: macOS-latest
|
||||
julia-arch: x86
|
||||
- os: macos-15-intel # Intel
|
||||
julia-wordsize: 32
|
||||
- os: macos-latest # Apple Silicon
|
||||
julia-wordsize: 32
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.2
|
||||
@@ -47,7 +57,14 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
version: ${{ matrix.julia-version }}
|
||||
arch: ${{ matrix.julia-arch }}
|
||||
# If `julia-wordsize` is 32, then we set `arch` to `x86`, because we know that
|
||||
# 32-bit builds of Julia are only available for x86.
|
||||
#
|
||||
# If `julia-wordsize` is 64, then we set `arch` to `${{ runner.arch }}`, which
|
||||
# GitHub will automatically expand to the correct value (`x86_64` or `aarch64`)
|
||||
# based on the architecture of the underlying GitHub Runner (virtual machine).
|
||||
arch: ${{ matrix.julia-wordsize == '32' && 'x86' || runner.arch }}
|
||||
|
||||
- run: julia --version
|
||||
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
|
||||
- name: "Check that the correct julia is used and that archive mtimes are maintained"
|
||||
|
||||
56
.github/workflows/example-builds.yml
vendored
56
.github/workflows/example-builds.yml
vendored
@@ -12,6 +12,9 @@ on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -19,24 +22,40 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# include '1.6' here to test info message about lts tag existing
|
||||
julia-version: ['1.0.5', '1.2', '^1.5.0-beta1', '1', '1.6', 'lts', 'pre']
|
||||
julia-arch: [x64, x86]
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
julia-version:
|
||||
- '1.0.5'
|
||||
- '1.2'
|
||||
- '^1.5.0-beta1'
|
||||
- '1'
|
||||
- '1.6'
|
||||
- '1.10' # include '1.10' here to test info message about lts tag existing
|
||||
- 'lts'
|
||||
- 'pre'
|
||||
julia-wordsize:
|
||||
- 64
|
||||
- 32
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- macos-15-intel # Intel
|
||||
- macos-latest # Apple Silicon
|
||||
# 32-bit Julia binaries are not available on macOS
|
||||
exclude:
|
||||
- os: macOS-latest
|
||||
julia-arch: x86
|
||||
include:
|
||||
- os: macOS-latest
|
||||
julia-arch: aarch64
|
||||
julia-version: 'lts'
|
||||
- os: macOS-latest
|
||||
julia-arch: aarch64
|
||||
julia-version: '1'
|
||||
|
||||
- os: macos-15-intel # Intel
|
||||
julia-wordsize: 32
|
||||
- os: macos-latest # Apple Silicon
|
||||
julia-wordsize: 32
|
||||
# Julia versions prior to 1.8 do not have native builds for Apple Silicon
|
||||
- os: macos-latest # Apple Silicon
|
||||
julia-version: '1.0.5'
|
||||
- os: macos-latest # Apple Silicon
|
||||
julia-version: '1.2'
|
||||
- os: macos-latest # Apple Silicon
|
||||
julia-version: '1.6'
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
if: ${{ ! startsWith(github.ref, 'refs/heads/releases') }}
|
||||
@@ -55,7 +74,14 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
version: ${{ matrix.julia-version }}
|
||||
arch: ${{ matrix.julia-arch }}
|
||||
# If `julia-wordsize` is 32, then we set `arch` to `x86`, because we know that
|
||||
# Tier 1 32-bit builds of Julia are only available for x86.
|
||||
#
|
||||
# If `julia-wordsize` is 64, then we set `arch` to `${{ runner.arch }}`, which
|
||||
# GitHub will automatically expand to the correct value (`x86_64` or `aarch64`)
|
||||
# based on the architecture of the underlying GitHub Runner (virtual machine).
|
||||
arch: ${{ matrix.julia-wordsize == '32' && 'x86' || runner.arch }}
|
||||
|
||||
- run: julia --version
|
||||
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
|
||||
- name: "Check that the correct julia is used and that archive mtimes are maintained"
|
||||
|
||||
@@ -1 +1 @@
|
||||
nodejs 20.11.1
|
||||
nodejs 24.13.0
|
||||
|
||||
14
README.md
14
README.md
@@ -56,6 +56,18 @@ This action sets up a Julia environment for use in actions by downloading a spec
|
||||
# Specifying 'default' uses the architecture of the runner executing the job.
|
||||
arch: 'default'
|
||||
|
||||
# Force the use of the specified architecture even when it may be suboptimal on the runner.
|
||||
#
|
||||
# By default, requesting x86 or x64 on an aarch64 macOS runner (Apple Silicon) will fail with an error,
|
||||
# as this is usually a misconfiguration. Set this to 'true' to override the error and allow the installation.
|
||||
#
|
||||
# Note: x64 Julia can run on Apple Silicon via Rosetta 2, but native aarch64 is typically preferred.
|
||||
#
|
||||
# Supported values: true | false
|
||||
#
|
||||
# Default: false
|
||||
force-arch: 'false'
|
||||
|
||||
# Set the display setting for printing InteractiveUtils.versioninfo() after installing.
|
||||
#
|
||||
# Starting Julia and running InteractiveUtils.versioninfo() takes a significant amount of time (1s or ~10% of the total build time in testing),
|
||||
@@ -127,7 +139,7 @@ You can either specify specific Julia versions or version ranges. If you specify
|
||||
- `'pre'` will install the latest prerelease build (RCs, betas, and alphas).
|
||||
- `'nightly'` will install the latest nightly build.
|
||||
- `'1.7-nightly'` will install the latest nightly build for the upcoming 1.7 release. This version will only be available during certain phases of the Julia release cycle.
|
||||
- `'min'` will install the earliest supported version of Julia compatible with the project. Especially useful in monorepos.
|
||||
- `'min'` will install the earliest supported major/minor version of Julia compatible with the project. Especially useful in monorepos. Note: `min` chooses the lowest major/minor, but gives the latest patch. For example, for a Julia `[compat]` entry of `julia = "1.10"`, `min` would resolve to e.g. `1.10.10` (NOT `1.10.0`). If you specifically require e.g. 1.10.0, please specify that manually (instead of using `min`).
|
||||
|
||||
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).
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ inputs:
|
||||
description: 'Architecture of the Julia binaries. Defaults to the architecture of the runner executing the job.'
|
||||
required: false
|
||||
default: 'default'
|
||||
force-arch:
|
||||
description: 'Force the use of the specified architecture even when it may be suboptimal on the runner (e.g., x86 on Apple Silicon macOS runners). By default, requesting x86/x64 on aarch64 macOS runners will fail with an error.'
|
||||
required: false
|
||||
default: 'false'
|
||||
show-versioninfo:
|
||||
description: 'Display InteractiveUtils.versioninfo() after installing'
|
||||
required: false
|
||||
@@ -27,7 +31,7 @@ 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: 'node20'
|
||||
using: 'node24'
|
||||
main: 'dist/index.js'
|
||||
branding:
|
||||
icon: 'download'
|
||||
|
||||
8
dist/index.js
vendored
8
dist/index.js
vendored
@@ -585,6 +585,7 @@ function run() {
|
||||
const versionInput = core.getInput('version').trim();
|
||||
const includePrereleases = core.getInput('include-all-prereleases').trim() == 'true';
|
||||
const originalArchInput = core.getInput('arch').trim();
|
||||
const forceArch = core.getInput('force-arch').trim() == 'true';
|
||||
const projectInput = core.getInput('project').trim(); // Julia project file
|
||||
// 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 }}`.
|
||||
@@ -601,7 +602,12 @@ function run() {
|
||||
throw new Error(`Arch input must not be null`);
|
||||
}
|
||||
if (originalArchInput == 'x64' && os.platform() == 'darwin' && os.arch() == 'arm64') {
|
||||
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. You may have meant to use the "aarch64" arch instead (or left it unspecified for the correct default).');
|
||||
if (forceArch) {
|
||||
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. The "force-arch" input is set to "true", so proceeding with x64 installation. Note that this will mean Julia will be run under Rosetta emulation.');
|
||||
}
|
||||
else {
|
||||
throw new Error('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. You may have meant to use the "aarch64" arch instead (or "default" or left it unspecified for the correct default). To force the use of x64 on this runner, set the "force-arch" input to "true".');
|
||||
}
|
||||
}
|
||||
let processedArchInput;
|
||||
if (originalArchInput == "default") {
|
||||
|
||||
8
lib/setup-julia.js
generated
8
lib/setup-julia.js
generated
@@ -83,6 +83,7 @@ function run() {
|
||||
const versionInput = core.getInput('version').trim();
|
||||
const includePrereleases = core.getInput('include-all-prereleases').trim() == 'true';
|
||||
const originalArchInput = core.getInput('arch').trim();
|
||||
const forceArch = core.getInput('force-arch').trim() == 'true';
|
||||
const projectInput = core.getInput('project').trim(); // Julia project file
|
||||
// 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 }}`.
|
||||
@@ -99,7 +100,12 @@ function run() {
|
||||
throw new Error(`Arch input must not be null`);
|
||||
}
|
||||
if (originalArchInput == 'x64' && os.platform() == 'darwin' && os.arch() == 'arm64') {
|
||||
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. You may have meant to use the "aarch64" arch instead (or left it unspecified for the correct default).');
|
||||
if (forceArch) {
|
||||
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. The "force-arch" input is set to "true", so proceeding with x64 installation. Note that this will mean Julia will be run under Rosetta emulation.');
|
||||
}
|
||||
else {
|
||||
throw new Error('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. You may have meant to use the "aarch64" arch instead (or "default" or left it unspecified for the correct default). To force the use of x64 on this runner, set the "force-arch" input to "true".');
|
||||
}
|
||||
}
|
||||
let processedArchInput;
|
||||
if (originalArchInput == "default") {
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -109,6 +109,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.29.0",
|
||||
"@babel/generator": "^7.29.0",
|
||||
@@ -1726,6 +1727,7 @@
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.9.0",
|
||||
"caniuse-lite": "^1.0.30001759",
|
||||
@@ -2532,6 +2534,7 @@
|
||||
"resolved": "https://registry.npmjs.org/jest/-/jest-30.2.0.tgz",
|
||||
"integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jest/core": "30.2.0",
|
||||
"@jest/types": "30.2.0",
|
||||
@@ -4133,6 +4136,7 @@
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
||||
@@ -179,7 +179,15 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin
|
||||
if (!juliaCompatRange) {
|
||||
throw new Error('Unable to use version "min" when the Julia project file does not specify a compat for Julia')
|
||||
}
|
||||
version = semver.minSatisfying(availableReleases, juliaCompatRange, {includePrerelease})
|
||||
// true_min_version is the actual minimum
|
||||
// E.g. if the Julia [compat] entry is "1.10", then true_min_version is v"1.10.0"
|
||||
let true_min_version = semver.minSatisfying(availableReleases, juliaCompatRange, {includePrerelease})
|
||||
let my_tilde_range = `~${true_min_version}`
|
||||
// min_with_latest_patch is the minimum major/minor, but latest patch
|
||||
// E.g. if the Julia [compat] entry is "1.10", then true__version is v"1.10.10" (or whatever the latest 1.10.x patch is)
|
||||
// https://github.com/julia-actions/setup-julia/issues/372
|
||||
min_with_latest_patch = semver.maxSatisfying(availableReleases, my_tilde_range, {includePrerelease})
|
||||
version = min_with_latest_patch
|
||||
} else if (versionInput == "lts") {
|
||||
version = semver.maxSatisfying(availableReleases, LTS_VERSION, { includePrerelease: false });
|
||||
} else if (versionInput == "pre") {
|
||||
|
||||
@@ -45,6 +45,7 @@ async function run() {
|
||||
const versionInput = core.getInput('version').trim()
|
||||
const includePrereleases = core.getInput('include-all-prereleases').trim() == 'true'
|
||||
const originalArchInput = core.getInput('arch').trim()
|
||||
const forceArch = core.getInput('force-arch').trim() == 'true'
|
||||
const projectInput = core.getInput('project').trim() // Julia project file
|
||||
|
||||
// It can easily happen that, for example, a workflow file contains an input `version: ${{ matrix.julia-version }}`
|
||||
@@ -63,7 +64,11 @@ async function run() {
|
||||
}
|
||||
|
||||
if (originalArchInput == 'x64' && os.platform() == 'darwin' && os.arch() == 'arm64') {
|
||||
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. You may have meant to use the "aarch64" arch instead (or left it unspecified for the correct default).')
|
||||
if (forceArch) {
|
||||
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. The "force-arch" input is set to "true", so proceeding with x64 installation. Note that this will mean Julia will be run under Rosetta emulation.')
|
||||
} else {
|
||||
throw new Error('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 (Apple Silicon) architecture. You may have meant to use the "aarch64" arch instead (or "default" or left it unspecified for the correct default). To force the use of x64 on this runner, set the "force-arch" input to "true".')
|
||||
}
|
||||
}
|
||||
|
||||
let processedArchInput: string;
|
||||
|
||||
Reference in New Issue
Block a user