Skip to content

Commit 6b84f1d

Browse files
committed
[GHA] Cxx interoperability compatibility and integration tests check
# Motivation Another reusable check is to make sure that all library products of a package are successfully building when consumed from a module that has Cxx interoperability enabled. Another check that's missing is running the integration tests. # Modification This PR adds two new checks to the reusable workflow. One to check for Cxx interoperability compatibility and another one to run the integration tests. I also fixed a misalgined name for the nightly benchmarks. # Result This should be one of the last reusable workflow checks.
1 parent b1bf036 commit 6b84f1d

7 files changed

+66
-5
lines changed

.github/workflows/pull_request.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,18 @@ jobs:
2424
uses: ./.github/workflows/pull_request_swift_matrix.yml
2525
with:
2626
name: "Benchmarks"
27-
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev && swift package --package-path Benchmarks/ --disable-sandbox benchmark baseline check --check-absolute-path Benchmarks/Thresholds/${SWIFT_VERSION}/
28-
"
27+
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev && swift package --package-path Benchmarks/ --disable-sandbox benchmark baseline check --check-absolute-path Benchmarks/Thresholds/${SWIFT_VERSION}/"
28+
29+
call-pull-request-cxx-interop-workflow:
30+
name: Cxx interop
31+
uses: ./.github/workflows/pull_request_swift_matrix.yml
32+
with:
33+
name: "Cxx interop"
34+
matrix_linux_command: "./scripts/check-cxx-interop-compatibility.sh"
35+
36+
call-pull-request-integration-tests-workflow:
37+
name: Integration tests
38+
uses: ./.github/workflows/pull_request_swift_matrix.yml
39+
with:
40+
name: "Integration tests"
41+
matrix_linux_command: "./scripts/integration_tests.sh"

docker/docker-compose.2204.next.yaml renamed to docker/docker-compose.2204.nightly-6.0.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
test:
2121
image: swift-nio:22.04-next
2222
environment:
23-
- SWIFT_VERSION=nightly-next
23+
- SWIFT_VERSION=nightly-6.0
2424
- MAX_ALLOCS_ALLOWED_10000000_asyncsequenceproducer=21
2525
- MAX_ALLOCS_ALLOWED_1000000_asyncwriter=1000050
2626
- MAX_ALLOCS_ALLOWED_1000_addHandlers=45050
@@ -79,7 +79,7 @@ services:
7979
update-benchmark-baseline:
8080
image: swift-nio:22.04-next
8181
environment:
82-
- SWIFT_VERSION=nightly-next
82+
- SWIFT_VERSION=nightly-6.0
8383

8484
shell:
8585
image: swift-nio:22.04-next
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the SwiftNIO open source project
5+
##
6+
## Copyright (c) 2024 Apple Inc. and the SwiftNIO project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
16+
set -euo pipefail
17+
18+
log() { printf -- "** %s\n" "$*" >&2; }
19+
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
20+
fatal() { error "$@"; exit 1; }
21+
22+
log "Checking for Cxx interoperability comaptibility..."
23+
24+
source_dir=$(pwd)
25+
working_dir=$(mktemp -d)
26+
project_name=$(basename "$working_dir")
27+
source_file=Sources/$project_name/$(echo "$project_name" | tr . _).swift
28+
library_products=$( swift package dump-package | jq -r '.products[] | select(.type.library != null) | .name')
29+
package_name=$(swift package dump-package | jq -r '.name')
30+
31+
cd "$working_dir"
32+
swift package init
33+
echo "package.dependencies.append(.package(path: \"$source_dir\"))" >> Package.swift
34+
35+
for product in $library_products; do
36+
echo "package.targets.first!.dependencies.append(.product(name: \"$product\", package: \"$package_name\"))" >> Package.swift
37+
echo "import $product" >> "$source_file"
38+
done
39+
40+
swift build
41+
42+
log "✅ Passed the Cxx interoperability tests."

scripts/check-docs.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@
1313
##
1414
##===----------------------------------------------------------------------===##
1515

16-
set -eu
16+
set -euo pipefail
17+
18+
log() { printf -- "** %s\n" "$*" >&2; }
19+
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
20+
fatal() { error "$@"; exit 1; }
1721

1822
raw_targets=$(sed -E -n -e 's/^.* - documentation_targets: \[(.*)\].*$/\1/p' .spi.yml)
1923
targets=(${raw_targets//,/ })
2024

2125
for target in "${targets[@]}"; do
2226
swift package plugin generate-documentation --target "$target" --warnings-as-errors --analyze --level detailed
2327
done
28+
29+
log "✅ Found no documentation issues."

0 commit comments

Comments
 (0)