Skip to content

Commit

Permalink
WIP: ci: Make sure tests-pass is always run
Browse files Browse the repository at this point in the history
A GitHub action job is marked as success when it is skipped. The `needs` rule means that this job is skipped when one of the tests fails. Therefore, the required job `tests-pass` will never block a PR from merging.

> When a job fails, any jobs that depend on the failed job are skipped and do not report a failure. A pull request that requires the check may not be blocked. To use a required check on a job that depends on other jobs, use the `always()` conditional expression in addition to `needs`, see "Using jobs in a workflow."

Source: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
  • Loading branch information
caspermeijn committed Sep 13, 2024
1 parent 9fa3f2e commit c63eeae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ jobs:
tests-pass:
name: all systems go
runs-on: ubuntu-latest
if: always()
env:
RESULT_CODE: ${{ success() && 0 || 1 }}
needs:
- rustfmt
- toml_validation
- clippy
- docs
- machete
- unused_dependencies
- test
- msrv
- minimal-versions
- kani
- no-std
# - clippy
# - docs
# - machete
# - unused_dependencies
# - test
# - msrv
# - minimal-versions
# - kani
# - no-std
- check-readme
steps:
- run: exit 0
- run: exit $RESULT_CODE

rustfmt:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions prost-build/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,8 @@ mod tests {
let mut config = Config::new();
config.protoc_executable("src/lib.rs");

// This line needs to be formatted

let err = config.load_fds(&[""], &[""]).unwrap_err();
assert_starts_with!(err.to_string(), "failed to invoke protoc (hint: https://docs.rs/prost-build/#sourcing-protoc): (path: src/lib.rs): ")
}
Expand Down

0 comments on commit c63eeae

Please sign in to comment.