Skip to content

Commit 59dd68a

Browse files
authored
[CI] Adopt soundess workflow from swiftlang (#405)
1 parent b4673d2 commit 59dd68a

File tree

6 files changed

+84
-85
lines changed

6 files changed

+84
-85
lines changed

.github/ISSUE_TEMPLATE/issue-report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ body:
1717
attributes:
1818
label: Actual behavior
1919
description: What actually happened
20-
placeholder: Describe
20+
placeholder: Describe
2121
validations:
2222
required: true
2323
- type: textarea
@@ -55,7 +55,7 @@ body:
5555
attributes:
5656
label: Swift version
5757
description: Swift environment version.
58-
placeholder: |
58+
placeholder: |
5959
Open a Terminal and execute the following command
6060
6161
swift --version && uname -a

.github/workflows/examples_matrix.yml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,58 +24,57 @@ on:
2424
concurrency:
2525
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }}
2626
cancel-in-progress: true
27-
27+
2828
jobs:
2929
linux:
30-
name: Example/${{ matrix.examples }} on Linux ${{ matrix.swift.swift_version }}
30+
name: Example/${{ matrix.examples }} on Linux ${{ matrix.swift.swift_version }}
3131
runs-on: ubuntu-latest
3232
strategy:
3333
fail-fast: false
3434
matrix:
3535
# This should be passed as an argument in input. Can we pass arrays as argument ?
36-
examples : [ "HelloWorld", "APIGateway", "S3_AWSSDK", "S3_Soto" ]
36+
examples: ["HelloWorld", "APIGateway", "S3_AWSSDK", "S3_Soto"]
3737
# examples: ${{ inputs.examples }}
3838

39-
# We are using only one Swift version
39+
# We are using only one Swift version
4040
swift:
41-
- image: ${{ inputs.matrix_linux_swift_container_image }}
42-
swift_version: "6.0.1-amazonlinux2"
41+
- image: ${{ inputs.matrix_linux_swift_container_image }}
42+
swift_version: "6.0.1-amazonlinux2"
4343
container:
4444
image: ${{ matrix.swift.image }}
4545
steps:
46+
# GitHub checkout action has a dep on NodeJS 20 which is not running on Amazonlinux2
47+
# workaround is to manually checkout the repository
48+
# https://github.com/actions/checkout/issues/1487
49+
- name: Manually Clone repository and checkout PR
50+
env:
51+
PR_NUMBER: ${{ github.event.pull_request.number }}
52+
run: |
53+
# Clone the repository
54+
git clone https://github.com/${{ github.repository }}
55+
cd ${{ github.event.repository.name }}
4656
47-
# GitHub checkout action has a dep on NodeJS 20 which is not running on Amazonlinux2
48-
# workaround is to manually checkout the repository
49-
# https://github.com/actions/checkout/issues/1487
50-
- name: Manually Clone repository and checkout PR
51-
env:
52-
PR_NUMBER: ${{ github.event.pull_request.number }}
53-
run: |
54-
# Clone the repository
55-
git clone https://github.com/${{ github.repository }}
56-
cd ${{ github.event.repository.name }}
57+
# Fetch the pull request
58+
git fetch origin +refs/pull/$PR_NUMBER/merge:
5759
58-
# Fetch the pull request
59-
git fetch origin +refs/pull/$PR_NUMBER/merge:
60-
61-
# Checkout the pull request
62-
git checkout -qf FETCH_HEAD
60+
# Checkout the pull request
61+
git checkout -qf FETCH_HEAD
6362
64-
# - name: Checkout repository
65-
# uses: actions/checkout@v4
66-
# with:
67-
# persist-credentials: false
63+
# - name: Checkout repository
64+
# uses: actions/checkout@v4
65+
# with:
66+
# persist-credentials: false
6867

69-
- name: Mark the workspace as safe
70-
working-directory: ${{ github.event.repository.name }} # until we can use action/checkout@v4
71-
# https://github.com/actions/checkout/issues/766
72-
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
68+
- name: Mark the workspace as safe
69+
working-directory: ${{ github.event.repository.name }} # until we can use action/checkout@v4
70+
# https://github.com/actions/checkout/issues/766
71+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
7372

