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

Remove docker compose files + add GH action to compile examples during CI #397

Merged
merged 30 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
36bdd33
add docker fine grained permission to the plugin
sebsto Oct 8, 2024
7b28a79
swift-format
sebsto Oct 8, 2024
32b99bd
initial commit to fix docker compose
sebsto Oct 8, 2024
83ed705
update docker files
sebsto Oct 8, 2024
7d26fe7
add GH action to compile examples on PR
sebsto Oct 8, 2024
6cebe1a
Merge branch 'main' into sebsto/docker
sebsto Oct 8, 2024
686337a
make script executable
sebsto Oct 8, 2024
34ffd09
disable integration tests on Swift < 6.0
sebsto Oct 8, 2024
17dcfcc
Merge branch 'main' into sebsto/docker
sebsto Oct 8, 2024
355cd16
Merge branch 'main' into sebsto/docker
sebsto Oct 9, 2024
cffbfad
remove old docker infrastructure
sebsto Oct 9, 2024
ed39d47
automate the discovery of examples
sebsto Oct 9, 2024
f37846d
v2 API Proposal Document (#339)
aryan-25 Oct 9, 2024
6540328
Merge branch 'main' into sebsto/docker
sebsto Oct 9, 2024
b30dfe4
fix variable name for matrix action
sebsto Oct 9, 2024
ba36907
first test to get a matrix setup
sebsto Oct 9, 2024
876b237
refine matrix
sebsto Oct 9, 2024
534502b
refine matrix
sebsto Oct 9, 2024
dd21f48
fix reference to sub workflow
sebsto Oct 9, 2024
cce5208
remove references from docker
sebsto Oct 9, 2024
64337df
test passing an array
sebsto Oct 9, 2024
7df6a04
try to pass an array
sebsto Oct 9, 2024
26c6e31
test passing array
sebsto Oct 9, 2024
6156e93
revert back to hard coded example list in the matrix
sebsto Oct 9, 2024
c8ba600
add the example name in the job name
sebsto Oct 9, 2024
dd84d7c
improve naming
sebsto Oct 9, 2024
639224f
Use only one Swift version to build the examples
sebsto Oct 9, 2024
9c89ff2
fix image name
sebsto Oct 9, 2024
0f5ce60
use latest alias to fetch the latest version
sebsto Oct 9, 2024
8df40d8
Merge branch 'main' into sebsto/docker
sebsto Oct 9, 2024
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
60 changes: 60 additions & 0 deletions .github/workflows/examples_matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: ExamplesMatrix

on:
workflow_call:
inputs:
Comment on lines +3 to +5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need an extra workflow for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabianfett This is a matter of separation of concerns. Just like when we create 2 .swift files for two different struct.
In the reporting web view, it doesn't matter if this is a sub workflow or not.

I really don't want to bring this complexity in pull_request.yml. Where would you host this script if not in a separate workflow ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

name:
type: string
description: "The name of the workflow used for the concurrency group."
required: true
# examples:
# type: sequence
# description: "The examples to run."
# required: true
matrix_linux_command:
type: string
description: "The command of the current Swift version linux matrix job to execute."
required: true
matrix_linux_swift_container_image:
type: string
description: "Container image for the matrix job. Defaults to matching latest Swift Ubuntu image."
default: "swift:latest"

## We are cancelling previously triggered workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }}
cancel-in-progress: true

jobs:
linux:
name: Example/${{ matrix.examples }} on Linux ${{ matrix.swift.swift_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# This should be passed as an argument in input. Can we pass arrays as argument ?
examples : [ "HelloWorld", "APIGateway" ]
# examples: ${{ inputs.examples }}

# We are using only one Swift version
swift:
sebsto marked this conversation as resolved.
Show resolved Hide resolved
- image: ${{ inputs.matrix_linux_swift_container_image }}
swift_version: "6.0.1-noble"
container:
image: ${{ matrix.swift.image }}
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: Run matrix job
env:
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
COMMAND: ${{ inputs.matrix_linux_command }}
EXAMPLE: ${{ matrix.examples }}
run: |
apt-get -qq update && apt-get -qq -y install curl
./scripts/integration_tests.sh
9 changes: 9 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ jobs:
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

integration-tests:
name: Integration Tests
uses: ./.github/workflows/examples_matrix.yml
with:
# We should pass the list of examples here, but we can't pass an array as argument
# examples: [ "HelloWorld", "APIGateway" ]
name: "Integration tests"
matrix_linux_command: "LAMBDA_USE_LOCAL_DEPS=../.. swift build"

swift-6-language-mode:
name: Swift 6 Language Mode
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main
20 changes: 0 additions & 20 deletions docker/Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions docker/docker-compose.al2.510.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions docker/docker-compose.al2.57.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions docker/docker-compose.al2.58.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions docker/docker-compose.al2.59.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions docker/docker-compose.al2.main.yaml

This file was deleted.

51 changes: 0 additions & 51 deletions docker/docker-compose.yaml

This file was deleted.

34 changes: 34 additions & 0 deletions scripts/integration_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the SwiftAWSLambdaRuntime open source project
##
## Copyright (c) 2017-2018 Apple Inc. and the SwiftAWSLambdaRuntime project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##

set -euo pipefail

log() { printf -- "** %s\n" "$*" >&2; }
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
fatal() { error "$@"; exit 1; }

test -n "${SWIFT_VERSION:-}" || fatal "SWIFT_VERSION unset"
test -n "${COMMAND:-}" || fatal "COMMAND unset"
test -n "${EXAMPLE:-}" || fatal "EXAMPLE unset"
swift_version="$SWIFT_VERSION"
command="$COMMAND"
example="$EXAMPLE"

pushd Examples/"$example" > /dev/null

log "Running command with Swift $SWIFT_VERSION"
eval "$command"

popd
Loading