add ci check for restricted imports that would prevent monero.com from building (#2093)
cherry picked from old bgsync pr
cyan committed
Mar 19, 2025 at 01:01 UTC
cec414e44bd3dea69c36816fa4621768b3a9a6d8
1 file changed
+47
.github/workflows/no_restricted_imports.yaml
new
+47
@@ -0,0 +1,47 @@
1
+name: No restricted imports in lib directory
2
+
3
+on: [pull_request]
4
+
5
+jobs:
6
+ check_restricted_imports:
7
+ runs-on: ubuntu-20.04
8
+
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - name: Check for restricted imports in lib directory
12
+ if: github.event_name == 'pull_request'
13
+ run: |
14
+ RESTRICTED_PACKAGES=(
15
+ "cw_bitcoin"
16
+ "cw_bitcoin_cash"
17
+ "cw_ethereum"
18
+ "cw_evm"
19
+ "cw_haven"
20
+ "cw_mweb"
21
+ "cw_nano"
22
+ "cw_polygon"
23
+ "cw_solana"
24
+ "cw_tron"
25
+ "cw_wownero"
26
+ "cw_zano"
27
+ )
28
+
29
+ FOUND_RESTRICTED=false
30
+
31
+ for package in "${RESTRICTED_PACKAGES[@]}"; do
32
+ GREP_RESULT=$(find lib -type f -name "*.dart" -exec grep -l "import.*package:$package" {} \; || true)
33
+
34
+ if [ -n "$GREP_RESULT" ]; then
35
+ echo "Found restricted import of '$package' in the following files:"
36
+ echo "$GREP_RESULT"
37
+ FOUND_RESTRICTED=true
38
+ fi
39
+ done
40
+
41
+ if [ "$FOUND_RESTRICTED" = true ]; then
42
+ echo "Error: Restricted package imports found in lib/ directory"
43
+ echo "Please remove these imports as they are not allowed in the lib/ directory"
44
+ exit 1
45
+ else
46
+ echo "No restricted imports found. All good!"
47
+ fi
\ No newline at end of file