From 4aac0c4d51ff741537dfb778493cffd7a2e96087 Mon Sep 17 00:00:00 2001 From: Euan Harris Date: Fri, 6 Dec 2024 16:12:31 +0000 Subject: [PATCH] wip: endtoend workflow Fixes: #40 --- .github/workflows/endtoend_tests.yml | 58 ++++++++++++++++++++++++++++ .github/workflows/pull_request.yml | 47 +--------------------- 2 files changed, 59 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/endtoend_tests.yml diff --git a/.github/workflows/endtoend_tests.yml b/.github/workflows/endtoend_tests.yml new file mode 100644 index 0000000..2d51110 --- /dev/null +++ b/.github/workflows/endtoend_tests.yml @@ -0,0 +1,58 @@ +name: End to end tests + +on: + workflow_call: +# inputs: +# example: +# required: true +# type: string + +jobs: + 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" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e16bf84..94c2bea 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -53,52 +53,7 @@ jobs: 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" + uses: ./.github/workflows/endtoend_tests.yml swift-6-language-mode: name: Swift 6 Language Mode