|
| 1 | +name: Report Code Coverage |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + unit-tests: |
| 9 | + name: All SDK Unit Tests |
| 10 | + runs-on: macos-12 |
| 11 | + continue-on-error: true |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 |
| 14 | + - name: Run AWS SDK Unit Tests |
| 15 | + run: xcodebuild test -project AWSiOSSDKv2.xcodeproj -scheme AWSAllUnitTests -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} |
| 16 | + - name: Generate SDK Coverage Report |
| 17 | + run: | |
| 18 | + cd Build/Build/ProfileData |
| 19 | + cd $(ls -d */|head -n 1) |
| 20 | + pathCoverage=${{ github.workspace }}/Build/Build/ProfileData/${PWD##*/}/Coverage.profdata |
| 21 | + devicePath=${{ github.workspace }}/Build/Build/Products/Debug-iphonesimulator |
| 22 | + cd $devicePath |
| 23 | + for FRAMEWORK in $(basename -a -s .framework -- *.framework) |
| 24 | + do |
| 25 | + echo "Generating coverage report for $FRAMEWORK..." |
| 26 | + xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage $devicePath/$FRAMEWORK.framework/$FRAMEWORK >> aws-sdk-ios-Coverage.lcov |
| 27 | + done |
| 28 | + mv aws-sdk-ios-Coverage.lcov ${{ github.workspace }} |
| 29 | + - name: Run AWS Auth SDK Unit Tests |
| 30 | + run: xcodebuild test -project AWSAuthSDK/AWSAuthSDK.xcodeproj -scheme AWSMobileClient -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES -only-testing:"AWSMobileClientUnitTests" | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} |
| 31 | + - name: Generate Auth SDK Coverage Report |
| 32 | + run: | |
| 33 | + cd Build/Build/ProfileData |
| 34 | + cd $(ls -d */|head -n 1) |
| 35 | + pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata |
| 36 | + cd ${{ github.workspace }} |
| 37 | + echo "Generating coverage report for AWSMobileClient..." |
| 38 | + xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug-iphonesimulator/AWSAuthSDKTestApp.app/Frameworks/AWSMobileClient.framework/AWSMobileClient >> aws-sdk-ios-Coverage.lcov |
| 39 | + - name: Upload Coverage Report |
| 40 | + uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0 |
| 41 | + with: |
| 42 | + flags: AWS-SDK |
| 43 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments