Skip to content

Commit 6befa29

Browse files
committed
wip: end to end tests in github actions
1 parent 403e0fe commit 6befa29

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,54 @@ jobs:
5151
run: |
5252
swift test
5353
54+
endtoend-tests:
55+
name: End to end tests
56+
runs-on: ubuntu-latest
57+
services:
58+
registry:
59+
image: registry:2
60+
ports:
61+
- 5000:5000
62+
strategy:
63+
matrix:
64+
example:
65+
- HelloWorldVapor
66+
- HelloWorldHummingbird
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
with:
71+
persist-credentials: false
72+
73+
- name: Mark the workspace as safe
74+
# https://github.com/actions/checkout/issues/766
75+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
76+
77+
- name: Install the static SDK
78+
run: |
79+
swift sdk install \
80+
https://download.swift.org/swift-6.0.2-release/static-sdk/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz \
81+
--checksum aa5515476a403797223fc2aad4ca0c3bf83995d5427fb297cab1d93c68cee075
82+
83+
- name: Build the example
84+
run: |
85+
cd Examples/${{ matrix.example }}
86+
sed -i'.bak' -e '/swift-container-plugin/ s/(url:.*),/(path: "..\/.."),/' Package.swift
87+
swift package \
88+
--swift-sdk x86_64-swift-linux-musl \
89+
--allow-network-connections all \
90+
build-container-image \
91+
--repository localhost:5000/example \
92+
--from scratch
93+
94+
- name: Run the example
95+
run: |
96+
docker run -d --platform linux/amd64 -p 8080:8080 localhost:5000/example
97+
98+
- name: Check that the service is running
99+
run: |
100+
curl -v localhost:8080 | grep "Hello World"
101+
54102
swift-6-language-mode:
55103
name: Swift 6 Language Mode
56104
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main

Examples/HelloWorldHummingbird/Package.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ let package = Package(
2626
targets: [
2727
.executableTarget(name: "hello-world", dependencies: [.product(name: "Hummingbird", package: "hummingbird")])
2828
]
29-
3029
)

0 commit comments

Comments
 (0)