Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I don't believe it, I spent 4h debugging this, as it was working perfectly fine on my local machine (both on Windows & Ubuntu WSL2), but it kept failing for all Python versions on GitHub Actions, but only for Windows. The root cause turned out to be very simple: CRLF XD In Git there is core.autocrlf option which handles it. In my Windows dotfiles a long time ago I've changed it to `input` which is not the default for this platform. Git on Windows in GitHub Action uses the default option `true`, which means that files are always converted to CRLF which is `\r\n`. And that caused the regex for zettel title to stop matching which caused test failures. And I introduced this bug in a huge commit with almost 500 lines of diff (major refactors FTW) which was the main cause why it took so long to debug. The problematic commit is: e028160 I located it by using a bisect (i.e. binary search) method. But because it was failing only in the CI, I did it manually in ~5 iterations. So it was a bit annoying, but still quite quick. Later, based on the newest main, I reverted the problematic commit resolving a ton of merge conflicts and fixing unit tests, so they work locally and on the pipeline. Having a stable version, I created a new branch from it, and started the investigation. I applied small commits to this branch, making it more and more like the newest main. It took the most time because my reverted commit still was huge I didn't have any clue what was the reason. Lessons learned: - Small commits FTW - If something fails *only on Windows*, CRLF is a good suspect - Read the logs carefully! **The most important one** Before making the revert commit approach, I tried to analyze what's going on in the CI. But if something fails only in CI, debugging is pretty much impossible. I should ask a question why it fails only in CI, and try to fail it somewhere else, where I can attach a debugger. And the worst thing: in the pipeline I still did some debugging with logging AND NOW I SEE THE '\r' IN THE LOG!!! DEBUG root:zettel.py:150 Got zettel: 'Zettel(title='# Zet test entry\r\n', id='20211016205158', tags=('another-tag', 'tag-after-two-spaces', 'test-tag'), path=WindowsPath('testing/zet/zettels/20211016205158/README.md'))' https://github.com/tpwo/pyzet/actions/runs/6789721036/job/18457559890 Unfortunately, I didn't notice it during the log inspection, and that's how 4 hours were wasted. What a lesson!
- Loading branch information