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

tests: Build and run examples as end to end tests #39

Merged
merged 1 commit into from
Dec 6, 2024
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
49 changes: 49 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,55 @@ jobs:
run: |
swift test

endtoend-tests:
name: End to end tests
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
example:
- Examples/HelloWorldVapor
- Examples/HelloWorldHummingbird
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}

- name: Install the static SDK
run: |
swift sdk install \
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 \
--checksum aa5515476a403797223fc2aad4ca0c3bf83995d5427fb297cab1d93c68cee075

- name: Build the example
run: |
sed -i'.bak' -e "/swift-container-plugin/ s@(url:.*),@(path: \"$PWD\"),@" ${{ matrix.example }}/Package.swift # Use plugin from this checkout
cat ${{ matrix.example }}/Package.swift
swift package \
--package-path ${{ matrix.example }} \
--swift-sdk x86_64-swift-linux-musl \
--allow-network-connections all \
build-container-image \
--repository localhost:5000/example \
--from scratch

- name: Run the example
run: |
docker run -d --platform linux/amd64 -p 8080:8080 localhost:5000/example

- name: Check that the service is running
run: |
curl -v localhost:8080 | grep "Hello World"

swift-6-language-mode:
name: Swift 6 Language Mode
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main
1 change: 0 additions & 1 deletion Examples/HelloWorldHummingbird/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ let package = Package(
targets: [
.executableTarget(name: "hello-world", dependencies: [.product(name: "Hummingbird", package: "hummingbird")])
]

)
Loading