1+ name : Hard Boundary Enforcement for APK Build
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - partitioned-main
7+ types : [opened, synchronize, reopened]
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.ref }}
11+ cancel-in-progress : true
12+
13+ jobs :
14+ hard-boundary-checks :
15+ runs-on : ubuntu-latest
16+ outputs :
17+ security-approved : ${{ steps.security.outputs.approved }}
18+ architecture-approved : ${{ steps.architecture.outputs.approved }}
19+ permissions-approved : ${{ steps.permissions.outputs.approved }}
20+
21+ steps :
22+ - name : Checkout Code
23+ uses : actions/checkout@v4
24+
25+ - name : Hard Boundary - Security Check
26+ id : security
27+ run : |
28+ echo "Enforcing security compliance..."
29+
30+ # Mandatory security checks - these are absolute requirements
31+ if ! grep -q "uses-permission.*INTERNET" src/main/AndroidManifest.xml; then
32+ echo "ERROR: INTERNET permission is mandatory but missing"
33+ echo "approved=false" >> $GITHUB_OUTPUT
34+ exit 1
35+ fi
36+
37+ if ! grep -q "uses-permission.*WRITE_EXTERNAL_STORAGE" src/main/AndroidManifest.xml; then
38+ echo "ERROR: WRITE_EXTERNAL_STORAGE permission is mandatory but missing"
39+ echo "approved=false" >> $GITHUB_OUTPUT
40+ exit 1
41+ fi
42+
43+ if grep -q "android:allowBackup=\"false\"" src/main/AndroidManifest.xml; then
44+ echo "ERROR: allowBackup must be true for development environment"
45+ echo "approved=false" >> $GITHUB_OUTPUT
46+ exit 1
47+ fi
48+
49+ echo "Security checks passed - hard boundaries maintained"
50+ echo "approved=true" >> $GITHUB_OUTPUT
51+
52+ - name : Hard Boundary - Architecture Check
53+ id : architecture
54+ run : |
55+ echo "Enforcing architecture compliance..."
56+
57+ # Check for required architecture components
58+ if [ ! -f "src/main/java/com/superlab/quantumide/MainActivity.java" ]; then
59+ echo "ERROR: MainActivity.java is mandatory component missing"
60+ echo "approved=false" >> $GITHUB_OUTPUT
61+ exit 1
62+ fi
63+
64+ if [ ! -d "web-terminal" ]; then
65+ echo "ERROR: web-terminal directory is mandatory for hybrid app"
66+ echo "approved=false" >> $GITHUB_OUTPUT
67+ exit 1
68+ fi
69+
70+ if [ ! -f "src/main/res/layout/activity_main.xml" ]; then
71+ echo "ERROR: Main activity layout is mandatory"
72+ echo "approved=false" >> $GITHUB_OUTPUT
73+ exit 1
74+ fi
75+
76+ echo "Architecture checks passed - hard boundaries maintained"
77+ echo "approved=true" >> $GITHUB_OUTPUT
78+
79+ - name : Hard Boundary - Permissions Check
80+ id : permissions
81+ run : |
82+ echo "Enforcing permissions compliance..."
83+
84+ # Count minimum required permissions
85+ permission_count=$(grep -c "uses-permission" src/main/AndroidManifest.xml || echo 0)
86+ if [ $permission_count -lt 3 ]; then
87+ echo "ERROR: Insufficient permissions - minimum 3 required"
88+ echo "approved=false" >> $GITHUB_OUTPUT
89+ exit 1
90+ fi
91+
92+ echo "Permissions checks passed - hard boundaries maintained"
93+ echo "approved=true" >> $GITHUB_OUTPUT
94+
95+ enforce-build-readiness :
96+ runs-on : ubuntu-latest
97+ needs : [hard-boundary-checks]
98+ if : |
99+ ${{ needs.hard-boundary-checks.outputs.security-approved == 'true' &&
100+ needs.hard-boundary-checks.outputs.architecture-approved == 'true' &&
101+ needs.hard-boundary-checks.outputs.permissions-approved == 'true' }}
102+ steps :
103+ - name : Confirm Hard Boundary Compliance
104+ run : |
105+ echo "ALL HARD BOUNDARIES ENFORCED AND COMPLIANT"
106+ echo "Build readiness confirmed by mandatory checks"
107+
108+ hard-fail-on-violation :
109+ runs-on : ubuntu-latest
110+ if : |
111+ ${{ needs.hard-boundary-checks.outputs.security-approved == 'false' ||
112+ needs.hard-boundary-checks.outputs.architecture-approved == 'false' ||
113+ needs.hard-boundary-checks.outputs.permissions-approved == 'false' }}
114+ steps :
115+ - name : Enforce Hard Compliance Failure
116+ run : |
117+ echo "HARD BOUNDARY VIOLATION DETECTED"
118+ echo "Security approved: ${{ needs.hard-boundary-checks.outputs.security-approved }}"
119+ echo "Architecture approved: ${{ needs.hard-boundary-checks.outputs.architecture-approved }}"
120+ echo "Permissions approved: ${{ needs.hard-boundary-checks.outputs.permissions-approved }}"
121+ echo "PR blocked by hard boundary enforcement system"
122+ exit 1
123+
124+ fsm-state-verification :
125+ runs-on : ubuntu-latest
126+ needs : [hard-boundary-checks]
127+ if : ${{ needs.hard-boundary-checks.outputs.security-approved == 'true' &&
128+ needs.hard-boundary-checks.outputs.architecture-approved == 'true' &&
129+ needs.hard-boundary-checks.outputs.permissions-approved == 'true' }}
130+ steps :
131+ - name : FSM Enforcement - Compliance Verified
132+ run : |
133+ echo "FSM State: COMPLIANT"
134+ echo "Hard boundaries locked and verified"
135+ echo "Permitted to proceed with build process"
0 commit comments