test: add coveralls integration #374
Workflow file for this run
This file contains 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: Build and test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | |
jobs: | |
lint: | |
name: build | |
runs-on: macos-13 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.0.1' | |
- name: Install SSH Key | |
uses: shimataro/[email protected] | |
with: | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
known_hosts: github.com | |
- name: Adding Known Hosts | |
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts | |
- name: Build | |
env: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
xcodebuild -scheme "AtalaPRISMSDK-Package" \ | |
-destination "platform=iOS Simulator,name=IPhone 14" \ | |
-derivedDataPath "~/.derivedData" \ | |
-enableCodeCoverage YES \ | |
-resultBundlePath TestResults.xcresult \ | |
clean build test | xcpretty | |
- name: Install lcov | |
run: brew install lcov | |
- name: Generate lcov and aggregate | |
run: | | |
BINARIES=$(find ~/.derivedData -type f -name "*Tests") | |
PROF_DATA=$(find ~/.derivedData -name Coverage.profdata) | |
for BINARY in "$BINARIES"; do | |
# Extract the base name of the binary without the path | |
BASE_NAME=$(basename "$BINARY") | |
OUTPUT_LCOV="${BASE_NAME}.lcov" | |
xcrun llvm-cov export --format=lcov \ | |
--ignore-filename-regex=/.derivedData/ \ | |
--ignore-filename-regex=/*Tests/ \ | |
--ignore-filename-regex=/Core/ \ | |
-instr-profile "$PROF_DATA" "$BINARY" > "partial/$OUTPUT_LCOV" | |
done | |
lcov -o lcov.info -a "partial/*.lcov" | |
- name: Publish to coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: "lcov.info" |