Julia Github actions failing due to missing Pkg

I am running CI for a custom package using Github Actions and Julia. The actions for building work fine, but during testing I get the error below:

[ Info: Generating custom Julia project ...
ERROR: ArgumentError: Package Pkg not found in current path:
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

Neither using Pkg.test, nor julia-actions/julia-runtest@latest don’t succeed, while locally tests run normally. What could be the issue?
Here is part of the workflow yaml file for which CI fails:

 - uses: actions/checkout@v2
 21       - uses: julia-actions/setup-julia@latest
 22         with:
 23           version: ${{ matrix.julia-version }}
 24       - run: julia -e 'import Pkg; Pkg.add("Pkg")' # added to resolve the issue, did not help
 25       - uses: julia-actions/julia-buildpkg@latest
 29       - run: julia -e 'import Pkg; Pkg.add("Pkg"); Pkg.activate("."
    ); Pkg.update(); Pkg.test()'
 30       #- uses: julia-actions/julia-runtest@latest

Pkg is always installed. Test is not from Pkg. You don’t need to manually run test if you use

julia-actions/julia-runtest@v1

Hi, thank you for your help. I tried either option, with and without running custom run: ... commands, and the testing stage still fails with the error I listed.

is your repo public? can you post a link?

Sure: this is the latest attempt, https://github.com/iliailmer/SIAN-Julia/tree/older-commit;

https://github.com/iliailmer/SIAN-Julia/runs/2117984405?check_suite_focus=true

ERROR: LoadError: InitError: could not load library "/home/runner/.julia/artifacts/625c500ebd9e885e870675d77ea6cf41c14d6bdd/lib/libperl.so"
libcrypt.so.1: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [2] dlopen(::String, ::UInt32) at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109

looks like a jll error ?

Hm, I wonder where it comes from, because when I do a clean install in a new environment via ] add https://github.com/iliailmer/SIAN-Julia.git#older-commit the package installs and I am able to use it.

(@v1.6) pkg> activate --temp
  Activating new environment at `/tmp/jl_tL1Rke/Project.toml`

(jl_tL1Rke) pkg> add https://github.com/iliailmer/SIAN-Julia/#older-commit
    Updating git-repo `https://github.com/iliailmer/SIAN-Julia`
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
 Downloading artifact: gap
    Downloading [=====================================>   ]  92.5 %

sorry, it hangs for me. can’t test

What version is that?

1.6-rc1

1.6-rc2 should have the download hang fixed (although if you are on Windows you might want to wait for rc3).

yeah, I have not tried it on 1.6, sorry; but here is the trace for the original Pkg error I saw:
https://github.com/iliailmer/SIAN-Julia/runs/2123748301?check_suite_focus=true
which reports the missing Pkg