Julia in GitHub actions
Official Julia GitHub actions¶
- julia-actions/setup-julia action downloads juliaand adds it toPATH.
- julia-actions/julia-buildpkg runs build scripts and installs dependencies for the Julia package.
- julia-actions/julia-runtest runs unit test for the Julia project.
- julia-actions/cache is a shortcut action to cache Julia artifacts, packages, and registries.
- julia-actions/julia-docdeploy deploys documentation.
- julia-actions/julia-processcoverage generates test coverage data.
Example workflow:
name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: julia-actions/setup-julia@v1
    - uses: julia-actions/cache@v1
    - uses: julia-actions/julia-buildpkg@v1
    - uses: julia-actions/julia-runtest@v1
    - uses: julia-actions/julia-docdeploy@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
    - uses: julia-actions/julia-processcoverage@v1
    - uses: codecov/codecov-action@v2
      with:
        files: lcov.info
Using the Julia shell¶
Using Julia shell to run Julia scripts is much cleaner than julia -e 'code'.1
For example, the two steps do the same:
- name: Run Julia command
  shell: julia --color=yes --project=. --threads=auto {0}
  run: |
    println("Hello, Julia!")
    println("This is fine.")
- name: Run Julia command
  run: julia --color=yes --project=. --threads=auto -e '
    println("Hello, Julia!")
    println("This is fine.")'
Using PyCall.jl¶
In GNU/Linux systems like Ubuntu, PyCall.jl may not be able to install python packages for PyCall.jl because it will first try to use the system Python (/usr/bin/python) and pip. It would fail due to lack of superuser privileges.
To solve this, you can set the PYTHON environment variable to where the Python executable is.2
- Either using a blank (PYTHON:'') variable will force Julia to install a local miniconda distribution.
- Or using the Python executable from the setup-pythonaction.