This is a temporary fix until we can get Julia versions directly from julialang.org. Right now the GitHub API randomly fails due to rate limiting which leads to builds failing even if a valid specific version was specified.
5.6 KiB
setup-julia Action
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
Usage
See action.yml.
You can find a list of example workflows making use of this action here: julia-actions/example-workflows.
Basic
steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@v0.2
with:
version: 1.0.4
- run: julia -e 'println("Hello, World!")'
Julia Versions
You can either specify specific Julia versions or version ranges. If you specify a version range, the highest available Julia version that matches the range will be selected.
Examples
1.2.0is 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.xis a version range that will match the highest available Julia version that starts with1.0, e.g.1.0.5.^1.3.0-rc1is a caret version range that includes preleases. It matches all versions≥ 1.3.0-rc1and< 1.4.0.
Internally the action uses node's semver package to resolve version ranges. Its documentation contains more details on the version range syntax.
WARNING: Version ranges are experimental and potentially unstable
For now, the action fetches the list of available Julia releases from the GitHub API. During testing it has happened that the host the action runner was on was hit by rate limiting. If this happens, the action falls back to a hardcoded list of releases. Once available we will use a list of versions provided on julialang.org.
Matrix Testing
64-bit Julia only
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0.x, 1.2.0, ^1.3.0-rc1]
os: [ubuntu-latest, windows-latest, macOS-latest]
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!")'
32-bit Julia
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0.x, 1.2.0, ^1.3.0-rc1]
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:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0.x, 1.2.0, ^1.3.0-rc1]
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 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. Dependabot can also be used to automatically create Pull Requests to update actions used in your workflows.
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:
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
In no particular order:
- Check if a cached version of Julia is available instead of installing it everytime CI runs (waiting on GitHub to add proper caching)
- Add support for nightly Julia builds.
- Write some unit tests for the action.
- Add CI script that checks if tags have been updated on release.
- Hash and signature checks.
Licence info
Parts of this software have been derived from the setup-go action and the TypeScript Action Template, both released by GitHub under the MIT licence.