Skip to content

Instantly share code, notes, and snippets.

@Makman2
Last active July 25, 2017 20:39
Show Gist options
  • Save Makman2/76eb543293d4571852ab to your computer and use it in GitHub Desktop.
Save Makman2/76eb543293d4571852ab to your computer and use it in GitHub Desktop.
Allows to invoke a test-step for each commit made.
#!/bin/bash
set -e
# The test invocation.
function test_step {
echo "Updating setup.cfg..."
sed -i -e "s/ --cov//g" setup.cfg
py.test -k core
git reset --hard
}
# -------------------------------------------------
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
commits=$(git log --pretty=format:"%h" master..HEAD)
echo "Commits being tested:"
git log --oneline master..HEAD
echo "$commits" | while read -r commit
do
git checkout $commit
test_step
done
git checkout $branch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment