Topic: Travis codechecking misbehaviour
Nordfriese Topic Opener |
Posted at: 2020-01-30, 20:04
Can anybody make sense of this travis log?
I added Top Quote |
hessenfarmer |
Posted at: 2020-01-30, 21:30
problem is that our format script works differently on different machines. for this it was automated in former times on our bunnybot. This doesn't work on travis currently as travis can't write its changes back to github. I believe we need to find a way to do exactly this: writing the changes back to github and commit them. Top Quote |
Nordfriese Topic Opener |
Posted at: 2020-01-30, 21:49
Thanks for the explanation I normally format the files automatically with the git hook on my linux, but ATM I only have my windows machine for sporadic fixes available. Now I am really missing good old bunnybot... Perhaps we could hack together a script to let github run clang-format on PRs and master using this: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-github-actions What I still don´t understand though is why travis reports the file as changed while simultanously outputting that Top Quote |
Nordfriese Topic Opener |
Posted at: 2020-01-30, 22:11
Yes, I think actions are the way to go. I´ll try to hack together a script to make github automatically run fix_formatting whenever a branch is pushed so we won´t always have to worry about the one platform-dependant extra whitespace. Top Quote |
Nordfriese Topic Opener |
Posted at: 2020-01-31, 10:29
I succeeded in letting GitHub automatically run clang-format whenever I push to my widelands fork. Now I "only" have to extend the script to commit and push the changes back to the branch. The formatting takes about 4-5 minutes due to the need to set up python and clang-format, is this an acceptable delay? Edited: 2020-01-31, 12:52
Top Quote |
hessenfarmer |
Posted at: 2020-01-31, 10:55
It takes almost that long on my dev machine as well so this isn't too bad. We should only avoid pushing until it is finished. And we need tu pull before the next push. So this should probably only happen for Pull Requests instead of branches. Top Quote |
Nordfriese Topic Opener |
Posted at: 2020-01-31, 10:59
I think if you push while the formatting is running, a running job might be automatically cancelled. Still have to test whether this works.
Good point, will try to implement such a filter Top Quote |
Nordfriese Topic Opener |
Posted at: 2020-01-31, 17:07
Turns out that workflows are not automatically cancelled, so I added a check for remote updates in which the outdated workflow just exits with 1. There´s still a time window of a few seconds where this might be problematic, but it should then just result in a "branches have diverged" error and cancel in the "old" workflow while the "new" workflow succeeds. Pull requests are more problematic. Top Quote |
stonerl |
Posted at: 2020-01-31, 17:52
I don't think that this is machine dependent. Here is the diff after running codechek:
It is dependent on the clang-format version. I guess travis runs a newer version than you do. Here is the one I run:
Top Quote |
Nordfriese Topic Opener |
Posted at: 2020-01-31, 18:10
Thanks for the diff But my current machine doesn´t find a newer clang-format than I´ve found a way to check in my script for whether the branch has an open pull request, so my workflow is now starting after every push to every branch, and it cancels immediately unless it´s the Top Quote |