Adding packages using GitHub Actions

I am just starting to use GitHub Actions. When running a github_ci.yml script via GitHub Actions I am getting the following error:


- Run `import Pkg; Pkg.add("BusinessDays")` to install the BusinessDays package.```

However the status list contais the BusinessDays package:
Status `/tmp/jl_V0rWWg/Manifest.toml`
  [56f22d72] Artifacts v1.3.0
  [4f18b42c] BusinessDays v0.9.12
  [9a962f9c] DataAPI v1.4.0 
   ...

One among many tries was: 
...
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- name: Install dependencies
  run: julia -e 'import Pkg; Pkg.add("BusinessDays")' 
...

I really don't know which command to use and even where in the script to put it. 

Thank you in advance.
1 Like

Is the repository where you have this issue public? If yes, could you share the link? That would make debugging easier.

Normally, julia-actions/julia-buildpkg@latest should install all the required packages. I don’t know what you have tried exactly, but one possible error could be that your workflow contained something like

- name: Install dependencies
  run: julia -e 'import Pkg; Pkg.add("BusinessDays")' 
- name: Use BusinesDays
  run: julia --project -e 'using BusinessDays'

This won’t work because BusinessDays is installed in the global Julia workspace and not in your project.

In general,

- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1

should install all the dependencies listed in Project.toml (and Manifest.toml), and make them available when running the tests.

Thank you very much! Sure, the link is the following https://github.com/ASaragga/DayCounts.jl.

It is forked from JuliaFinance/DayCounts.jl with the addition of a few more day count conventions to make them a super set of the ones available in Matlab.

I haven’t solved it yet, but I did manage to pin it down. The issue is not related to CI because I can reproduce it locally with

$ julia --project

(DayCounts) pkg> test

the issue is in “addbasis.jl” since commenting it out makes all the tests pass. On the other hand, running “addbasis.jl” on its own also works:

$ julia --project

julia> include("test/addbasis.jl")
Test Summary:      | Pass  Total
ActualActualMatlab |   18     18
Test Summary: | Pass  Total
NL365         |   11     11
Test Summary: | Pass  Total
Bus252        |   18     18
Test Summary: | Pass  Total
Thirty360PSA  |   14     14
Test Summary: | Pass  Total
Thirty360SIA  |   15     15
Test Summary:  | Pass  Total
ThirtyEPlus360 |    9      9
Test Summary: | Pass  Total
ActualActualL |   16     16
Test Summary: | Pass  Total
Actual365A    |   10     10
Test Summary: | Pass  Total
ActualActualY |   13     13
Test.DefaultTestSet("ActualActualY", Any[], 13, false)

Thank you so much for looking at this.

Indeed it is puzzling since if I comment out @testset "Bus252" that is the only place in the test set where BusinessDays is needed, I still get the same error.

Further, the complete test set file also runs without problems.

julia> include("test/runtests.jl")

Test Summary:  | Pass  Total
Actual365Fixed |   15     15
Test Summary: | Pass  Total
Actual360     |   15     15
Test Summary:    | Pass  Total
ActualActualISDA |   15     15
Test Summary: | Pass  Total
Thirty360     |   24     24
Test Summary: | Pass  Total
ThirtyE360    |   24     24
Test Summary:  | Pass  Total
ThirtyE360ISDA |   48     48
Test Summary:    | Pass  Total
ActualActualICMA |    6      6
Test Summary:         | Pass  Total
ActuaActual ISDA Memo |   22     22
Test Summary:  | Pass  Total
Thirty360Excel |   24     24
Test Summary:     | Pass  Total
ActualActualExcel |   27     27
Test Summary:      | Pass  Total
ActualActualMatlab |   18     18
Test Summary: | Pass  Total
NL365         |   11     11
Test Summary: | Pass  Total
Bus252        |   18     18
Test Summary: | Pass  Total
Thirty360PSA  |   14     14
Test Summary: | Pass  Total
Thirty360SIA  |   15     15
Test Summary:  | Pass  Total
ThirtyEPlus360 |    9      9
Test Summary: | Pass  Total
ActualActualL |   16     16
Test Summary: | Pass  Total
Actual365A    |   10     10
Test Summary: | Pass  Total
ActualActualY |   13     13
Test Summary: | Pass  Total
Excel basis 0 |   21     21
Test Summary: | Pass  Total
Excel basis 1 |   21     21
Test Summary: | Pass  Total
Excel basis 2 |   21     21
Test Summary: | Pass  Total
Excel basis 3 |   21     21
Test Summary: | Pass  Total
Excel basis 4 |   21     21
Test.DefaultTestSet("Excel basis 4", Any[], 21, false, false)

It’s odd; also that people on this forum don’t respond to this topic.

Is your goal to extend the original package? Maybe then it would be better to make a new package and move your code into there. That could solve the issue.

The problem is that, somehow, Project.toml in the - test - directory didn’t include BusinessDays as a dependency, although it was included as a dependency in DayCounts' Project.toml. So after doing the following the problem was solved:

julia> cd("test")
(DayCounts) pkg> activate .
   Activating environment at `~/Documents/GitHub/DayCounts.jl/test/Project.toml`
(test) pkg> add BusinessDays

Thank you very much for your help diagnosing the problem.

1 Like

Aha! Nice one. I did overlook that.

It’s best to remove Project.toml and Manifest.toml from the test directory; unless you have a good reason for having those files.