Document Crashlytics hang reporting and OTel event reporting in READM… #228
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
| name: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - '*' | |
| jobs: | |
| swiftpm-build: | |
| runs-on: macos-26 | |
| steps: | |
| - name: Set Xcode version | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: 26.0 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache Pods | |
| id: cache-pods | |
| uses: actions/cache@v4 | |
| with: | |
| path: Pods | |
| key: ${{ runner.os }}-pods-${{ hashFiles('Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pods- | |
| # we need pods to download SwiftLint | |
| - name: Install CocoaPods | |
| if: steps.cache-pods.outputs.cache-hit != 'true' | |
| run: | | |
| pod install | |
| - name: SwiftLint | |
| run: | |
| Pods/SwiftLint/swiftlint lint --strict | |
| # to compile swift package we should remove workspace and xcodeproj | |
| # otherwise xcodebuild takes schemes from them | |
| - name: Remove workspace | |
| run: | | |
| rm -rf Project.xcodeproj | |
| rm -rf Project.xcworkspace | |
| # DerivedData cache: keyed on Podfile.lock so the cache survives across | |
| # source-only commits — xcodebuild incremental handles whatever changed | |
| # since this baseline. Save runs only on push to main; PRs consume but | |
| # don't overwrite. | |
| - name: Restore DerivedData | |
| id: cache-deriveddata | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: DerivedData | |
| key: ${{ runner.os }}-deriveddata-spm-${{ hashFiles('Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deriveddata-spm- | |
| - name: Compile | |
| run: | | |
| xcodebuild -scheme PerformanceSuite -destination 'generic/platform=iOS' -derivedDataPath DerivedData | |
| xcodebuild -scheme PerformanceSuiteCrashlytics -destination 'generic/platform=iOS' -derivedDataPath DerivedData | |
| xcodebuild -scheme PerformanceSuiteOTel -destination 'generic/platform=iOS' -derivedDataPath DerivedData | |
| xcodebuild -scheme PerformanceApp -destination 'generic/platform=iOS' -derivedDataPath DerivedData | |
| - name: Save DerivedData | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache-deriveddata.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: DerivedData | |
| key: ${{ runner.os }}-deriveddata-spm-${{ hashFiles('Podfile.lock') }} | |
| # restore removed files just in case it is needed for the further steps | |
| - name: Restore workspace | |
| run: | | |
| git checkout -- Project.xcodeproj | |
| git checkout -- Project.xcworkspace | |
| unit-tests: | |
| runs-on: macos-26 | |
| steps: | |
| - name: Set Xcode version | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: 26.0 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache Pods | |
| id: cache-pods | |
| uses: actions/cache@v4 | |
| with: | |
| path: Pods | |
| key: ${{ runner.os }}-pods-${{ hashFiles('Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pods- | |
| - name: Install CocoaPods | |
| if: steps.cache-pods.outputs.cache-hit != 'true' | |
| run: | | |
| pod install | |
| - name: Restore DerivedData | |
| id: cache-deriveddata | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: DerivedData | |
| key: ${{ runner.os }}-deriveddata-unit-${{ hashFiles('Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deriveddata-unit- | |
| - name: Run Unit Tests | |
| env: | |
| scheme: UnitTests | |
| destination: platform=iOS Simulator,name=iPhone 17 Pro,OS=26.4.1 | |
| workspace: Project.xcworkspace | |
| timeout-minutes: 30 | |
| run: | | |
| set -e | |
| echo "Starting unit tests with destination: $destination" | |
| xcodebuild test -scheme "$scheme" -workspace "$workspace" -destination "$destination" -derivedDataPath DerivedData -resultBundlePath UnitTestResults.xcresult | |
| echo "Unit tests completed successfully" | |
| - name: Save DerivedData | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache-deriveddata.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: DerivedData | |
| key: ${{ runner.os }}-deriveddata-unit-${{ hashFiles('Podfile.lock') }} | |
| - name: Upload Unit Test Results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: unit-test-results | |
| path: UnitTestResults.xcresult | |
| retention-days: 30 | |
| - name: Slather | |
| env: | |
| scheme: UnitTests | |
| workspace: Project.xcworkspace | |
| project: Project.xcodeproj | |
| binary_file: DerivedData/Build/Products/Debug-iphonesimulator/PerformanceSuite/PerformanceSuite.framework/PerformanceSuite | |
| build_directory: DerivedData/Build | |
| run: | | |
| gem install slather | |
| slather coverage --simple-output --workspace $workspace --scheme $scheme --binary-file "$binary_file" --build-directory $build_directory $project | grep -E '^Test Coverage|^Tested ' > code_coverage.txt | |
| slather coverage --cobertura-xml --workspace $workspace --scheme $scheme --binary-file "$binary_file" --build-directory $build_directory $project | |
| - name: Upload code_coverage.txt | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: code_coverage.txt | |
| path: code_coverage.txt | |
| - name: Upload cobertura.xml | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cobertura.xml | |
| path: cobertura.xml | |
| ui-tests: | |
| runs-on: macos-26 | |
| steps: | |
| - name: Set Xcode version | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: 26.0 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache Pods | |
| id: cache-pods | |
| uses: actions/cache@v4 | |
| with: | |
| path: Pods | |
| key: ${{ runner.os }}-pods-${{ hashFiles('Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pods- | |
| - name: Install CocoaPods | |
| if: steps.cache-pods.outputs.cache-hit != 'true' | |
| run: | | |
| pod install | |
| - name: Restore DerivedData | |
| id: cache-deriveddata | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: DerivedData | |
| key: ${{ runner.os }}-deriveddata-ui-${{ hashFiles('Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deriveddata-ui- | |
| - name: Run UI Tests | |
| env: | |
| scheme: UITests | |
| destination: platform=iOS Simulator,name=iPhone 17 Pro,OS=26.4.1 | |
| workspace: Project.xcworkspace | |
| timeout-minutes: 30 | |
| run: | | |
| set -e | |
| echo "Starting UI tests with destination: $destination" | |
| xcodebuild test -scheme "$scheme" -workspace "$workspace" -destination "$destination" -derivedDataPath DerivedData -resultBundlePath UITestResults.xcresult SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) PERFORMANCE_TESTS' | |
| echo "UI tests completed successfully" | |
| - name: Save DerivedData | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache-deriveddata.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: DerivedData | |
| key: ${{ runner.os }}-deriveddata-ui-${{ hashFiles('Podfile.lock') }} | |
| - name: Upload UI Test Results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: ui-test-results | |
| path: UITestResults.xcresult | |
| retention-days: 30 | |
| coverage-report: | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| steps: | |
| - name: Download cobertura.xml | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cobertura.xml | |
| - name: Code coverage markdown report | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| with: | |
| filename: cobertura.xml | |
| badge: true | |
| fail_below_min: true | |
| format: markdown | |
| hide_branch_rate: false | |
| hide_complexity: true | |
| output: both | |
| thresholds: '75 85' | |
| - name: Add Coverage PR Comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md | |
| - name: Upload code-coverage-results.md | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: code-coverage-results.md | |
| path: code-coverage-results.md | |
| coverage-badge: | |
| if: github.ref == 'refs/heads/main' | |
| needs: unit-tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: badges | |
| - name: Download code_coverage.txt | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: code_coverage.txt | |
| - name: Commit code_coverage.txt | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| if [[ `git status --porcelain` ]]; then | |
| git add code_coverage.txt | |
| git commit -m "Update code_coverage.txt" | |
| git push | |
| else | |
| echo "No changes to code coverage" | |
| fi | |
| - name: Load coverage data | |
| id: load-coverage | |
| run: | | |
| echo "coverage=$(cat code_coverage.txt | grep -o -E '[0-9\.]+%' | awk '{print $1}')" >> $GITHUB_OUTPUT | |
| - name: Make Coverage Badge | |
| uses: action-badges/core@0.3.1 | |
| with: | |
| label: coverage | |
| message: "${{ steps.load-coverage.outputs.coverage }}" | |
| message-color: brightgreen | |
| file-name: code_coverage.svg | |
| badge-branch: badges | |
| github-token: "${{ secrets.GITHUB_TOKEN }}" |