-
Notifications
You must be signed in to change notification settings - Fork 26
53 lines (45 loc) · 1.45 KB
/
swift-code-coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
- uses: NeedleInAJayStack/setup-swift@feat/swift-6
with:
swift-version: "5.9"
- name: Ubuntu deps
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get install -y libjemalloc-dev #llvm-15
- 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
which llvm-cov
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
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_REPO_TOKEN }}