74-
- name: Run matrix job
75-
working-directory: ${{ github.event.repository.name }} # until we can use action/checkout@v4
76-
env:
77-
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
78-
COMMAND: ${{ inputs.matrix_linux_command }}
79-
EXAMPLE: ${{ matrix.examples }}
80-
run: |
81-
./scripts/integration_tests.sh
73+
- name: Run matrix job
74+
working-directory: ${{ github.event.repository.name }} # until we can use action/checkout@v4
75+
env:
76+
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
77+
COMMAND: ${{ inputs.matrix_linux_command }}
78+
EXAMPLE: ${{ matrix.examples }}
79+
run: |
80+
./scripts/integration_tests.sh

.github/workflows/pull_request.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
name: PR
22

33
on:
4-
pull_request:
5-
types: [opened, reopened, synchronize]
4+
pull_request:
5+
types: [opened, reopened, synchronize]
66

77
jobs:
8-
soundness:
9-
name: Soundness
10-
uses: apple/swift-nio/.github/workflows/soundness.yml@main
11-
with:
12-
license_header_check_project_name: "SwiftAWSLambdaRuntime"
13-
shell_check_enabled: false
14-
api_breakage_check_container_image: "swift:6.0-noble"
15-
docs_check_container_image: "swift:6.0-noble"
8+
soundness:
9+
name: Soundness
10+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
11+
with:
12+
license_header_check_project_name: "SwiftAWSLambdaRuntime"
13+
shell_check_enabled: false
14+
api_breakage_check_container_image: "swift:6.0-noble"
15+
docs_check_container_image: "swift:6.0-noble"
16+
format_check_container_image: "swiftlang/swift:nightly-6.0-jammy"
1617

17-
unit-tests:
18-
name: Unit tests
19-
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
20-
with:
21-
linux_5_8_enabled: false
22-
linux_5_9_enabled: false
23-
linux_5_10_enabled: false
24-
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
25-
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
18+
unit-tests:
19+
name: Unit tests
20+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
21+
with:
22+
linux_5_8_enabled: false
23+
linux_5_9_enabled: false
24+
linux_5_10_enabled: false
25+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
26+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
2627

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

Examples/APIGateway/template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Resources:
99
Properties:
1010
CodeUri: .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/APIGatewayLambda/APIGatewayLambda.zip
1111
Timeout: 60
12-
Handler: swift.bootstrap # ignored by the Swift runtime
12+
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2
1414
MemorySize: 512
1515
Architectures:
@@ -22,7 +22,7 @@ Resources:
2222
LOG_LEVEL: debug
2323
Events:
2424
HttpApiEvent:
25-
Type: HttpApi
25+
Type: HttpApi
2626

2727
Outputs:
2828
# print API Gateway endpoint

Examples/S3_AWSSDK/template.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Resources:
99
Properties:
1010
CodeUri: .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/AWSSDKExample/AWSSDKExample.zip
1111
Timeout: 60
12-
Handler: swift.bootstrap # ignored by the Swift runtime
12+
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2
1414
MemorySize: 512
1515
Architectures:
@@ -30,11 +30,11 @@ Resources:
3030
# It grants the function permissions to read the list of buckets in your account.
3131
Policies:
3232
- Statement:
33-
- Sid: ListAllS3BucketsInYourAccount
34-
Effect: Allow
35-
Action:
36-
- s3:ListAllMyBuckets
37-
Resource: '*'
33+
- Sid: ListAllS3BucketsInYourAccount
34+
Effect: Allow
35+
Action:
36+
- s3:ListAllMyBuckets
37+
Resource: '*'
3838

3939
# print API endpoint
4040
Outputs:

Examples/S3_Soto/template.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
AWSTemplateFormatVersion: '2010-09-09'
32
Transform: AWS::Serverless-2016-10-31
43
Description: SAM Template for AWS SDK Example
@@ -10,7 +9,7 @@ Resources:
109
Properties:
1110
CodeUri: .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/SotoExample/SotoExample.zip
1211
Timeout: 60
13-
Handler: swift.bootstrap # ignored by the Swift runtime
12+
Handler: swift.bootstrap # ignored by the Swift runtime
1413
Runtime: provided.al2
1514
MemorySize: 512
1615
Architectures:
@@ -31,11 +30,11 @@ Resources:
3130
# It grants the function permissions to read the list of buckets in your account.
3231
Policies:
3332
- Statement:
34-
- Sid: ListAllS3BucketsInYourAccount
35-
Effect: Allow
36-
Action:
37-
- s3:ListAllMyBuckets
38-
Resource: '*'
33+
- Sid: ListAllS3BucketsInYourAccount
34+
Effect: Allow
35+
Action:
36+
- s3:ListAllMyBuckets
37+
Resource: '*'
3938

4039
# print API endpoint
4140
Outputs:

0 commit comments

Comments
 (0)