# Easy workflow file for setting up GitHub Actions CI for your Julia package

**URL:** <https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765>\
**Category:** Tooling\
**Tags:** ci, github-actions\
**Created:** [November 8, 2020, 3:09am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765 "2020-11-08T03:09:37Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 29, 2020, 6:45pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/21 "2020-11-29T18:45:41Z")

</div>

> [@Ronis\_BR](#):
>
> ```julia
> [![Build status](https://github.com/JuliaSpace/SatelliteToolbox.jl/workflows/CI/badge.svg)](https://github.com/JuliaSpace/SatelliteToolbox.jl/actions)
> 
> ```

Thanks! What do you do about coverage?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [November 29, 2020, 6:50pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/22 "2020-11-29T18:50:20Z")

</div>

I just removed Coveralls information. For Codecov the script that @dilumaluthge provided, as always, works flawlessly, I did not change anything related to coverage.

Ah! Notice that you need to add `ssh: ${{ secrets.DOCUMENTER_KEY }}` to TagBot.yml. Otherwise, the documentation of the tags will not be built automatically.

EDIT: TabBot.yml not TagBor.yml 😃

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 29, 2020, 7:00pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/23 "2020-11-29T19:00:49Z")

</div>

Great, I see what you mean. Thanks.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 30, 2020, 1:12am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/24 "2020-11-30T01:12:15Z")

</div>

Github actions are great! I see it as an improvement on the previous Travis CI & Co.  
Does anyone have a cautionary tale? Should I try to keep Travis CI around just in case?

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [November 30, 2020, 1:19am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/25 "2020-11-30T01:19:53Z")

</div>

I moved from docs on github actions to the whole works in about a month. I’ve moved my travis.yml file to a place on my .gitignore list. I can see no downsides **yet.**

---

<div class="post-metadata">

