Skip to content

Commit

Permalink
Merge pull request bitcoin-core#27 from dongcarl/2021-06-ci-check
Browse files Browse the repository at this point in the history
ci: Add sanity check
  • Loading branch information
MarcoFalke authored Jun 24, 2021
2 parents 027fa49 + fcf7a74 commit affd22d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
container:
image: ubuntu:focal
lint_task:
only_if: $CIRRUS_BASE_BRANCH == 'main'
lint_script: ./contrib/files-touched-check
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.SHA256SUMS -text -diff
*.SHA256SUMS.asc -text -diff
34 changes: 34 additions & 0 deletions contrib/files-touched-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
export LC_ALL=C
set -e -o pipefail
export TZ=UTC

while read -r status name; do

case "$name" in
README.md) continue ;;
contrib/*) continue ;;
21.99-guixtest1/*) continue ;; # guixtest1 used a different hierarchy
esac

if [ "$status" != "A" ]; then
echo "ERR: File status is not 'A' (for add): '$status'"
exit 1
fi

if [[ $name =~ ^[^/]+/[^/]+/[^/]+.SHA256SUMS(|.asc)$ ]]; then
if [ -z "$last_prefix" ]; then
last_prefix="$(dirname "$name")"
continue
elif [ "$last_prefix" = "$(dirname "$name")" ]; then
continue
else
echo "ERR: Added files need to be under the same prefix: '${last_prefix}'"
exit 1
fi
else
echo "ERR: Added unknown file '$name'"
exit 1
fi

done < <(git diff --no-commit-id --name-status -r "${1:-${CIRRUS_BASE_SHA}...HEAD}")

0 comments on commit affd22d

Please sign in to comment.