Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running setup-ocaml locally with nektos/act #211

Closed
anton-trunov opened this issue Aug 17, 2021 · 6 comments
Closed

Running setup-ocaml locally with nektos/act #211

anton-trunov opened this issue Aug 17, 2021 · 6 comments

Comments

@anton-trunov
Copy link

Hi, I'm trying to use setup-ocaml with https://github.com/nektos/act which lets me run GH Actions locally. However, I get the following error message for the "Retrieve the opam cache" part:

::error::Parameter token or opts.auth is required

Here is the full output:

$ act
[Build/build-1] 🧪  Matrix: map[ocaml-compiler:4.12.0 os:ubuntu-20.04]
[Build/build-1] 🚀  Start image=catthehacker/ubuntu:act-20.04
[Build/build-1]   🐳  docker run image=catthehacker/ubuntu:act-20.04 platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Build/build-1]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root
[Build/build-1]   🐳  docker cp src=/Users/anton/zilliqa/scilla-tla/. dst=/Users/anton/zilliqa/scilla-tla
[Build/build-1]   🐳  docker exec cmd=[mkdir -p /Users/anton/zilliqa/scilla-tla] user=
[Build/build-1] ⭐  Run Checkout code
[Build/build-1]   ✅  Success - Checkout code
[Build/build-1] ⭐  Run Use OCaml ${{ matrix.ocaml-version }}
INFO[0001]   ☁  git clone 'https://github.com/ocaml/setup-ocaml' # ref=v2
[Build/build-1]   🐳  docker cp src=/Users/anton/.cache/act/ocaml-setup-ocaml@v2/ dst=/var/run/act/actions/ocaml-setup-ocaml@v2/
[Build/build-1]   🐳  docker exec cmd=[mkdir -p /var/run/act/actions/ocaml-setup-ocaml@v2/] user=
[Build/build-1]   🐳  docker exec cmd=[node /var/run/act/actions/ocaml-setup-ocaml@v2/dist/index.js] user=
[Build/build-1]   ❓  ::group::Retrieve the opam cache
[Build/build-1]   ❗  ::error::Parameter token or opts.auth is required
[Build/build-1]   ❌  Failure - Use OCaml ${{ matrix.ocaml-version }}
Error: exit with `FAILURE`: 1

PS Sorry if this is not the right place for this issue.

@smorimoto
Copy link
Member

act does not seem to provide github.token. Namely, you have to generate a personal access token and pass it as a github-token input.

@anton-trunov
Copy link
Author

@smorimoto Indeed, I was missing that, thanks. Now I get a different error message:

act -s GITHUB_TOKEN=<my_personal_token>
[Build/build] 🧪  Matrix: map[ocaml-compiler:4.12.0 os:ubuntu-20.04]
[Build/build] 🚀  Start image=catthehacker/ubuntu:act-20.04
[Build/build]   🐳  docker run image=catthehacker/ubuntu:act-20.04 platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Build/build]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root
[Build/build]   🐳  docker cp src=/Users/anton/zilliqa/scilla-tla/. dst=/Users/anton/zilliqa/scilla-tla
[Build/build]   🐳  docker exec cmd=[mkdir -p /Users/anton/zilliqa/scilla-tla] user=
[Build/build] ⭐  Run Checkout code
[Build/build]   ✅  Success - Checkout code
[Build/build] ⭐  Run Use OCaml ${{ matrix.ocaml-version }}
INFO[0002]   ☁  git clone 'https://github.com/ocaml/setup-ocaml' # ref=v2
[Build/build]   🐳  docker cp src=/Users/anton/.cache/act/ocaml-setup-ocaml@v2/ dst=/var/run/act/actions/ocaml-setup-ocaml@v2/
[Build/build]   🐳  docker exec cmd=[mkdir -p /var/run/act/actions/ocaml-setup-ocaml@v2/] user=
[Build/build]   🐳  docker exec cmd=[node /var/run/act/actions/ocaml-setup-ocaml@v2/dist/index.js] user=
[Build/build]   ❓  ::group::Retrieve the opam cache
[Build/build]   💬  ::debug::Resolved Keys:
[Build/build]   💬  ::debug::["v1-setup-ocaml-2.0.0-beta3-opam-2.1.0-linux-20.04-x86_64-ocaml_base_compiler_4_12_0-2021-34","v1-setup-ocaml-2.0.0-beta3-opam-2.1.0-linux-20.04-x86_64-ocaml_base_compiler_4_12_0-2021-34"]
[Build/build]   💬  ::debug::Checking zstd --version
[Build/build]   💬  ::debug::*** zstd command line interface 64-bits v1.4.4, by Yann Collet ***
[Build/build]   💬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache.
[Build/build]   💬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache.
[Build/build]   ❗  ::error::getCacheEntry failed: Cache Service Url not found, unable to restore cache.
[Build/build]   ❌  Failure - Use OCaml ${{ matrix.ocaml-version }}
Error: exit with `FAILURE`: 1

Any ideas why this is happening? Thanks in advance!

@smorimoto
Copy link
Member

As far as I read the error, it seems impossible to use @actions/cache on act. At this time, setup-ocaml does not care about such cases anyway.

@smorimoto
Copy link
Member

This seems to be a related issue: nektos/act#329

@anton-trunov
Copy link
Author

Thank you for the pointer!

@christophe-riolo
Copy link

Hi ! I was currently trying to use Act to fix my github action and I ran into this very issue. The recommended way to fix the caching issue as per nektos/act#285 (comment) is to disable the cache actions, simply. But I do not see an option for this in setup-ocaml. Would it make sense to have an option to disable caching altogether (Gygwin, opam etc.) ?

      - name: Use OCaml ${{ matrix.ocaml-compiler }}
        uses: ocaml/setup-ocaml@v2
        with:
          ocaml-compiler: ${{ matrix.ocaml-compiler }}
          disable-cache: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants