-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use bash strict mode in all CI scripts (#2012)
"Bash strict mode" is a colloquial expression for a set of settings that makes Bash stricter (safer). See e.g. https://gist.github.com/robin-a-meade/58d60124b88b60816e8349d1e3938615 TLDR: to avoid errors from being silently ignored, we should set errexit (exit script on error), nounset (exit script when an undefined variable is encountered) and pipefail (propagate error codes in pipelines) in all our scripts. Unfortunately, `errexit` is in fact not enough to exit when any error occurs, some errors are swallowed: https://dev.to/banks/stop-ignoring-errors-in-bash-3co5 Because of this, I changed the whitespace script to gather the files in a different way (I copied the approach from the clang-format script), such that the script will exit when an error occurs, instead of continuing to run. The whitespace script was missing a fetch which was causing `git merge-base` to fail. Maybe our other scripts should also be updated to only run on changed files. Interestingly, GitHub already sets `-e` (`errexit`) when running scripts, but it's best to enforce it in the script itself: ``` Run ./build_tools/github_actions/lint_whitespace_checks.sh ./build_tools/github_actions/lint_whitespace_checks.sh shell: /usr/bin/bash -e {0} ``` Fixes #2010
- Loading branch information
mlevesquedion
authored
Feb 17, 2024
1 parent
feb49e3
commit 5943c6b
Showing
12 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters