Skip to content

Commit

Permalink
Code coverage command
Browse files Browse the repository at this point in the history
  • Loading branch information
OdNairy committed Jan 24, 2023
1 parent 1a3386b commit 6b88472
Showing 1 changed file with 47 additions and 4 deletions.
51 changes: 47 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,7 @@ jobs:
xcrun llvm-cov export -arch $(uname -m) -format="lcov" \
-instr-profile="Coverage-unittests.profdata" \
"$BINARY_PATH" > coverage.lcov
xcrun llvm-cov export -arch $(uname -m) -format="lcov" \
-instr-profile="Coverage-integrationtests.profdata" \
"$BINARY_PATH" > coverage-integrationtests.lcov
xcrun llvm-cov export -arch $(uname -m) -format=text \
-instr-profile="Coverage-unittests.profdata" \
"$BINARY_PATH" > coverage.txt
Expand Down Expand Up @@ -922,7 +920,8 @@ jobs:
-destination 'platform=iOS Simulator,<< parameters.destination >>' \
-resultBundlePath MapboxMapsTests-integration.xcresult | tee -a xcodebuild.log | xcpretty --report junit --output junit/integration/junit.xml
find "${HOME}/Library/Developer/Xcode/DerivedData" -name '*.profdata' -exec mv {} Coverage-integrationtests.profdata \;
find "${HOME}/Library/Developer/Xcode/DerivedData" -name '*.profdata' -exec cp {} . \;
- collect-code-coverage
- run:
name: Compress XCResult
command: zip -r MapboxMapsTests.xcresult.zip MapboxMapsTests.xcresult MapboxMapsTests-integration.xcresult
Expand Down Expand Up @@ -1919,3 +1918,47 @@ commands:
- << parameters.output >>
- store_artifacts:
path: << parameters.output >>

collect-code-coverage:
parameters:
profdata_path:
type: string
default: Coverage.profdata
binary_name:
type: string
default: MapboxMaps.o
steps:
- run:
name: Generate code coverage report
command: |
BINARY_PATH="$(find build -name "<< parameters.binary_name >>" | head -1)"
echo "Generating LCOV code coverage report for $BINARY_PATH"
xcrun llvm-cov export -arch $(uname -m) -format="lcov" \
-instr-profile="<< parameters.profdata_path >>" \
"$BINARY_PATH" > coverage.lcov
echo "Generating TXT code coverage report for $BINARY_PATH"
xcrun llvm-cov export -arch $(uname -m) -format=text \
-instr-profile="<< parameters.profdata_path >>" \
"$BINARY_PATH" > coverage.txt
zip -r coverage.zip coverage.lcov coverage.txt "<< parameters.profdata_path >>" "$BINARY_PATH" junit
- install-python-dependencies
- install-mbx-ci
- run:
name: Send code coverage
command: |
curl -Os https://uploader.codecov.io/latest/macos/codecov
chmod +x codecov
./codecov -f coverage.lcov -F unit
./codecov -f coverage-integrationtests.lcov -F integration
echo "Uploading to S3" ; \
python3 ./scripts/code-coverage/parse-code-coverage.py \
-g . \
-c MapboxMaps \
--scheme MapboxMaps \
--report coverage.txt
- store_artifacts:
path: coverage.zip

0 comments on commit 6b88472

Please sign in to comment.