fix: resolve all SwiftLint violations across codebase #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CI Pipeline for Thump (HeartCoach) | |
| # Runs lint checks, builds iOS and watchOS targets, and executes unit tests. | |
| # Triggered on push to main and feature branches, and on pull requests. | |
| name: CI | |
| on: | |
| push: | |
| branches: [main, 'chore/**', 'feature/**', 'fix/**'] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer | |
| XCODEGEN_VERSION: "2.38.0" | |
| jobs: | |
| # Gate 1: Swift lint and format check | |
| lint: | |
| name: SwiftLint | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install SwiftLint | |
| run: brew install swiftlint | |
| - name: Run SwiftLint | |
| run: | | |
| cd apps/HeartCoach | |
| swiftlint lint --strict --reporter github-actions-logging | |
| # Gate 2: Build iOS and watchOS targets | |
| build: | |
| name: Build (${{ matrix.scheme }}) | |
| runs-on: macos-14 | |
| needs: lint | |
| strategy: | |
| matrix: | |
| include: | |
| - scheme: Thump | |
| destination: "platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5" | |
| - scheme: ThumpWatch | |
| destination: "platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.5" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install XcodeGen | |
| run: brew install xcodegen | |
| - name: Generate Xcode Project | |
| run: | | |
| cd apps/HeartCoach | |
| xcodegen generate | |
| - name: Build | |
| run: | | |
| cd apps/HeartCoach | |
| xcodebuild build \ | |
| -project Thump.xcodeproj \ | |
| -scheme "${{ matrix.scheme }}" \ | |
| -destination "${{ matrix.destination }}" \ | |
| -configuration Debug \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| | xcpretty --color | |
| # Gate 3: Run unit tests | |
| test: | |
| name: Unit Tests | |
| runs-on: macos-14 | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install XcodeGen | |
| run: brew install xcodegen | |
| - name: Generate Xcode Project | |
| run: | | |
| cd apps/HeartCoach | |
| xcodegen generate | |
| - name: Run Tests | |
| run: | | |
| cd apps/HeartCoach | |
| xcodebuild test \ | |
| -project Thump.xcodeproj \ | |
| -scheme Thump \ | |
| -destination "platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5" \ | |
| -resultBundlePath TestResults.xcresult \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| | xcpretty --color --test | |
| - name: Extract Code Coverage | |
| if: success() | |
| run: | | |
| cd apps/HeartCoach | |
| xcrun xccov view --report --json TestResults.xcresult > coverage_report.json | |
| # Print summary to CI log | |
| echo "## Code Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| xcrun xccov view --report TestResults.xcresult | head -30 >> $GITHUB_STEP_SUMMARY | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| apps/HeartCoach/TestResults.xcresult | |
| apps/HeartCoach/coverage_report.json | |
| retention-days: 7 |