-
Notifications
You must be signed in to change notification settings - Fork 141
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
Refactor CI avoiding test circular dependencies #227
Conversation
Looks great to me!
…On Wed, May 27, 2020 at 3:26 PM Viktor Dukhovni ***@***.***> wrote:
@sjakobi <https://github.com/sjakobi> @hvr <https://github.com/hvr>
@cartazio <https://github.com/cartazio> @bgamari
<https://github.com/bgamari> @Bodigrim <https://github.com/Bodigrim>
I believe this is ready and makes testing substantially easier going
forward.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#227 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAABBQQDOSW5LXA4ULAHWETRTVSQDANCNFSM4NMNYHUQ>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the load of questions. This is clearly a good direction, I'm just homing in on the details. :)
Also feel free to ignore what seems to go too far! :)
I haven't actually tried to use this locally yet. Would you consider adding instructions on how to build an run the tests to the readme? I'd definitely give those a spin! :)
tests/cabal.project
Outdated
package bytesting-tests | ||
tests: True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not
package bytesting-tests | |
tests: True | |
tests: True |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to test any of our dependencies. I am not sure what the scope of that is, it may cover dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default scope are the packages listed above AFAIK.
cabal.project
Outdated
@@ -0,0 +1,5 @@ | |||
packages: bytestring.cabal | |||
allow-newer: *:bytestring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely there can't be any reverse dependencies of bytestring involved here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing with GHC-head, text
, et. al. needed for the tests want an older bytestring
than the one we're testing, but we want to force them to use the new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this cabal.project
doesn't include the tests?!
.travis.yml
Outdated
- cabal v2-configure; cabal v2-build | ||
- cabal v2-sdist -o . | ||
# Remove to enable build of sdist. | ||
- rm -f cabal.project | ||
- rm -f tests/test-builder.tix | ||
- (cd tests; cabal v2-configure; cabal v2-test) | ||
# "cabal check" disabled due to -O2 warning | ||
- export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; | ||
cd dist/; | ||
if [ -f "$SRC_TGZ" ]; then | ||
cabal install --force-reinstalls "$SRC_TGZ"; | ||
- export SRC=$(cabal info . | awk '{print $2; exit}'); | ||
if [ -f "$SRC.tar.gz" ]; then | ||
cabal get "./$SRC.tar.gz"; | ||
(cd "$SRC"; cabal install --force-reinstalls .); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider simply using https://github.com/haskell-CI/haskell-ci to generate this script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, that might be tricky…
I can give this a spin once this PR has been merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having a devil of a time getting it to work portably between Cabal 2.4, 3.0 and 3.2, not sure the autogenerated one would fare better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it to work, but had to resort to v1-install
with Cabal 3.x, if you figure out a working, non-deprecated syntax, I'm all ears...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compatibility issues like that are a haskell-ci
specialty. ;)
No worries though. Looks like CI is finally green now!
tests/cabal.project
Outdated
@@ -0,0 +1,9 @@ | |||
packages: bytestring-tests.cabal | |||
../bytestring.cabal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why include the bytestring
package here? Doesn't this cause test dependencies to be recompiled after changes to bytestring code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the test frameworks and text need to use the same version of ByteString as being tested. We compiling the tests with code that also uses Text, which uses ByteString, ... that cyclic thing. But here we're build the test module, and bytestring
is just one of the dependencies to build along with the others.
Give it a try:
cd tests
cabal configure
cabal test
then tweak cabal.project
and try again...
Many thanks for responding to my comments above, @vdukhovni! I have, in turn, tried to respond to your responses, but I don't have the necessary permissions to "unresolve" discussions. Would you mind unresolving these things for me? Alternatively, maybe @hvr or @cartazio could give me the necessary permissions. That would be greatly appreciated! :) |
I've |
I just gave this PR as spin on my local machine. The issue that I believe we're close to eliminating now is that after any change to the What we need to do is to keep the local At this point, that's very simple to achieve:
--- a/tests/cabal.project
+++ b/tests/cabal.project
@@ -1,5 +1,4 @@
packages: bytestring-tests.cabal
- ../bytestring.cabal
allow-newer: *:bytestring
, *:ghc-prim Now, rebuilding the tests is super-fast. Great! |
(And thanks for unresolving my earlier comments! It's a bit of a shame that we have to jump through these hoops to collaborate!) |
Rebuilding the test dependencies against the updated
No, we actually need to make sure that we're testing the local
I disagree. Please try for example building Andrew Martin's PR, or the
I disagree, and don't find the time to build tests a deciding factor. |
Ok, I'm curious now. Why ought the test dependencies to be linked against the new/local
I think it's actually pretty important. Note that the |
Are you reachable via any interactive channels? (Skype, Hangouts, Signal)? Please send me an email [email protected]. For me the test runtime from cold start was:
Which is not a barrier to running tests now and then... Builds w/o tests take 16s (cold). |
I've sent you an email. My concern is about interactive development. You're working on some function, and you want to run the tests for that. Recompilation should be as fast as possible then. 1 or even 2 minutes would be very frustrating already. |
ce572c3
to
29567fe
Compare
With great help from @sjakobi I've simplified this further, and expect I've addressed his concerns. The CI should shortly show up green. The cabal.project files are now quite short, and we're no longer rebuilding the test dependencies against the new The only downside is that modules need to be listed in two .cabal files, |
Thanks @vdukhovni. I very much enjoyed our chat! :) FYI, I believe I've found the discussion on the |
Yeah, that would have been nice. But it's been under discussion for 3 years, so I'm not expecting a miracle... I've had to just force push a small fix, it seems I needed a Edit: Finally all green again: https://travis-ci.org/github/haskell/bytestring/builds/692741896?utm_source=github_status&utm_medium=notification Barring any surprises, I'm calling this done. Moving on to better things... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if someone with better bash skills (EDIT: than mine) could review the Travis script.
For local development, this setup seems quite awesome! :)
Again, many thanks, @vdukhovni!
I guess, sadly, my own |
Indeed. I'm looking for a second pair of eyeballs in addition to yours here. My own count for at most half an eye… ,) |
Instead of running tests in the parent "bytestring" project, with circular dependencies from the test frameworks, build and run them in the child `bytestring-tests` project, which builds the parent as a dependency that does not run tests, avoiding all the loops. This requires cabal-install >= 2.4 with cabal.project doing most of the heavy lifting.
Rebased as mentioned in #214 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
We will have to switch to 8.8.4 and 8.10.2 anytime soon, but I guess we can do it in a separate PR as well.
Looks good to me too. |
Thank you, @vdukhovni! :) |
- export SRC=$(cabal info . | awk '{print $2; exit}'); | ||
if [ -f "$SRC.tar.gz" ]; then | ||
cabal get "./$SRC.tar.gz"; | ||
(cd "$SRC"; cabal v2-build); | ||
else | ||
echo "expected '$SRC_TGZ' not found"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, the error message here is not quite right, it should be $SRC.tar.gz
not $SRC_TGZ
which is no longer set. This should not happen, but if it ever did, the error message would be confusing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sjakobi Would you care to fix the error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too worried about it. Feel free to send a PR or open an issue.
Instead of running tests in the parent "bytestring" project, with
circular dependencies from the test frameworks, build and run them in
the child
bytestring-tests
project, which builds the parent as adependency that does not run tests, avoiding all the loops.
This requires cabal-install >= 2.4 with cabal.project doing most of the
heavy lifting.