Skip to content

Commit

Permalink
Deny git dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed May 24, 2024
1 parent f469fbf commit a309136
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/scripts/deny-git-deps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
Script to deny Git dependencies in the Cargo workspace.
## Usage
python3 .github/scripts/deny-git-deps.py polkadot-sdk
"""

import argparse
import os
import sys

from cargo_workspace import Workspace, DependencyLocation

KNOWN_BAD_GIT_DEPS = {
'simple-mermaid': ['xcm-docs'],
# Fix in <https://github.com/paritytech/polkadot-sdk/issues/2922>
'bandersnatch_vrfs': ['sp-core'],
}

root = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
workspace = Workspace.from_path(root)

for crate in workspace.crates:
for dep in crate.dependencies:
if dep.location != DependencyLocation.GIT:
continue

if crate.name in KNOWN_BAD_GIT_DEPS.get(dep.name, []):
print(f'🤨 Ignoring bad git dependency {dep.name} of {crate.name}')
else:
print(f'🚫 Found git dependency {dep.name} of {crate.name}')
sys.exit(1)
2 changes: 2 additions & 0 deletions .github/workflows/checks-quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ jobs:
--exclude
"substrate/frame/contracts/fixtures/build"
"substrate/frame/contracts/fixtures/contracts/common"
- name: deny git deps
run: python3 .github/scripts/deny-git-deps.py .
check-markdown:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down

0 comments on commit a309136

Please sign in to comment.