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

Port CI from Travis to GH Actions #237

Merged
merged 1 commit into from
Apr 17, 2021

Conversation

JasonGross
Copy link
Collaborator

@ejgallego How important is it that it's libgmp-dev:i386 rather than libgmp-dev? The former doesn't seem to exist on the GH Actions runners.

Currently still working on getting this building, but I figured I'd submit it as a draft since I don't have much more time to work on it, and I think it's nearly ready.

@JasonGross

This comment has been minimized.

@JasonGross
Copy link
Collaborator Author

Oh, nevermind, I forgot to call eval $(opam env)

@JasonGross
Copy link
Collaborator Author

I think fixing the action is beyond the scope of my expertise, the 4.07.1+32bit, js-dune build is failing with

Error:  The compilation of zarith failed at "/home/runner/.opam/opam-init/hooks/sandbox.sh build make".
#=== ERROR while compiling zarith.1.12 ========================================#
# context              2.0.8 | linux/x86_64 | ocaml-variants.4.07.1+32bit | git+https://github.com/ocaml/opam-repository.git
# path                 ~/.opam/4.07.1+32bit/.opam-switch/build/zarith.1.12
# command              ~/.opam/opam-init/hooks/sandbox.sh build make
# exit-code            2
# env-file             ~/.opam/log/zarith-32854-65c165.env
# output-file          ~/.opam/log/zarith-32854-65c165.out
### output ###
# [...]
# ocamlc -I +compiler-libs -bin-annot  -c z.ml
# ocamlc -I +compiler-libs -bin-annot  -c q.mli
# ocamlc -I +compiler-libs -bin-annot  -c q.ml
# ocamlc -I +compiler-libs -bin-annot  -c big_int_Z.mli
# ocamlc -I +compiler-libs -bin-annot  -c big_int_Z.ml
# ocamlmklib -failsafe -o zarith zarith_version.cmo z.cmo q.cmo big_int_Z.cmo -lgmp
# ocamlc -ccopt "-I/home/runner/.opam/4.07.1+32bit/lib/ocaml  -DZ_OCAML_LEGACY_CUSTOM_OPERATIONS -DHAS_GMP  -O3 -Wall -Wextra " -c caml_z.c
# caml_z.c:32:10: fatal error: gmp.h: No such file or directory
#    32 | #include <gmp.h>
#       |          ^~~~~~~
# compilation terminated.
# make: *** [project.mak:141: caml_z.o] Error 2

@ejgallego
Copy link
Collaborator

ejgallego commented Apr 15, 2021

Thanks a lot @JasonGross , this is super useful!

Indeed the 32-bit version of gmp is needed for the js_of_ocaml build [as JS cannot efficiently represent 64 bit ints] , but actually it is very likely that the only thing the runners need is sudo dpkg --add-architecture i386 && sudo apt update

@JasonGross
Copy link
Collaborator Author

Glad to help! Indeed, I eventually stumbled on that and things now build: https://github.com/JasonGross/coq-serapi/actions/runs/753193729

Let me squash the commits.

Btw, do you have a preference between doing eval $(opam env) before each step (environment variables don't persist across them) vs doing opam env | sed "s/'//g; s/; export .*//g" >> $GITHUB_ENV right after installing opam? (cf ocaml/setup-ocaml#70 (comment))

@JasonGross JasonGross marked this pull request as ready for review April 15, 2021 23:14
@JasonGross
Copy link
Collaborator Author

Should be ready for merge now

@ejgallego
Copy link
Collaborator

Should be ready for merge now

Thanks a lot @JasonGross ; I'm gonna do a review but feel free to merge yourself!

One question tho: shouldn't the CI display the checks in this PR? Is there something else we need to activate?

@ejgallego ejgallego added this to the 0.13.1 milestone Apr 17, 2021
- v8.10
- v8.11
- v8.12
- v8.13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this was added to the travis file to avoid double-building of pull requests that live in this particular repos, not sure this is still a problem with github actions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in fact PRs would get double-built, but I'm also not sure that's such a problem? What's the bad thing that happens if they get double-built?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing bad, just a waste of runners (for Travis these were quite limited), so keeping the branch then sounds good.

extra-opam: coq.8.13.0 js_of_ocaml js_of_ocaml-lwt zarith_stubs_js
- ocaml-version: 4.11.1
test-target: test
extra-opam: dune
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be captured by the opam install --deps-only below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk, I was just copying the Travis script

Copy link
Collaborator

@ejgallego ejgallego Apr 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll revisit once the checks actually run.

pushd math-comp/mathcomp/ssreflect
make
make install
popd
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this will likely stop working soon if math-comp is updated to use hiearchy-builder, as it will then require a huge dep chain that is not feasible to manage by hand. So if that happens we will have to either split the math-comp tests, or maybe just use the Coq dev package so we can install everything using opam; when this script was first developed there were some issues with opam, I dunno if things are better now.

@JasonGross
Copy link
Collaborator Author

One question tho: shouldn't the CI display the checks in this PR? Is there something else we need to activate?

You need GH actions the base branch (or main branch?) to enable GH actions on PRs to the repo. Seems like a reasonable security principle, though I'm not sure it's necessary. You can check the actions tab on my fork, where I synced this branch to v8.13

@JasonGross
Copy link
Collaborator Author

I'm gonna do a review but feel free to merge yourself!

I'm inclined to merge this as-is and let you improve the script in future commits, if that sounds good to you? (I'm a bit short on time to improve it currently.)

@ejgallego
Copy link
Collaborator

I'm inclined to merge this as-is and let you improve the script in future commits, if that sounds good to you? (I'm a bit short on time to improve it currently.)

Sounds good, thanks a lot @JasonGross this saved me a huge amount of time.

@JasonGross JasonGross merged commit c5a609d into rocq-archive:v8.13 Apr 17, 2021
@JasonGross JasonGross deleted the gh-actions branch April 17, 2021 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants