Skip to content

fix: use OS=latest for simulator destinations in CI #7

fix: use OS=latest for simulator destinations in CI

fix: use OS=latest for simulator destinations in CI #7

Workflow file for this run

# 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_16.2.app/Contents/Developer
XCODEGEN_VERSION: "2.38.0"
jobs:
# Gate 1: Swift lint and format check
lint:
name: SwiftLint
runs-on: macos-15
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-15
needs: lint
strategy:
matrix:
include:
- scheme: Thump
destination: "platform=iOS Simulator,name=iPhone 16 Pro,OS=latest"
- scheme: ThumpWatch
destination: "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=latest"
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: |
set -o pipefail
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-15
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: |
set -o pipefail
cd apps/HeartCoach
xcodebuild test \
-project Thump.xcodeproj \
-scheme Thump \
-destination "platform=iOS Simulator,name=iPhone 16 Pro,OS=latest" \
-enableCodeCoverage YES \
-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
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