**Author:** ![jlchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlchan/32/10958_2.png) [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Post date:** [November 30, 2020, 3:32am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/26 "2020-11-30T03:32:14Z")

</div>

I don’t think there are any disadvantages - just seems like good practice to include the docs as part of the build test? I just removed the documentation section for some doc-less test packages.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [November 30, 2020, 7:16am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/27 "2020-11-30T07:16:01Z")

</div>

Hi,

It worked for me!! Thank you a lot for the script 😅

However, despite the docs being. built (see [here](https://github.com/rveltz/BifurcationKit.jl/runs/1471026935?check_suite_focus=true)) they do not update. I mean the link do not show the updated docs. What did I forget?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 30, 2020, 3:56pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/28 "2020-11-30T15:56:17Z")

</div>

Documenter keys probably need to be set. Deploy and secret.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [November 30, 2020, 4:01pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/29 "2020-11-30T16:01:53Z")

</div>

exactly! Thank you

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [November 30, 2020, 4:10pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/30 "2020-11-30T16:10:17Z")

</div>

Help needed. I am lost with all these changes :-/

It would be super helpful if someone could make a tutorial/provide templates for how to set up all these tools for a typical Julia package (including package documentation).

After all, aside the package name, it should be the same for every package…

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [November 30, 2020, 4:28pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/31 "2020-11-30T16:28:50Z")

</div>

> [@sylvaticus](#):
>
> It would be super helpful if someone could make a tutorial/provide templates for how to set up all these tools for a typical Julia package (including package documentation).

How to set up GtiHub Actions to publish documentation is already extensively documented in [`Documenter.jl` manual](https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#GitHub-Actions). If you’re looking for templates, [`PkgTemplates.jl`](https://github.com/invenia/PkgTemplates.jl) already provides them

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [November 30, 2020, 4:37pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/32 "2020-11-30T16:37:03Z")

</div>

Thank you. Concerning the automatic testing and line coverage the script to use is instead the one on top of this thread ?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [November 30, 2020, 4:48pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/33 "2020-11-30T16:48:18Z")

</div>

Yes. Note that that script will also build the documentation, but to correctly publish it you need additional steps, which are in the link to the `Documenter.jl` manual above

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [December 1, 2020, 10:12am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/34 "2020-12-01T10:12:23Z")

</div>

@dilumaluthge: could you add a comment to your script that the branch on pull should be “main” instead of “master” for the new github repositories ?

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [December 1, 2020, 11:04am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/35 "2020-12-01T11:04:14Z")

</div>

@dilumaluthge Why did you add a separate `run` for the doctests here? Why not rely on the settings in the `make.jl` file?

---

<div class="post-metadata">

**Author:** ![mks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mks/32/18374_2.png) [@mks](https://discourse.julialang.org/u/mks)\
**Post date:** [December 2, 2020, 7:27am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/36 "2020-12-02T07:27:35Z")

</div>

I spent some time to get a Python/Julia/PyCall workflow going and would also like to share it here. It uses the System Python instead of the PyCall Conda version to build and look for installed Python packages. If you see room for improvement, that would be nice to know. Currently this doesn’t work on x86 systems.

```julia
name: CI
on:
  - push
  - pull_request

jobs:
  test:
    name: Julia ${{ matrix.version }} - Python ${{ matrix.python }}
      ${{ matrix.os }} ${{ matrix.architecture }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        version:
          - '1.5'
          - 'nightly'
        python: [3.7]
        os:
          - ubuntu-latest
          - macOS-latest
        arch:
          - x64
    steps:
      - uses: actions/checkout@v2
      - name: Set up 🐍 ${{ matrix.python }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python }}

      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - name: Install dependencies 🔧
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt

      # Julia Tasks
      - uses: julia-actions/setup-julia@v1
        with:
          version: ${{ matrix.version }}
          arch: ${{ matrix.arch }}
        
      - uses: actions/cache@v2
        env:
          cache-name: cache-artifacts
        with:
          path: ~/.julia/artifacts
          key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
          restore-keys: |
            ${{ runner.os }}-test-${{ env.cache-name }}-
            ${{ runner.os }}-test-
            ${{ runner.os }}-

      
      - uses: julia-actions/julia-buildpkg@v1
        env:
          PYTHON : python # this sets the Python binary directly to build PyCall
            
      - uses: julia-actions/julia-runtest@v1
      - uses: julia-actions/julia-processcoverage@v1
      - uses: codecov/codecov-action@v1
        with:
          file: lcov.info

    docs:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up 🐍 
        uses: actions/setup-python@v2
        with:
          python-version: 3.7

      - name: Set ENV Variables for 🐍 📞
        run: |
          echo ENV["PYTHON"] = python >> $GITHUB_ENV
         

      - name: Install dependencies 🔧
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
      
      - uses: julia-actions/setup-julia@v1
        env:
            PYTHON : python
        with:
          version: '1'
      - run: |
          julia --project=docs -e '
            using Pkg
            Pkg.develop(PackageSpec(path=pwd()))
            Pkg.instantiate()'
      - run: |
          julia --project=docs -e '
            using Documenter: doctest
            using GraknClient
            doctest(GraknClient)'
      - run: julia --project=docs docs/make.jl
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

```

---

<div class="post-metadata">

**Author:** ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)\
**Post date:** [December 4, 2020, 11:02pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/37 "2020-12-04T23:02:44Z")

</div>

Thanks @dilumaluthge for preparing this! Makes it really easy to switch.  
May be you can add to the recipe the need to add and the DOCUMENTER\_KEY to github.

Another bump for me was the compat section in `docs/Project.toml` which pinned Documenter to an older version. Only recent versions seem to know how to deploy under github actions.

One question though: travis had builds for MacOS and windows. Is it possible to have them here as well ?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 5, 2020, 12:48am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/38 "2020-12-05T00:48:48Z")

</div>

> [@j-fu](#):
>
> One question though: travis had builds for MacOS and windows. Is it possible to have them here as well ?

> **[About GitHub-hosted runners - GitHub Docs](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)**
>
> GitHub offers hosted virtual machines to run workflows. The virtual machine contains an environment of tools, packages, and settings available for GitHub Actions to use.

```yaml
    strategy:
      # ...
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest

```

---

<div class="post-metadata">

**Author:** ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)\
**Post date:** [December 5, 2020, 12:51pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/39 "2020-12-05T12:51:08Z")

</div>

Great, thanks - it works. I’ve seen the docs, but I was not sure where to put this stuff into the ci.yml…

---

<div class="post-metadata">

**Author:** ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)\
**Post date:** [December 6, 2020, 11:43am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/40 "2020-12-06T11:43:42Z")

</div>

I also suggest then to name the ci action to reflect that it runs on theses systems:  
Instead of

```julia
name: CI

```

write (e.g.)

```julia
name: linux-macos-windows

```

Then one can use as the badge in README.md:

```julia
[![Build status](https://github.com/me/MyPackage.jl/workflows/linux-macos-windows/badge.svg)](https://github.com/me/MyPackage.jl/actions)

```

[Previous page](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765.md?page=1)

[Next page](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765.md?page=3)
