Using Julia in GitHub Actions

Hey everyone,

I’ve created a GitHub Action that sets up a Julia environment as a base for CI and other automation tasks.

The action lets you setup 32- and 64-bit Julia environments on all supported OSes (Windows Server 2016 & 2019, Ubuntu 16.04 & 18.04 and macOS X Mojave 10.14).

It still lacks some features like version shortcuts or support for nightly builds but it’s enough to try out GH Actions so I’ve decided to share it already. Check the readme for more info on what’s still missing.

Example workflow: Manually running package tests
name: Run tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        julia-version: [1.0.4, 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 }}
      - name: "Run tests"
        run: |
          julia --project=@. -e "using Pkg; Pkg.instantiate();"
          julia --project=@. -e "using Pkg; Pkg.test(\"Example\");"

You can find “real world” examples in the Exercism.jl package and in the Exercism Julia track, a non-package project.

More infos about setting up workflows in general can be found in the GitHub docs.


Actions allow you to hook into any repo event, not just pushes and PRs which could be used for some interesting automation that doesn’t require running and trusting apps.
Even if you’re not interested in that, I think they are worth a look because in my (limited) testing, they run a lot faster than Travis CI and also allow more parallel builds.

If you run into any issues, please open an issue and if you create any Julia-related actions, please share them, I’m interested to see what people use them for!

7 Likes