Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'swift' instead of 'xcodebuild' for CI. Enable code coverage. #1

Merged
merged 3 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,17 @@ on:

jobs:
spm-15:
name: Build Xcode 15
name: Swift Build Xcode 15
runs-on: macos-13
strategy:
matrix:
platforms: [
'iOS_17,watchOS_10',
'macOS_14,tvOS_17',
]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }}
run: xcrun swift test -c release --enable-code-coverage -Xswiftc -enable-testing
- name: Prepare Coverage Reports
run: ./Scripts/prepare-coverage-reports.sh
- name: Upload Coverage Reports
if: success()
uses: codecov/codecov-action@v3
spm-15-swift:
name: Swift Build Xcode 15
runs-on: macos-13
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build and Test Framework
run: xcrun swift test -c release -Xswiftc -enable-testing
199 changes: 0 additions & 199 deletions Scripts/build.swift

This file was deleted.

18 changes: 5 additions & 13 deletions Scripts/prepare-coverage-reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
set -e

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

executable=$(find "${directory}" -type f -name $executable_name)
profile=$(find "${directory}" -type f -name 'Coverage.profdata')
executable=$(find .build/*/*/$executable_name.xctest/Contents/*/$executable_name -type f)
profile=$(find .build -type f -name 'default.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
if [[ -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."
Expand All @@ -26,9 +23,4 @@ function exportlcov() {
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 'SafeDITests'
done
exportlcov 'SafeDIPackageTests'
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
codecov:
require_ci_to_pass: yes

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no

coverage:
status:
project:
default:
target: 60%
patch: off