# 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:** 3

<div class="post-metadata">

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

</div>

Thank you all for the really helpful tips. Can I double check the steps of the migration?

1. Go to the repository or organization and create a `DOCUMENTER_KEY` secret
2. Copy/paste the `CI.yml` file shared by @dilumaluthge inside `.github/workflows`
3. Disable Travis CI in the repository or organization

Is it fine to disable Travis CI? I mean, can I just remove it from the list of authorized apps? Also, where is the `GITHUB_TOKEN` defined again? I couldn’t find this secret anywhere. Should I create this secret in the organization in case it doesn’t exist yet?

I am assuming that we still need Codecov enabled to get the coverage, we can’t remove it from the list of authorized apps, correct?

@Ronis_BR you created two separate actions one for stable Julia and another for nightly Julia because the latter can fail and you don’t care if it fails for merging PRs right? I like the idea. I wonder if there is a less brute force method to achieve the same result without having to copy two action files with the same contents basically. Anyone has suggestions?

I will try to trigger the new setup with a PR soon.

---

<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 10, 2020, 1:49pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/42 "2020-12-10T13:49:14Z")

</div>

> [@juliohm](#):
>
> Is it fine to disable Travis CI? I mean, can I just remove it from the list of authorized apps?

You can simply remove the `.travis.yml` file and Travis won’t run anyway. Anything else is unnecessary, but of course you’re free to do it

> [@juliohm](#):
>
> Also, where is the `GITHUB_TOKEN` defined again? I couldn’t find this secret anywhere.

When else fails, read the [documentation](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret)

> [@](#):
>
> GitHub automatically creates a `GITHUB_TOKEN` secret to use in your workflow. You can use the `GITHUB_TOKEN` to authenticate in a workflow run.

> [@juliohm](#):
>
> I am assuming that we still need Codecov enabled to get the coverage, we can’t remove it from the list of authorized apps, correct?

Yes

---

<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:** [December 10, 2020, 1:51pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/43 "2020-12-10T13:51:08Z")

</div>

> [@juliohm](#):
>
> @Ronis_BR you created two separate actions one for stable Julia and another for nightly Julia because the latter can fail and you don’t care if it fails for merging PRs right? I like the idea. I wonder if there is a less brute force method to achieve the same result without having to copy two action files with the same contents basically. Anyone has suggestions?

Yes, that’s exactly what I did. I searched a little bit if GitHub actions have an option to replace `allow_failure` of Travis but AFAIK it does not have anything that can replicate the behavior 100%.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [December 10, 2020, 1:56pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/44 "2020-12-10T13:56:50Z")

</div>

Thank you @Ronis_BR, I will end up doing the same, or just removing Julia nightly from the build. I actually don’t look at it these days. I only care about stable Julia. Nightly was important for me when Julia was at versions \< 1.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [December 10, 2020, 2:03pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/45 "2020-12-10T14:03:55Z")

</div>

Thank you @giordano, I found out about GITHUB\_TOKEN right after I submitted the question. 🙂

For some reason, Documenter.jl is failing to decode the DOCUMENTER\_KEY:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/2/1209220a7d691ed7b24ae3b443fc83a79a2f35f5.png)

Can the value of the secret key be an arbitrary string or it has some restriction? I couldn’t find anything online for that one.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [December 10, 2020, 2:10pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/46 "2020-12-10T14:10:19Z")

</div>

People helped on Zulip, we need to generate the value with:

```julia
using DocumenterTools
using MyPackage
DocumenterTools.genkeys(MyPackage)

```

---

<div class="post-metadata">

**Author:** ![CarloLucibello](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carlolucibello/32/3278_2.png) [@CarloLucibello](https://discourse.julialang.org/u/CarloLucibello)\
**Post date:** [December 10, 2020, 4:29pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/47 "2020-12-10T16:29:32Z")

</div>

Does anyone know how to configure a configuration specific environment variable?  
It seems that my attempt here failed [https://github.com/FluxML/NNlib.jl/pull/246](https://github.com/FluxML/NNlib.jl/pull/246)  
(the ubuntu configuration with `JULIA_NUM_THREADS: 2` was not spawn)

---

<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 10, 2020, 4:36pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/48 "2020-12-10T16:36:22Z")

</div>

I also had difficulties setting environment variables in `matrix.include`, this is what I ended up doing in `BinaryBuilderBase.jl`:  
[https://github.com/JuliaPackaging/BinaryBuilderBase.jl/blob/573b396e475c05353ce9d975bd726774d59b8e39/.github/workflows/ci.yml#L19-L36](https://github.com/JuliaPackaging/BinaryBuilderBase.jl/blob/573b396e475c05353ce9d975bd726774d59b8e39/.github/workflows/ci.yml#L19-L36)  
Instead this is what I do in `LombScargle.jl` to run tests with both 1 and 2 threads:  
[https://github.com/JuliaAstro/LombScargle.jl/blob/b4c1a98820713dfd9538047521e88940b8021596/.github/workflows/ci.yml#L14-L31](https://github.com/JuliaAstro/LombScargle.jl/blob/b4c1a98820713dfd9538047521e88940b8021596/.github/workflows/ci.yml#L14-L31)

---

<div class="post-metadata">

**Author:** ![CarloLucibello](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carlolucibello/32/3278_2.png) [@CarloLucibello](https://discourse.julialang.org/u/CarloLucibello)\
**Post date:** [December 10, 2020, 4:48pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/49 "2020-12-10T16:48:56Z")

</div>

thanks, that was helpful, It’s working now

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 21, 2020, 9:47am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/50 "2020-12-21T09:47:54Z")

</div>

~~What’s the recommended way to set up a test status badge with this?~~

Silly me, it is [documented](https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/adding-a-workflow-status-badge).

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 24, 2020, 9:56am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/51 "2020-12-24T09:56:33Z")

</div>

Question: older recommended setups (on Travis) had a `test/coverage` folder with a project file and a small script, like

```julia
get(ENV, "TRAVIS_OS_NAME", nothing) == "linux" || exit(0)
get(ENV, "TRAVIS_JULIA_VERSION", nothing) == "1.5" || exit(0)

using Coverage

cd(joinpath(@ __DIR__ , "..", "..")) do
    Codecov.submit(Codecov.process_folder())
end

```

That is no longer necessary if I am not using Travis?

---

<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 24, 2020, 10:10am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/52 "2020-12-24T10:10:32Z")

</div>

> [@Tamas\_Papp](#):
>
> older recommended setups (on Travis) had a `test/coverage` folder with a project file and a small script

How old is that? I’ve _never_ seen this setup in any package

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 24, 2020, 10:17am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/53 "2020-12-24T10:17:35Z")

</div>

See eg

[https://github.com/JuliaDocs/DocStringExtensions.jl/blob/5d7e09c1e5bfac6ff7dfafb5d6f0341c61a5abfc/test/coverage.jl](https://github.com/JuliaDocs/DocStringExtensions.jl/blob/5d7e09c1e5bfac6ff7dfafb5d6f0341c61a5abfc/test/coverage.jl)

It kind of made sense on Travis I guess.

---

<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 24, 2020, 10:28am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/54 "2020-12-24T10:28:00Z")

</div>

You could do something similar also for Github Actions, you need to change the environment variables, but this is definitely not the recommended way of doing code coverage for the last few years, not even in Travis since that was as easy as

```yaml
codecov: true
coverrals: true

```

in the Travis script

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [December 24, 2020, 6:18pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/55 "2020-12-24T18:18:19Z")

</div>

There’s a script at [https://github.com/julia-actions/MassInstallAction.jl/tree/master/demos/MaintenanceDec2020](https://github.com/julia-actions/MassInstallAction.jl/tree/master/demos/MaintenanceDec2020) that handles a lot of the necessary updates for you.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 20, 2021, 11:47pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/56 "2021-01-20T23:47:40Z")

</div>

OK, I made the conversion from Travis to GA but I can’t make Documenter to work. The [make.jl](https://github.com/GenericMappingTools/GMT.jl/blob/documenter-test/docs/make.jl) looks like this and **work** with Travis but errors in GA if I don’t comment line  
[https://github.com/GenericMappingTools/GMT.jl/blob/documenter-test/docs/make.jl#L6](https://github.com/GenericMappingTools/GMT.jl/blob/documenter-test/docs/make.jl#L6)  
and specially the one with  
`push_preview = true,`  
otherwise it errors with (and if I comment it the docs do not get updated)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/2/a264647eefe834773ef14db3a7375c128318d258.png)

---

<div class="post-metadata">

**Author:** ![thofma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thofma/32/1691_2.png) [@thofma](https://discourse.julialang.org/u/thofma)\
**Post date:** [January 21, 2021, 11:19am UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/57 "2021-01-21T11:19:57Z")

</div>

Your Documenter version is way too old (see your `docs/Project.toml`).

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 21, 2021, 7:57pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/58 "2021-01-21T19:57:20Z")

</div>

Right, thanks for looking (but that same one works with Travis).

Updated it and now no error but it also doesn’t update de docs.

---

<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:** [January 21, 2021, 8:03pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/59 "2021-01-21T20:03:06Z")

</div>

[https://github.com/GenericMappingTools/GMT.jl/runs/1742334165#step:5:67](https://github.com/GenericMappingTools/GMT.jl/runs/1742334165#step:5:67)

```julia
┌ Error: Git failed to fetch git@github.com:GenericMappingTools/GMT.jl.git
│ This can be caused by a DOCUMENTER_KEY variable that is not correctly set up.
│ Make sure that the environment variable is properly set up as a Base64-encoded string
│ of the SSH private key. You may need to re-generate the keys with DocumenterTools.
└ @ Documenter ~/.julia/packages/Documenter/FuXcO/src/Documenter.jl:554

```

> **[Hosting Documentation · Documenter.jl](https://documenter.juliadocs.org/stable/man/hosting/)**
>
> Documentation for Documenter.jl.

---

<div class="post-metadata">

**Author:** ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)\
**Post date:** [January 31, 2021, 8:07pm UTC](https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765/60 "2021-01-31T20:07:51Z")

</div>

### Linux / Gtk.jl / `xvfb-run`

Does anyone know how to get things to work if you depend on Gtk.jl?

I tried adding `xvfb-run` as was done in Gtk.jl’s `ci.yml` - to no avail:  
 → [InspectDR.jl/.github/workflows/ci.yml at master · ma-laforge/InspectDR.jl · GitHub](https://github.com/ma-laforge/InspectDR.jl/blob/master/.github/workflows/ci.yml)

CI test fails due to the display for some reason.

### Missing `libgtk-3-dev` maybe?

I also noticed that I my old .travis.yml file included:

```julia-auto
addons:
  apt:
    packages:
      - libgtk-3-dev

```

But there is no such entry in Gtk.jl’s own `ci.yml` file since the migration to Github Actions.

### Assistance would be greatly appreciated 🙂.

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

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