chore: update ci workflow (#25) #90
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: Swift code coverage | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test-code-coverage: | |
runs-on: [ubuntu-22.04] | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Ubuntu deps | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
sudo apt-get install -y libjemalloc-dev | |
- uses: swift-actions/setup-swift@v2 | |
- name: Swift version | |
run: swift --version | |
- name: Run tests | |
continue-on-error: true | |
run: swift test --parallel --enable-code-coverage | |
- name: Export code coverage | |
run: | | |
xctest_binary=".build/debug/${{ github.event.repository.name }}PackageTests.xctest" | |
if [ ! -f ${xctest_binary} ]; then | |
xctest_binary=$(find .build/debug/ -type f -name "*.xctest" | tail -1) | |
echo "Will llvm-cov '${xctest_binary}'" | |
fi | |
if [ -f ${xctest_binary} ]; then | |
llvm-cov export -format="lcov" ${xctest_binary} -instr-profile .build/debug/codecov/default.profdata > info.lcov | |
fi | |
- name: Upload codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_REPO_TOKEN }} | |
files: info.lcov | |
fail_ci_if_error: true |