tests: Build and run examples as end to end tests #91
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
jobs: | |
endtoend-tests: | |
name: End to end tests | |
runs-on: ubuntu-latest | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
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: Test the registry | |
run: | | |
curl -v localhost:5000/v2/ | |
- name: System info | |
run: | | |
uname -a | |
swift --version | |
# - name: Push something | |
# run: | | |
# swift run containertool --repository localhost:5000/vapor Package.swift --from swift:slim | |
- 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: static stdlib | |
run: | | |
pwd | |
mkdir staticstdlib | |
cd staticstdlib | |
swift package init --type executable | |
swift build --static-swift-stdlib | |
- name: sdk build | |
run: | | |
pwd | |
mkdir staticsdk | |
cd staticsdk | |
swift package init --type executable | |
swift build --swift-sdk x86_64-swift-linux-musl | |
- name: plugin sdk | |
run: | | |
pwd | |
mkdir plugin-sdk | |
cd plugin-sdk | |
swift package init --type executable | |
swift package add-dependency https://github.com/apple/swift-container-plugin --from 0.2.0 | |
swift package --swift-sdk x86_64-swift-linux-musl --allow-network-connections all build-container-image --registry localhost:5000/test-static-stdlib | |
- name: Build the example | |
run: | | |
cd Examples/HelloWorldHummingbird | |
swift package \ | |
--allow-network-connections all \ | |
--swift-sdk x86_64-swift-linux-musl \ | |
build-container-image \ | |
--repository localhost:5000/hummingbird \ | |
--from scratch | |
- name: Run the example | |
run: | | |
docker run --platform linux/amd64 -p 8080:8080 localhost:5000/hummingbird | |
- name: Check that the service is running | |
run: | | |
curl localhost:8080 |