@@ -14,8 +14,81 @@ concurrency:
1414 cancel-in-progress : true
1515
1616jobs :
17+ swiftlint :
18+ name : SwiftLint Analysis
19+ runs-on : macos-latest
20+ steps :
21+ - name : Code Checkout
22+ uses : actions/checkout@v4
23+
24+ - name : Install SwiftLint
25+ run : brew install swiftlint
26+
27+ - name : Run SwiftLint
28+ id : swiftlint
29+ run : |
30+ swiftlint lint --reporter github-actions-logging > swiftlint-report.txt 2>&1 || true
31+ echo "SWIFTLINT_OUTPUT<<EOF" >> $GITHUB_OUTPUT
32+ cat swiftlint-report.txt >> $GITHUB_OUTPUT
33+ echo "EOF" >> $GITHUB_OUTPUT
34+ continue-on-error : true
35+
36+ - name : Upload SwiftLint Report
37+ uses : actions/upload-artifact@v4
38+ if : always()
39+ with :
40+ name : swiftlint-report
41+ path : swiftlint-report.txt
42+
43+ code-signing-check :
44+ name : Code Signing Verification
45+ runs-on : macos-latest
46+ steps :
47+ - name : Code Checkout
48+ uses : actions/checkout@v4
49+
50+ - name : Check Entitlements
51+ id : entitlements
52+ run : |
53+ echo "Checking for entitlements file..."
54+ if [ -f "boringNotch/boringNotch.entitlements" ]; then
55+ echo "✅ Entitlements file found"
56+ echo "ENTITLEMENTS_STATUS=✅ Found" >> $GITHUB_OUTPUT
57+ echo "Contents:"
58+ cat boringNotch/boringNotch.entitlements
59+ else
60+ echo "⚠️ Entitlements file not found"
61+ echo "ENTITLEMENTS_STATUS=⚠️ Not Found" >> $GITHUB_OUTPUT
62+ fi
63+
64+ - name : Check Info.plist
65+ id : infoplist
66+ run : |
67+ echo "Checking for Info.plist..."
68+ if [ -f "boringNotch/Info.plist" ]; then
69+ echo "✅ Info.plist found"
70+ echo "INFOPLIST_STATUS=✅ Found" >> $GITHUB_OUTPUT
71+ else
72+ echo "⚠️ Info.plist not found"
73+ echo "INFOPLIST_STATUS=⚠️ Not Found" >> $GITHUB_OUTPUT
74+ fi
75+
76+ - name : Verify Project Settings
77+ id : project_settings
78+ run : |
79+ echo "Checking project code signing settings..."
80+ if grep -q "CODE_SIGN_IDENTITY" boringNotch.xcodeproj/project.pbxproj; then
81+ echo "✅ Code signing identity configured"
82+ echo "SIGNING_STATUS=✅ Configured" >> $GITHUB_OUTPUT
83+ else
84+ echo "⚠️ Code signing identity not found"
85+ echo "SIGNING_STATUS=⚠️ Not Configured" >> $GITHUB_OUTPUT
86+ fi
87+
1788 build :
1889 name : Build Boring Notch
90+ needs : [swiftlint, code-signing-check]
91+ if : always()
1992 strategy :
2093 matrix :
2194 platform :
@@ -26,14 +99,104 @@ jobs:
2699 - boringNotch
27100 runs-on : macos-latest
28101 steps :
29- - name : Code Checkout
30- uses : actions/checkout@v2
31- - uses : mxcl/xcodebuild@v3
32- with :
33- xcode : ${{ matrix.xcode }}
34- platform : ${{ matrix.platform }}
35- scheme : ${{ matrix.scheme }}
36- action : build
37- verbosity : xcpretty
38- upload-logs : always
39- configuration : release
102+ - name : Code Checkout
103+ uses : actions/checkout@v4
104+
105+ - name : Build with xcodebuild
106+ id : xcodebuild
107+ uses : mxcl/xcodebuild@v3
108+ with :
109+ xcode : ${{ matrix.xcode }}
110+ platform : ${{ matrix.platform }}
111+ scheme : ${{ matrix.scheme }}
112+ action : build
113+ verbosity : xcpretty
114+ upload-logs : always
115+ configuration : release
116+ continue-on-error : true
117+
118+ - name : Extract Build Errors
119+ id : extract_errors
120+ if : failure()
121+ run : |
122+ echo "BUILD_FAILED=true" >> $GITHUB_OUTPUT
123+ echo "Extracting build errors..."
124+ # Try to find and extract error messages from logs
125+ if [ -f "build-log.txt" ]; then
126+ grep -i "error:" build-log.txt | head -20 > build-errors.txt || echo "No specific errors found in logs" > build-errors.txt
127+ else
128+ echo "Build log not found" > build-errors.txt
129+ fi
130+ echo "BUILD_ERRORS<<EOF" >> $GITHUB_OUTPUT
131+ cat build-errors.txt >> $GITHUB_OUTPUT
132+ echo "EOF" >> $GITHUB_OUTPUT
133+
134+ - name : Set Build Success
135+ id : build_success
136+ if : success()
137+ run : |
138+ echo "BUILD_FAILED=false" >> $GITHUB_OUTPUT
139+ echo "✅ Build succeeded!" > build-status.txt
140+ echo "BUILD_STATUS=✅ Success" >> $GITHUB_OUTPUT
141+
142+ comment-pr :
143+ name : Comment on PR
144+ needs : [swiftlint, code-signing-check, build]
145+ if : github.event_name == 'pull_request' && always()
146+ runs-on : ubuntu-latest
147+ permissions :
148+ pull-requests : write
149+ steps :
150+ - name : Download SwiftLint Report
151+ uses : actions/download-artifact@v4
152+ continue-on-error : true
153+ with :
154+ name : swiftlint-report
155+
156+ - name : Create PR Comment
157+ uses : actions/github-script@v7
158+ with :
159+ script : |
160+ const buildStatus = '${{ needs.build.result }}';
161+ const swiftlintStatus = '${{ needs.swiftlint.result }}';
162+ const codeSigningStatus = '${{ needs.code-signing-check.result }}';
163+
164+ let comment = '## 🔍 CI/CD Build Report\n\n';
165+
166+ // Build Status
167+ comment += '### Build Status\n';
168+ if (buildStatus === 'success') {
169+ comment += '✅ **Build Passed**\n\n';
170+ } else if (buildStatus === 'failure') {
171+ comment += '❌ **Build Failed**\n\n';
172+ comment += 'Please check the [build logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.\n\n';
173+ } else {
174+ comment += '⚠️ **Build Status Unknown**\n\n';
175+ }
176+
177+ // SwiftLint Status
178+ comment += '### SwiftLint Analysis\n';
179+ if (swiftlintStatus === 'success') {
180+ comment += '✅ **SwiftLint Passed** - No major issues found\n\n';
181+ } else {
182+ comment += '⚠️ **SwiftLint Warnings** - Check the [SwiftLint report](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details\n\n';
183+ }
184+
185+ // Code Signing Status
186+ comment += '### Code Signing Verification\n';
187+ if (codeSigningStatus === 'success') {
188+ comment += '✅ **Code Signing Configuration Verified**\n\n';
189+ } else {
190+ comment += '⚠️ **Code Signing Issues Detected** - Check the [code signing logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n';
191+ }
192+
193+ comment += '---\n';
194+ comment += `📊 [View Full Report](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n`;
195+
196+ // Post comment
197+ github.rest.issues.createComment({
198+ issue_number: context.issue.number,
199+ owner: context.repo.owner,
200+ repo: context.repo.repo,
201+ body: comment
202+ });
0 commit comments