Skip to content

Configure Code coverage for iOS CI/CD #817

Configure Code coverage for iOS CI/CD

Configure Code coverage for iOS CI/CD #817

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: macos-latest
env:
# yorkie server v0.6.13
YORKIE_RB_URL: "https://raw.githubusercontent.com/Homebrew/homebrew-core/ca3f5e9ad060fa639e241ce27ab1896ed4619421/Formula/y/yorkie.rb"
# swiftlint v0.58.2
SWIFTLINT_RB_URL: "https://raw.githubusercontent.com/Homebrew/homebrew-core/ae3894d1d8d343733160e1c57903187228628d9d/Formula/s/swiftlint.rb"
# swiftformat v0.55.6
SWIFTFORMAT_RB_URL: "https://raw.githubusercontent.com/Homebrew/homebrew-core/511cf8dcf60a2625b9e3be78b1b8db92f00b02d4/Formula/s/swiftformat.rb"
HOMEBREW_DEVELOPER: "1"
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.2'
- uses: actions/checkout@v4
- name: SwiftLint and SwiftFormat install
run: |
curl -O ${{ env.SWIFTLINT_RB_URL }}
brew install --formula ./swiftlint.rb
brew unlink swiftformat
curl -O ${{ env.SWIFTFORMAT_RB_URL }}
brew install --formula ./swiftformat.rb
- name: Setup yorkie server
run: |
curl -O ${{ env.YORKIE_RB_URL }}
brew install --formula ./yorkie.rb
- name: Start Yorkie server
run: yorkie server &
- name: SwiftLint
run: |
swiftlint --version
swiftlint lint --strict
- name: SwiftFormat
run: |
swiftformat --version
swiftformat --lint .
- name: Run tests
run: swift test --enable-code-coverage -v
- name: Prepare Code Coverage
run: xcrun llvm-cov export -format="lcov" .build/debug/YorkiePackageTests.xctest/Contents/MacOS/YorkiePackageTests -instr-profile .build/debug/codecov/default.profdata > lcov.info
- name: Terminate Yorkie server
run: killall yorkie
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}