From 6787db8a628f3d238f62af61c14b70496131076e Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Tue, 15 Mar 2022 15:16:23 +0300 Subject: [PATCH] .github: extend interop deps check Signed-off-by: Evgeniy Stratonikov --- .github/workflows/run_tests.yml | 2 +- scripts/check_deps.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 scripts/check_deps.sh diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index eaa0b80df..22bf1f610 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -35,7 +35,7 @@ jobs: fetch-depth: 0 - name: Check dependencies 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: name: Coverage diff --git a/scripts/check_deps.sh b/scripts/check_deps.sh new file mode 100755 index 000000000..1c3c7567f --- /dev/null +++ b/scripts/check_deps.sh @@ -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