ci: π synced local '.github/workflows/' with remote 'workflows/swift' #102
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, next ] | |
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: khlopko/setup-swift@bfd61cbd14eeef55a27afc45138b61ced7174839 | |
- name: Swift version | |
run: swift --version | |
- name: Start consul | |
uses: ./.github/actions/consul-start | |
- name: Run tests | |
continue-on-error: true | |
run: | | |
[ -d Tests ] && 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 |