You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use GHC CI infrastructure to produce release artifacts. #6616
@samuela, great! Essentially, the task is to write a .gitlab-ci.yml similar to GHC's which uses the same build environments to build and package cabal-install. The GHC build environments already include cabal-install (since it's necessary to build GHC's Hadrian build system) so the task of building cabal-install should be fairly straightforward.
I have put up a quick experiment here. Feel free to use it as a starting point. The remaining work is the following:
fix the logic (i.e. the find command in my experiment) for locating and copying the executable
modify the Linux job in my experiment to rather use the CentOS 7 build instead of Debian 9 (this ensures that we build against an old glibc, allowing us to use the same executable across all glibc-based distributions)
Possibly freeze the Hackage index date?
Add jobs for (using the GHC .gitlab-ci.yml as a template):
AArch64 Linux
ARMv7 Linux
Darwin (macOS)
Windows
x86-64 FreeBSD
x86-64 Alpine Linux (musl)
any other platforms that I have forgotten
add --enable-split-sections to the cabal command line
build and package the documentation?
possibly package the build products into a tarball?
cache the Cabal store?
The platforms which don't use Docker are a bit tricky; on these platforms (Windows, Darwin, FreeBSD) GHC's .gitlab/ci.shscript is responsible for installing a GHC binary distribution. You'll need to replicate this functionality.
I would be happy to set up a chat to discuss any details if this would be helpful. Alternatively, find me in #ghc on irc.freenode.net.
@samuela, great! Essentially, the task is to write a .gitlab-ci.yml similar to GHC's which uses the same build environments to build and package cabal-install. The GHC build environments already include cabal-install (since it's necessary to build GHC's Hadrian build system) so the task of building cabal-install should be fairly straightforward.
Thanks for all the info! Since this project is hosted on GitHub whereas GHC is hosted on GitLab, we'll need to do something different than .gitlab-ci.yml, right? It looks as though cabal is currently using GitHub Actions and Travis. So is the ultimate goal to do these builds on cabal GH Actions, cabal Travis, or ghc gitlab CI?
@bgamari Oh, I think I may have misunderstood! So your fork lives on gitlab and has a .gitlab-ci.yml file. So which of these CI systems is/should be producing the bindists?
@samuela the plan here is to use GHC's GitLab CI to prepare the cabal-install binary distributions since then we can easily piggy-back on the existing work put into GHC's infrastructure (not to mention, neither GitHub Actions nor Travis support the range of platforms supported by GHC).
Step 10/25 : RUN curl -L https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-armv7-centos7-linux.tar.xz | tar -Jx
---> Running in 1ee41616a1d9
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 217 0 --:--:-- --:--:-- --:--:-- 217
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/bash -o pipefail -c curl -L https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-armv7-centos7-linux.tar.xz | tar -Jx' returned a non-zero code: 2
So we'll need ghc-8.8.3-armv7-centos7-linux.tar.xz first...
@samuela I would say let's stick with building on Debian 9 on ARMv7 and AArch64. We don't currently build CentOS bindists on these platforms; it's something that ideally we would ideally do but this will take time and most people tend to use Debian-based distributions on these platforms anyways.
Ok, I've started some work on this branch. Here are the pipeline results. So far armv7-linux-deb9 and aarch64-linux-deb9 seem to be working but x86_64-freebsd failed.
Hmm, this is unfortunate. Ideally we could just update the Docker image? I guess that would require having the downloads up on downloads.haskell.org? For the sake of this issue should we just go ahead and skip freebsd? Or will we need all the platforms in order to switch over?
I'm a little confused where this CI is supposed to live. We've got a bunch of different repos flying around across GitHub and GitLab! I'm happy to put them wherever. I interpreted this comment to mean that they should be added to GHC's GitLab repo, but perhaps I misunderstood?
I'm a little confused where this CI is supposed to live. We've got a bunch of different repos flying around across GitHub and GitLab! I'm happy to put them wherever. I interpreted this comment to mean that they should be added to GHC's GitLab repo, but perhaps I misunderstood?
Well ARM support could be accomplished through self-hosted runners, which is actually the same as what the GitLab CI does. We could probably scavenge a Raspberry Pi or two to run those. I personally don't care about FreeBSD, but that can be run in docker on an Ubuntu runner, so it's not out of the question. Should we just forge ahead with GitHub Actions then? The work done here can be migrated to use GitHub Actions?
The Raspberry Pi folks seem to be moving towards 64 bit builds, which makes armv7 less important in my mind. Of course aarch64 is still very much needed, and many devices will be running armv7 for a while to come.
Seriously, what kind of passive-aggressive conversation is that? @hasufell, release.py is a lot of, until very recently, actively developed code, of course it does a lot of special things. @phadej: could you please say something less witty, but more useful?
Reacted by davean, Emily Pillmore and Felix van Oost
Or are such recommended options easily available from somewhere else than this script? Or is that the only example of special configuration that cabal install does not set up by default?
there is https://github.com/haskell/cabal/blob/master/cabal.project.release, which however should probably be renamed to cabal.project.bootstrap as it's used for that purpose only atm. And IMO it would be good to have a bootstrap specific cabal.project, as it may be slightly or a lot different then release / other projects, e.g. that optimization is probably not important for bootstrapping (in fact, i'm not sure we need to optimize Cabal at all in boostrapped cabal-install - it depends on what bootstrapped cabal-install is used for)
@Mikolaj there were some pending cuestions like the missing flags you mentioned here: #6616 (comment)
do you think it would need a new issue to track it?
I really appreciate @phadej thoughts on ci exposed here, like
Please send an email to [email protected] to discuss that. I have put way too much time (month of work in the beginning of this year) into current CI setup which works reliably enough to actually be useful but that might be my familiarity bias. GitHub Actions don't offer not-self-run ARM nor FreeBSD runners, so adding them in current setup is not possible. Changing CI is not what I want to be part of. In principle it should be easy, "run ./validate.hs".
And there are other open questions about actual ci, like gitlab artifacts not being tested, but i think they would need new issues (if they do not exists already)
@Mikolaj there were some pending cuestions like the missing flags you mentioned here: #6616 (comment)
do you think it would need a new issue to track it?
Let's let it rest. I was booed into closing a ticket about testing the benefit of these options last time I tried, and the partial test results were strange --- I couldn't apply the options to the actual compilation of the cabal executable despite including them in the used cabal.project. So that would require some extra time, which the collective maintainer is not inclined to donate (but we took a similarly large time arguing why the potential measurements can't show anything useful, if completed).
Regarding scavenging anything of value from validate.hs or release.py or other removed scripts or @phadej skull, that's very worthwhile IMHO, but not trivial. :)
Activity
bgamari commentedon Mar 25, 2020
Anyone interested should get in touch with me. I'm happy to advise.
samuela commentedon Apr 18, 2020
Hey @bgamari I'm interested in taking a stab at this! What needs to be done?
bgamari commentedon Apr 18, 2020
@samuela, great! Essentially, the task is to write a
.gitlab-ci.ymlsimilar to GHC's which uses the same build environments to build and packagecabal-install. The GHC build environments already includecabal-install(since it's necessary to build GHC's Hadrian build system) so the task of buildingcabal-installshould be fairly straightforward.I have put up a quick experiment here. Feel free to use it as a starting point. The remaining work is the following:
findcommand in my experiment) for locating and copying the executableglibc, allowing us to use the same executable across allglibc-based distributions).gitlab-ci.ymlas a template):--enable-split-sectionsto the cabal command lineThe platforms which don't use Docker are a bit tricky; on these platforms (Windows, Darwin, FreeBSD) GHC's
.gitlab/ci.shscript is responsible for installing a GHC binary distribution. You'll need to replicate this functionality.I would be happy to set up a chat to discuss any details if this would be helpful. Alternatively, find me in
#ghconirc.freenode.net.Thanks for volunteering!
hasufell commentedon Apr 18, 2020
- mkdir -p out - cabal update - cabal new-install --install-method=copy --overwrite-policy=always --installdir=$(pwd)/out cabal-installIf you want to use new-build and then find the exe, do:
- mkdir -p out - cabal update - cabal new-build - cp "$(cabal new-exec --verbose=0 --offline sh -- -c 'command -v cabal')" out/cabalbgamari commentedon Apr 18, 2020
Thanks @hasufell! I adopted the
v2-installapproach in my branch.samuela commentedon Apr 18, 2020
Thanks for all the info! Since this project is hosted on GitHub whereas GHC is hosted on GitLab, we'll need to do something different than
.gitlab-ci.yml, right? It looks as though cabal is currently using GitHub Actions and Travis. So is the ultimate goal to do these builds on cabal GH Actions, cabal Travis, or ghc gitlab CI?samuela commentedon Apr 18, 2020
@bgamari Oh, I think I may have misunderstood! So your fork lives on gitlab and has a
.gitlab-ci.ymlfile. So which of these CI systems is/should be producing the bindists?bgamari commentedon Apr 18, 2020
@samuela the plan here is to use GHC's GitLab CI to prepare the
cabal-installbinary distributions since then we can easily piggy-back on the existing work put into GHC's infrastructure (not to mention, neither GitHub Actions nor Travis support the range of platforms supported by GHC).samuela commentedon Apr 19, 2020
Ok, so in order to start adapting https://gitlab.haskell.org/bgamari/cabal-build-test/-/commit/50b81bcf1208dbd7ea566d0a2e0fa428dbdd4d00 to work with centos, we need a new docker image in ci-images. Here's an attempt: https://gitlab.haskell.org/samuela/ci-images/-/commit/b50c3c8049321d8542e7bc29bb03c4e815765621 but it fails with
So we'll need
ghc-8.8.3-armv7-centos7-linux.tar.xzfirst...hasufell commentedon Apr 19, 2020
There is armv7 for https://downloads.haskell.org/~ghc/8.2.2/ (debian 8). You could try to bootstrap from there.
bgamari commentedon Apr 19, 2020
@samuela I would say let's stick with building on Debian 9 on ARMv7 and AArch64. We don't currently build CentOS bindists on these platforms; it's something that ideally we would ideally do but this will take time and most people tend to use Debian-based distributions on these platforms anyways.
samuela commentedon Apr 19, 2020
Ok, I've started some work on this branch. Here are the pipeline results. So far armv7-linux-deb9 and aarch64-linux-deb9 seem to be working but x86_64-freebsd failed.
hasufell commentedon Apr 20, 2020
@samuela nice, a few comments
I think the FreeBSD runner doesn't have a cabal-3.x yet. I also manually update it in the ghcup CI. You can download FreeBSD binaries here: https://hasufell.de/d/d3e215db133e4fcaa61e/ (I signed the hash file). @hvr hasn't responded to my request of adding those tarballs to downloads.haskell.org yet.
I believe the idea was to add this CI in the actual cabal repository and then build the current in-tree version of cabal-install: https://gitlab.haskell.org/bgamari/cabal-build-test I believe your version currently builds from hackage? @phadej there seems to be no cabal mirror on gitlab.haskell.org yet?
samuela commentedon Apr 20, 2020
Hmm, this is unfortunate. Ideally we could just update the Docker image? I guess that would require having the downloads up on downloads.haskell.org? For the sake of this issue should we just go ahead and skip freebsd? Or will we need all the platforms in order to switch over?
I'm a little confused where this CI is supposed to live. We've got a bunch of different repos flying around across GitHub and GitLab! I'm happy to put them wherever. I interpreted this comment to mean that they should be added to GHC's GitLab repo, but perhaps I misunderstood?
bgamari commentedon Apr 20, 2020
@samuela, right, I'm not opposed to updating the Docker image to pull FreeBSD binaries from @hasufell's server for now.
We don't, although it would be nice to do it in one swoop.
No, https://gitlab.haskell.org/bgamari/cabal-build-test is a fork of this repository and builds
Cabalandcabal-installfrom said repository.The idea is that we add a
.gitlab-ci.ymlto this repository (as I did in my experiment). https://gitlab.haskell.org/ can then host a mirror https://github.com/haskell/cabal which CI will run on. The binary artifacts that are produced from this CI can then be used as release artifacts.28 remaining items
samuela commentedon May 23, 2020
Well ARM support could be accomplished through self-hosted runners, which is actually the same as what the GitLab CI does. We could probably scavenge a Raspberry Pi or two to run those. I personally don't care about FreeBSD, but that can be run in docker on an Ubuntu runner, so it's not out of the question. Should we just forge ahead with GitHub Actions then? The work done here can be migrated to use GitHub Actions?
samuela commentedon May 31, 2020
The Raspberry Pi folks seem to be moving towards 64 bit builds, which makes armv7 less important in my mind. Of course aarch64 is still very much needed, and many devices will be running armv7 for a while to come.
gbaz commentedon Oct 6, 2021
I think this is now done?
phadej commentedon Oct 6, 2021
@gbaz, I wouldn't say so. https://github.com/haskell/cabal/blob/6a8c3f80173b71436386d9724b64eb67ccb1cf40/.gitlab/ci.sh doesn't use https://github.com/haskell/cabal/blob/6a8c3f80173b71436386d9724b64eb67ccb1cf40/release.py which is however used in https://github.com/haskell/cabal/blob/master/.github/workflows/artifacts.yml
So there is two ways to produce artifacts...
I'd consider this done when there is only one way to build release artifacts used.
hasufell commentedon Oct 6, 2021
Does
release.pydo anything special?phadej commentedon Oct 6, 2021
Not really, I guess.
Mikolaj commentedon Oct 6, 2021
Seriously, what kind of passive-aggressive conversation is that? @hasufell,
release.pyis a lot of, until very recently, actively developed code, of course it does a lot of special things. @phadej: could you please say something less witty, but more useful?phadej commentedon Oct 6, 2021
@Mikolaj release.py doesn't do anything special, honestly.
It takes some configuration via command line interface
cabal/release.py
Lines 282 to 290 in 6a8c3f8
cabal v2-installas in gitlab setup; https://github.com/haskell/cabal/blob/6a8c3f80173b71436386d9724b64eb67ccb1cf40/.gitlab/ci.sh#L33-l41one benefit of
release.pyis that it can be run on any machine with tools installed (the clean env bit), but you may not value that, and it's fine.Mikolaj commentedon Oct 6, 2021
@phadej: but it has some tested and benchmarked options that have been accumulated over time, right? E.g,
cabal/release.py
Line 169 in 6a8c3f8
Or are such recommended options easily available from somewhere else than this script? Or is that the only example of special configuration that
cabal installdoes not set up by default?phadej commentedon Oct 6, 2021
there is https://github.com/haskell/cabal/blob/master/cabal.project.release, which however should probably be renamed to
cabal.project.bootstrapas it's used for that purpose only atm. And IMO it would be good to have a bootstrap specific cabal.project, as it may be slightly or a lot different then release / other projects, e.g. that optimization is probably not important for bootstrapping (in fact, i'm not sure we need to optimizeCabalat all in boostrappedcabal-install- it depends on what bootstrapped cabal-install is used for)jneira commentedon Mar 11, 2022
for better or worse
release.pydoes not exist anymore, neither https://github.com/haskell/cabal/blob/master/.github/workflows/artifacts.yml.gitlab was used for the last release and likely will be used for the next ones, with the config in https://github.com/haskell/cabal/blob/master/.gitlab-ci.yml and https://github.com/haskell/cabal/tree/master/.gitlab
so i think taking in account the original issue title and this comment from @phadej:
, it would be done
jneira commentedon Mar 11, 2022
@Mikolaj there were some pending cuestions like the missing flags you mentioned here: #6616 (comment)
do you think it would need a new issue to track it?
I really appreciate @phadej thoughts on ci exposed here, like
And there are other open questions about actual ci, like gitlab artifacts not being tested, but i think they would need new issues (if they do not exists already)
Mikolaj commentedon Mar 11, 2022
Let's let it rest. I was booed into closing a ticket about testing the benefit of these options last time I tried, and the partial test results were strange --- I couldn't apply the options to the actual compilation of the cabal executable despite including them in the used cabal.project. So that would require some extra time, which the collective maintainer is not inclined to donate (but we took a similarly large time arguing why the potential measurements can't show anything useful, if completed).
Regarding scavenging anything of value from
validate.hsorrelease.pyor other removed scripts or @phadej skull, that's very worthwhile IMHO, but not trivial. :)