.github: extend interop deps check

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2022-03-15 15:16:23 +03:00
parent 5379ef75bb
commit 6787db8a62
2 changed files with 29 additions and 1 deletions

View file

@ -35,7 +35,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Check dependencies - name: Check dependencies
run: | run: |
find -name go.mod | xargs -n1 grep -o 'pkg/interop v\S*' | uniq | wc -l | xargs -I{} -n1 [ 1 -eq {} ] || { echo "Different versions for dependencies in go.mod" && exit 1; } ./scripts/check_deps.sh
test_cover: test_cover:
name: Coverage name: Coverage

28
scripts/check_deps.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/sh
die() {
echo "$*"
exit 1
}
find -name go.mod -print0 |
xargs -0 -n1 grep -o 'pkg/interop v\S*' |
uniq | wc -l |
xargs -I{} -n1 [ 1 -eq {} ] ||
die "Different versions for dependencies in go.mod"
INTEROP_COMMIT="$(sed -E -n -e 's/.*pkg\/interop.+-.+-(\w+)/\1/ p' go.mod)"
git merge-base --is-ancestor "$INTEROP_COMMIT" HEAD ||
die "pkg/interop commit $INTEROP_COMMIT was not found in git"
for dir in examples/*/; do
INTEROP_COMMIT="$(sed -E -n -e 's/.*pkg\/interop.+-.+-(\w+)/\1/ p' "$dir/go.mod")"
git merge-base --is-ancestor "$INTEROP_COMMIT" HEAD ||
die "$dir: pkg/interop commit $INTEROP_COMMIT was not found in git"
if [ -z "${dir#*nft-nd-nns/}" ]; then
NEO_GO_COMMIT="$(sed -E -n -e 's/.*neo-go\s.+-.+-(\w+)/\1/ p' "$dir/go.mod")"
git merge-base --is-ancestor "$NEO_GO_COMMIT" HEAD ||
die "$dir: neo-go commit $NEO_GO_COMMIT was not found in git"
fi
done