Skip to content

Commit 65061a6

Browse files
sebstofabianfett
andauthored
Remove docker compose files + add GH action to compile examples during CI (#397)
* add GH action to compile examples on PR * remove old docker infrastructure --------- Co-authored-by: Fabian Fett <[email protected]>
1 parent 3dbe568 commit 65061a6

10 files changed

+103
-161
lines changed

.github/workflows/examples_matrix.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ExamplesMatrix
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
name:
7+
type: string
8+
description: "The name of the workflow used for the concurrency group."
9+
required: true
10+
# examples:
11+
# type: sequence
12+
# description: "The examples to run."
13+
# required: true
14+
matrix_linux_command:
15+
type: string
16+
description: "The command of the current Swift version linux matrix job to execute."
17+
required: true
18+
matrix_linux_swift_container_image:
19+
type: string
20+
description: "Container image for the matrix job. Defaults to matching latest Swift Ubuntu image."
21+
default: "swift:latest"
22+
23+
## We are cancelling previously triggered workflow runs
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
linux:
30+
name: Example/${{ matrix.examples }} on Linux ${{ matrix.swift.swift_version }}
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
# This should be passed as an argument in input. Can we pass arrays as argument ?
36+
examples : [ "HelloWorld", "APIGateway" ]
37+
# examples: ${{ inputs.examples }}
38+
39+
# We are using only one Swift version
40+
swift:
41+
- image: ${{ inputs.matrix_linux_swift_container_image }}
42+
swift_version: "6.0.1-noble"
43+
container:
44+
image: ${{ matrix.swift.image }}
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
with:
49+
persist-credentials: false
50+
- name: Mark the workspace as safe
51+
# https://github.com/actions/checkout/issues/766
52+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
53+
- name: Run matrix job
54+
env:
55+
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
56+
COMMAND: ${{ inputs.matrix_linux_command }}
57+
EXAMPLE: ${{ matrix.examples }}
58+
run: |
59+
apt-get -qq update && apt-get -qq -y install curl
60+
./scripts/integration_tests.sh

.github/workflows/pull_request.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ jobs:
2424
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
2525
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
2626

27+
integration-tests:
28+
name: Integration Tests
29+
uses: ./.github/workflows/examples_matrix.yml
30+
with:
31+
# We should pass the list of examples here, but we can't pass an array as argument
32+
# examples: [ "HelloWorld", "APIGateway" ]
33+
name: "Integration tests"
34+
matrix_linux_command: "LAMBDA_USE_LOCAL_DEPS=../.. swift build"
35+
2736
swift-6-language-mode:
2837
name: Swift 6 Language Mode
2938
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main

docker/Dockerfile

Lines changed: 0 additions & 20 deletions
This file was deleted.

docker/docker-compose.al2.510.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/docker-compose.al2.57.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/docker-compose.al2.58.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/docker-compose.al2.59.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/docker-compose.al2.main.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/docker-compose.yaml

Lines changed: 0 additions & 51 deletions
This file was deleted.

scripts/integration_tests.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the SwiftAWSLambdaRuntime open source project
5+
##
6+
## Copyright (c) 2017-2018 Apple Inc. and the SwiftAWSLambdaRuntime 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 SwiftAWSLambdaRuntime project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
16+
set -euo pipefail
17+
18+
log() { printf -- "** %s\n" "$*" >&2; }
19+
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
20+
fatal() { error "$@"; exit 1; }
21+
22+
test -n "${SWIFT_VERSION:-}" || fatal "SWIFT_VERSION unset"
23+
test -n "${COMMAND:-}" || fatal "COMMAND unset"
24+
test -n "${EXAMPLE:-}" || fatal "EXAMPLE unset"
25+
swift_version="$SWIFT_VERSION"
26+
command="$COMMAND"
27+
example="$EXAMPLE"
28+
29+
pushd Examples/"$example" > /dev/null
30+
31+
log "Running command with Swift $SWIFT_VERSION"
32+
eval "$command"
33+
34+
popd

0 commit comments

Comments
 (0)