Skip to content
Open
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
13 changes: 11 additions & 2 deletions .github/workflows/swift-benchmark-delta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ jobs:
continue-on-error: true
run: |
echo $(date) >> $GITHUB_STEP_SUMMARY
# The step runs under `bash -e`: without the guard a non-zero exit from the check aborts the
# step here, before the mapping below, and every deviation reports as an unknown failure.
set +e
swift package ${BENCHMARK_PACKAGE_PATH} benchmark baseline check main pull_request --format markdown >> $GITHUB_STEP_SUMMARY 2>benchmark_stderr
rawExitStatus=$?
set -e
cat benchmark_stderr >&2
# SwiftPM maps all non-zero plugin exit codes to 1, so parse stderr to recover the real status
if [ "$rawExitStatus" -eq 0 ]; then
Expand All @@ -81,11 +85,16 @@ jobs:
echo "_Pull request is the same as baseline_"
echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)]($BENCHMARK_RUN_URL)"
} > benchmark_comment
- if: ${{ env.exitStatus == '1' }}
- if: ${{ env.exitStatus != '0' && env.exitStatus != '2' && env.exitStatus != '4' }}
name: Pull request comment text failure
run: |
case "${{ env.exitStatus }}" in
3) text="_Pull request benchmark crashed_" ;;
5) text="_Pull request benchmark baseline not found_" ;;
*) text="_Pull request had an unknown failure (exit status ${{ env.exitStatus }})_" ;;
esac
{
echo "_Pull request had an unknown failure_"
echo "$text"
echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)]($BENCHMARK_RUN_URL)"
} > benchmark_comment
- if: ${{ env.exitStatus == '2' }}
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/swift-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,24 @@ jobs:
- name: Run tests
continue-on-error: true
run: |
[ -d Tests ] && swift test --parallel --enable-code-coverage
# The native build system keeps the single <Package>PackageTests.xctest executable that the export
# step reads; the Swift Build backend, the default since 6.4, emits per-target runner and .so files.
[ -d Tests ] && swift test --parallel --enable-code-coverage --build-system native

- name: Export code coverage
run: |
xctest_binary=".build/debug/${{ github.event.repository.name }}PackageTests.xctest"
if [ ! -f ${xctest_binary} ]; then
# The executable carries the package name, not the repository name.
xctest_binary=$(find .build/debug/ -maxdepth 1 -type f -name "*PackageTests.xctest" | head -1)
if [ -z "${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
if [ -z "${xctest_binary}" ]; then
echo "No test executable found under .build/debug:"
ls -la .build/debug/
exit 1
fi
echo "Will llvm-cov '${xctest_binary}'"
llvm-cov export -format="lcov" "${xctest_binary}" -instr-profile .build/debug/codecov/default.profdata > info.lcov

- name: Upload codecov
uses: codecov/codecov-action@v5
Expand Down
Loading