Skip to content

Commit

Permalink
feat: distinct module and package checks
Browse files Browse the repository at this point in the history
  • Loading branch information
boojamya committed Sep 23, 2024
1 parent dc7f622 commit 75f6d0d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/module-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ on:
pull_request:

env:
# comma separated list of restricted Go modules
RESTRICTED_MODULES: "cosmossdk.io/x/circuit"
# comma separated list of restricted Go modules/packages
RESTRICTED_MODULES: "cosmossdk.io/x/circuit, cosmossdk.io/x/group"
RESTRICTED_PACKAGES: "github.com/cosmos/cosmos-sdk/x/gov, github.com/cosmos/cosmos-sdk/x/group"

jobs:
go-mod-check:
Expand All @@ -33,3 +34,17 @@ jobs:
exit 1
fi
done
for PACKAGE in "${RESTRICTED_PACKAGES[@]}"; do
OUTPUT=$(go mod why -vendor "$PACKAGE")
if echo "$OUTPUT" | grep -q "main module does not need to vendor package $PACKAGE"; then
echo "$PACKAGE is not imported ✓"
# if the shortest import path is the E2E suite, is is safe to assume the package is not used in the main module
elif echo "$OUTPUT" | grep -q "github.com/noble-assets/noble/e2e"; then
echo "$PACKAGE is not imported into main Noble module ✓"
else
echo "$PACKAGE is currently restricted as an import in Noble ✘"
exit 1
fi
done

0 comments on commit 75f6d0d

Please sign in to comment.