Skip to content

Commit 04228d7

Browse files
committed
ci: Enable smoke tests
These integration tests require an instance of the container registry to be available.
1 parent 345cd61 commit 04228d7

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ jobs:
2424
linux_nightly_6_0_arguments_override: "--filter 'AuthTests|ReferenceTests'"
2525
linux_nightly_main_arguments_override: "--filter 'AuthTests|ReferenceTests'"
2626

27+
integration-tests:
28+
name: Integration tests
29+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
30+
with:
31+
name: "Integration tests"
32+
matrix_linux_command: "./scripts/run-integration-tests.sh"
33+
matrix_linux_5_8_enabled: false
34+
matrix_linux_5_9_enabled: false
35+
matrix_linux_5_10_enabled: false
36+
matrix_linux_nightly_main_enabled: false
37+
2738
swift-6-language-mode:
2839
name: Swift 6 Language Mode
2940
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main

NOTICE.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ function from SwiftNIO Extras.
6767
This product contains samples of how to use Swift Container Plugin with the
6868
following other projects:
6969

70+
* Distribution Registry
71+
* LICENSE (Apache License 2.0):
72+
* https://www.apache.org/licenses/LICENSE-2.0
73+
* HOMEPAGE:
74+
* https://github.com/distribution/distribution
75+
7076
* Vapor
7177
* LICENSE (MIT License):
7278
* https://mit-license.org

scripts/run-integration-tests.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the SwiftContainerPlugin open source project
5+
##
6+
## Copyright (c) 2024 Apple Inc. and the SwiftContainerPlugin 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 SwiftContainerPlugin project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
16+
17+
log() { printf -- "** %s\n" "$*" >&2; }
18+
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
19+
fatal() { error "$@"; exit 1; }
20+
21+
if [[ -n ${TOOLCHAINS+x} ]] ; then
22+
fatal "Please unset the TOOLCHAINS environment variable. The OSS Swift toolchain cannot run these tests because it does not include XCTest.framework."
23+
fi
24+
25+
set -euo pipefail
26+
27+
RUNTIME=${RUNTIME-"docker"}
28+
29+
# Start a registry on an ephemeral port
30+
REGISTRY_ID=$($RUNTIME run -d --rm -p 127.0.0.1::5000 registry:2)
31+
export REGISTRY_HOST="localhost"
32+
REGISTRY_PORT=$($RUNTIME port "$REGISTRY_ID" 5000/tcp | sed -E 's/^.+:([[:digit:]]+)$/\1/')
33+
export REGISTRY_PORT
34+
log "Registry $REGISTRY_ID listening on $REGISTRY_HOST:$REGISTRY_PORT"
35+
36+
# Delete the registry after running the tests, regardless of the outcome
37+
cleanup() {
38+
log "Deleting registry $REGISTRY_ID"
39+
$RUNTIME rm -f "$REGISTRY_ID"
40+
}
41+
trap cleanup EXIT
42+
43+
log "Running smoke tests"
44+
swift test --filter 'SmokeTests'

0 commit comments

Comments
 (0)