Skip to content

Commit

Permalink
ci(tdd): check previous tests for fail (#13)
Browse files Browse the repository at this point in the history
If the first commit in a pull request starts with "feat", "fix" or "bug", this action checks whether tests from the main branch failed with the latest version of the binary, as they should. Otherwise the pull request is not covered with tests
  • Loading branch information
pinbraerts authored Dec 15, 2024
1 parent 2ffd88e commit b4d1806
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ jobs:
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: TDD check old tests
run: |
first_commit_hash=$(git rev-list --max-parents=0 HEAD)
first_commit_message=$(git log -1 --pretty=%B $first_commit_hash)
case $first_commit_message in
fix*|feat*|bug*)
git checkout $first_commit_hash~1 -- tests
!cargo test --verbose
;;
esac

0 comments on commit b4d1806

Please sign in to comment.