Skip to content

Commit cb47d48

Browse files
committed
Utilize codecov/codecov-action@v3
1 parent 2bfee6c commit cb47d48

File tree

4 files changed

+62
-20
lines changed

4 files changed

+62
-20
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: macOS-11
1313
steps:
1414
- name: Checkout Repo
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
1616
- name: Bundle Install
1717
run: bundle install
1818
- name: Select Xcode Version
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: macOS-11
2525
steps:
2626
- name: Checkout Repo
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2828
- name: Bundle Install
2929
run: bundle install
3030
- name: Select Xcode Version
@@ -45,7 +45,7 @@ jobs:
4545
fail-fast: false
4646
steps:
4747
- name: Checkout Repo
48-
uses: actions/checkout@v2
48+
uses: actions/checkout@v3
4949
- name: Bundle Install
5050
run: bundle install
5151
- name: Select Xcode Version
@@ -54,9 +54,6 @@ jobs:
5454
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
5555
- name: Build and Test Framework
5656
run: Scripts/build.swift ${{ matrix.platforms }}
57-
- name: Upload Coverage Reports
58-
if: success()
59-
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
6057
spm-12:
6158
name: Build Xcode 12
6259
runs-on: macOS-11
@@ -69,7 +66,7 @@ jobs:
6966
fail-fast: false
7067
steps:
7168
- name: Checkout Repo
72-
uses: actions/checkout@v2
69+
uses: actions/checkout@v3
7370
- name: Bundle Install
7471
run: bundle install
7572
- name: Select Xcode Version
@@ -78,9 +75,11 @@ jobs:
7875
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
7976
- name: Build and Test Framework
8077
run: Scripts/build.swift ${{ matrix.platforms }}
78+
- name: Prepare Coverage Reports
79+
run: ./Scripts/prepare-coverage-reports.sh
8180
- name: Upload Coverage Reports
8281
if: success()
83-
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
82+
uses: codecov/codecov-action@v3
8483
spm-13:
8584
name: Build Xcode 13
8685
runs-on: macOS-12
@@ -93,7 +92,7 @@ jobs:
9392
fail-fast: false
9493
steps:
9594
- name: Checkout Repo
96-
uses: actions/checkout@v2
95+
uses: actions/checkout@v3
9796
- name: Bundle Install
9897
run: bundle install
9998
- name: Select Xcode Version
@@ -102,15 +101,17 @@ jobs:
102101
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
103102
- name: Build and Test Framework
104103
run: Scripts/build.swift ${{ matrix.platforms }}
104+
- name: Prepare Coverage Reports
105+
run: ./Scripts/prepare-coverage-reports.sh
105106
- name: Upload Coverage Reports
106107
if: success()
107-
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
108+
uses: codecov/codecov-action@v3
108109
spm-13-swift:
109110
name: Swift Build Xcode 13
110111
runs-on: macOS-12
111112
steps:
112113
- name: Checkout Repo
113-
uses: actions/checkout@v2
114+
uses: actions/checkout@v3
114115
- name: Bundle Install
115116
run: bundle install
116117
- name: Select Xcode Version
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/zsh -l
2+
set -e
3+
4+
root=$(git rev-parse --show-toplevel)
5+
6+
function exportlcov() {
7+
build_type=$1
8+
executable=$2
9+
profile=$3
10+
11+
can_proceed=true
12+
if ! test -f $executable; then
13+
echo "\tCould not find executable for $build_type"
14+
can_proceed=false
15+
fi
16+
17+
if ! test -f $profile; then
18+
echo "\tCould not find profile for $build_type"
19+
can_proceed=false
20+
fi
21+
22+
if $can_proceed; then
23+
output_dir=".build/artifacts/$build_type"
24+
mkdir -p $output_dir
25+
26+
output_file="$output_dir/$(basename $executable).lcov"
27+
echo "\tExporting $output_file"
28+
xcrun llvm-cov export -format="lcov" $executable -instr-profile $profile > $output_file
29+
else
30+
echo "\tAborting creation of lcov file for $build_type"
31+
fi
32+
}
33+
34+
for directory in $root/.build/derivedData/*/; do
35+
build_type=$(basename $directory)
36+
echo "Finding coverage information for $build_type"
37+
38+
profile=$(find "${directory}" -type f -name 'Coverage.profdata')
39+
40+
cache_advance_tests_executable=$(find "${directory}" -type f -name 'CacheAdvanceTests')
41+
exportlcov $build_type $cache_advance_tests_executable $profile
42+
43+
cad_cache_advance_tests_executable=$(find "${directory}" -type f -name 'CADCacheAdvanceTests')
44+
exportlcov $build_type $cad_cache_advance_tests_executable $profile
45+
done

Scripts/upload-coverage-reports.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ comment:
55
layout: "reach,diff,flags,tree"
66
behavior: default
77
require_changes: no
8+
9+
ignore:
10+
- "Sources/LorumIpsum"
11+
- "Sources/SwiftTryCatch"
12+
- "Tests"

0 commit comments

Comments
 (0)