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

Implement --matrix-extra for more matrix dimensions #462

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

frasertweedale
Copy link

@frasertweedale frasertweedale commented Jan 7, 2021

Sometimes you need to test your project along more dimensions than just GHC
version. This is particularly important for programs/libraries that use
FFI to bind to libraries - they might need to be tested against a range of
library versions.

In general, you want to test all the combinations of GHC versions and other
properties, i.e. the cartesian product. It is burdensome for maintainers
that need such a strategy to manually adjust the matrix after every
(re)generation of the CI script/spec. Better support for this scenario in
haskell-ci is warranted.

This commit implements a new --matrix-extra option, which adds additional
matrix dimensions. The option value format is:

--matrix-extra libfoo:2.6,3.0;libbar:0.1,0.2

haskell-ci adds all the combinations of GHC version and the
--matrix-extra fields to the matrix. Corresponding build/test steps can be
introduced via --github-patches (or --travis-patches).

This commit implements this feature for GitHub actions only. It can be
implemented for Travis in a subsequent commit, if desired.

@phadej
Copy link
Collaborator

phadej commented Jan 7, 2021

Please don't add new packages to test-suite, if not strictly necessary. I wonder what notmuch is (it's far from obvious it is a library name).

@frasertweedale
Copy link
Author

frasertweedale commented Jan 7, 2021

Please don't add new packages to test-suite, if not strictly necessary. I wonder what notmuch is (it's far from obvious it is a library name).

notmuch is a mail indexer. I maintain a Haskell binding. It's one of the projects this PR will help with - for testing with different versions of libnotmuch.

I wanted a .cabal with shorter Tested-With list, so the cartesian product is not huge. All existing .cabal files in the tests have long lists. Perhaps I can make a small bogus package .cabal to test with? (FWIW GitHub actions enforces a limit of 256 matrix legs.)

Are you comfortable with the general approach of this PR? Are there any other changes you would like to make? (naming, etc?) I'm about to crash for the night but I'll address all your feedback tomorrow.

@phadej
Copy link
Collaborator

phadej commented Jan 7, 2021

I'm not sure. I feel that then someone would ask to have away to filter the cartesian product etc. I have to think about this properly.

@frasertweedale
Copy link
Author

@phadej some final arguments in support of this feature:

  • Right now, if you need to expand the matrix you are doomed to manually do it yourself every time you want to update the GHC versions. This PR solves the simple case of this problem (i.e. when you want the full cartesian product).
  • If you want to filter, or add extra jobs to the matrix, it can be done with exclude and include specifications. These fields could be added via a --github-patches patch, so that even without explicit support in haskell-ci, the desired outcome can be achieved with minimal ongoing maintainer intervention.

I hope you will decide in favour of this feature. Let me know of any changes you would like.

@frasertweedale
Copy link
Author

Rebased to resolve merge conflicts.

@frasertweedale
Copy link
Author

-_- I'll sort out those failing tests on the weekend, hopefully!

@frasertweedale
Copy link
Author

frasertweedale commented Sep 6, 2022

I am reviving this PR. The need still exists (and always will).

I changed the tests to avoid adding notmuch. The golden tests now use splitmix instead.

I also added a check (with corresponding test) that the matrix size does not exceed GitHub's limit of 256 jobs.
This test also uses splitmix. However, we may eventually need to use a different .cabal file with more constrained
Tested-With - there are currently 51 GHC versions. With matrix-extra of size 2 x 2 the size of the matrix is already
> 200 and approaching the limit.

@frasertweedale
Copy link
Author

@phadej ping - could you please review and consider merging this PR?

Sometimes you need to test your project along more dimensions than
just GHC version.  This is particularly important for
programs/libraries that use FFI to bind to libraries - they might
need to be tested against a range of library versions.

In general, you want to test all the combinations of GHC versions
and other properties, i.e. the cartesian product.  It is burdensome
for maintainers that need such a strategy to manually adjust the
matrix after every (re)generation of the CI script/spec.  Better
tool support for this scenario is warranted.

This commit implements a new --matrix-extra option, which adds
additional matrix dimensions.  The option value format is:

  --matrix-extra libfoo:2.6,3.0;libbar:0.1,0.2

haskell-ci adds all the combinations of GHC version and the
--matrix-extra fields to the matrix.  Corresponding build/test steps
can be introduced via --github-patches (or --travis-patches).

This commit implements this feature for GitHub actions only.  It can
be implemented for Travis in a subsequent commit, if desired.
GitHub has a limit of 256 jobs.  Validate that the size of the
matrix does not exceed this limit.
@frasertweedale
Copy link
Author

frasertweedale commented Nov 3, 2023

Annual ping... I have rebased and resolved conflicts (waiting to see if tests pass - will address them if not) and once again ask for a determination about this PR.

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

Successfully merging this pull request may close these issues.

2 participants