Skip to content

Commit

Permalink
Utilize codecov/codecov-action@v3
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Oct 12, 2022
1 parent 2bfee6c commit b5afc2b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 20 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/ci.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: macOS-11
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: macOS-11
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -45,7 +45,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -54,9 +54,6 @@ jobs:
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }}
- name: Upload Coverage Reports
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
spm-12:
name: Build Xcode 12
runs-on: macOS-11
Expand All @@ -69,7 +66,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -78,9 +75,11 @@ jobs:
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }}
- name: Prepare Coverage Reports
run: ./Scripts/prepare-coverage-reports.sh
- name: Upload Coverage Reports
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
uses: codecov/codecov-action@v3
spm-13:
name: Build Xcode 13
runs-on: macOS-12
Expand All @@ -93,7 +92,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand All @@ -102,15 +101,17 @@ jobs:
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }}
- name: Prepare Coverage Reports
run: ./Scripts/prepare-coverage-reports.sh
- name: Upload Coverage Reports
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
uses: codecov/codecov-action@v3
spm-13-swift:
name: Swift Build Xcode 13
runs-on: macOS-12
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
Expand Down
35 changes: 35 additions & 0 deletions Scripts/prepare-coverage-reports.sh
@@ -0,0 +1,35 @@
#!/bin/zsh -l
set -e

function exportlcov() {
build_type=$1
executable_name=$2

executable=$(find "${directory}" -type f -name $executable_name)
profile=$(find "${directory}" -type f -name 'Coverage.profdata')
output_file_name="$executable_name.lcov"

can_proceed=true
if [[ $build_type == watchOS* ]]; then
echo "\tAborting creation of $output_file_name – watchOS not supported."
elif [[ -z $profile ]]; then
echo "\tAborting creation of $output_file_name – no profile found."
elif [[ -z $executable ]]; then
echo "\tAborting creation of $output_file_name – no executable found."
else
output_dir=".build/artifacts/$build_type"
mkdir -p $output_dir

output_file="$output_dir/$output_file_name"
echo "\tExporting $output_file"
xcrun llvm-cov export -format="lcov" $executable -instr-profile $profile > $output_file
fi
}

for directory in $(git rev-parse --show-toplevel)/.build/derivedData/*/; do
build_type=$(basename $directory)
echo "Finding coverage information for $build_type"

exportlcov $build_type 'CacheAdvanceTests'
exportlcov $build_type 'CADCacheAdvanceTests'
done
9 changes: 0 additions & 9 deletions Scripts/upload-coverage-reports.sh

This file was deleted.

4 changes: 4 additions & 0 deletions codecov.yml
Expand Up @@ -5,3 +5,7 @@ comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no

ignore:
- "Sources/LorumIpsum"
- "Tests"

0 comments on commit b5afc2b

Please sign in to comment.