-
Notifications
You must be signed in to change notification settings - Fork 413
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
Issue with (mode promote) in rule-generation and CI interaction #10387
Comments
I think |
Thank you for your response, @emillon ! I understand what you are saying about When in dev mode, I think one would likely use I've been considering if there's a common GitHub Actions CI to run tests that people are using that checks that by the end, there are no uncommitted changes. If so, I would switch to that, and have no issue with However, if the recommended GitHub Actions is simply to run Perhaps the end check can be done using the - name: Check for uncommitted changes
run: git diff --exit-code I plan on experimenting with this, and will let you know how it goes. |
Result from the experimentation in this PR I switched the CI to include the - name: Run tests
run: |
opam exec -- dune runtest
git diff --exit-code and confirmed by comparing two commits in the history, including one that changed the rules. With the extra step, the invalid commit is rejected. I will consider switching to this CI pattern more globally in my repos. My advice is that this may be worth mentioning to the dune doc in the section about I will await to see if you want to bring something to my attention regarding this topic, in case I am confused by something or if there's something else you'd want to advice, otherwise I'm happy to close this issue. Thanks for your help! |
I wanted to report that I enabled a similar check for rejecting uncommitted changes as part of the CI check in all my repos on GitHub and have been running with it for a while now. I am happy with it.
I'll leave up to you to decide whether you think my experience can benefit others. I'm happy with |
Hello,
I'm using dune version
3.14.2
. I recently tried to switch to using(mode promote)
for rule-generation in a project PR.I am following the migration between 2 patterns described here.
That is, making use of
(mode promote)
to avoid the extra promotion step when the generator is modified.See details
Before:
(include dune.inc) (rule (deps (source_tree .)) (with-stdout-to dune.inc.gen (run gen/gen.exe))) (rule (alias runtest) (action (diff dune.inc dune.inc.gen)))
After:
(include dune.inc) (rule (mode promote) (alias runtest) (deps (source_tree .)) (with-stdout-to dune.inc (run gen/gen.exe)))
The diff is:
Issue (cons of new pattern)
I've noticed that when using the new pattern with
(mode promote)
, thedune runtest
command succeeds in the CI even if there are uncommitted changes in the tree at the end. This is different from the previous behavior where the CI would fail ifdune.inc
wasn't stable at a given revision.Possible Solution?
I wonder if it would make sense for the
dune runtest
to still do the promotion in(mode promote)
, but return an exit code of [1] when it had to promote changes (as opposed to [0] when it did not).I'm usually using the following in CI's GitHub actions workflow's configs:
I'm curious if others have run into this and how they handle it. Any insights would be appreciated.
Thank you!
The text was updated successfully, but these errors were encountered: