-
Notifications
You must be signed in to change notification settings - Fork 81
212 lines (207 loc) · 8.68 KB
/
integration-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Integration Tests
on:
pull_request:
workflow_dispatch:
env:
AWS_SWIFT_SDK_USE_LOCAL_DEPS: 1
permissions:
id-token: write
jobs:
apple:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
# This matrix runs tests on iOS sim & Mac, on oldest & newest supported Xcodes
runner:
- macos-14
- macos-15
xcode:
- Xcode_15.2
- Xcode_16.1
destination:
- 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
- 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
- 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
- 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
- 'platform=macOS'
exclude:
# Don't run old macOS with new Xcode
- runner: macos-14
xcode: Xcode_16.1
# Don't run new macOS with old Xcode
- runner: macos-15
xcode: Xcode_15.2
# Don't run old simulators with new Xcode
- destination: 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_16.1
- destination: 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
xcode: Xcode_16.1
- destination: 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
xcode: Xcode_16.1
# Don't run new simulators with old Xcode
- destination: 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_15.2
- destination: 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
xcode: Xcode_15.2
- destination: 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
xcode: Xcode_15.2
steps:
- name: Configure Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app
- name: Install visionOS sim if needed
if: ${{ contains(matrix.destination, 'platform=visionOS') }}
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Configure AWS Credentials for Integration Tests
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.INTEGRATION_TEST_ROLE_ARN }}
aws-region: us-west-2
- name: Checkout aws-sdk-swift
uses: actions/checkout@v3
- name: Select smithy-swift branch
run: |
ORIGINAL_REPO_HEAD_REF="$GITHUB_HEAD_REF" \
DEPENDENCY_REPO_URL="https://github.com/smithy-lang/smithy-swift.git" \
./scripts/ci_steps/select_dependency_branch.sh
- name: Checkout smithy-swift
uses: actions/checkout@v3
with:
repository: smithy-lang/smithy-swift
ref: ${{ env.DEPENDENCY_REPO_SHA }}
path: smithy-swift
- name: Move smithy-swift into place
run: mv smithy-swift ..
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: 2-${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
2-${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
2-${{ runner.os }}-gradle-
- name: Cache Swift
uses: actions/cache@v3
with:
path: |
~/Library/Caches/org.swift.swiftpm
~/.cache/org.swift.swiftpm
key: 1-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }}
restore-keys: |
1-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }}
1-${{ runner.os }}-${{ matrix.xcode }}-
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 17
- name: Tools Versions
run: ./scripts/ci_steps/log_tool_versions.sh
- name: Add Credentials to Test Plan
run: |
# JSON-escape the credentials. They are also surrounded with double quotes.
AKID_ESCAPED=`echo -n "$AWS_ACCESS_KEY_ID" | jq -Rsa .`
SECRET_ESCAPED=`echo -n "$AWS_SECRET_ACCESS_KEY" | jq -Rsa .`
REGION_ESCAPED=`echo -n "$AWS_DEFAULT_REGION" | jq -Rsa .`
TOKEN_ESCAPED=`echo -n "$AWS_SESSION_TOKEN" | jq -Rsa .`
# Insert the credentials into the .xctestplan file, write the modified JSON
# to a temp file, then move the temp over the original.
jq ".defaultOptions.environmentVariableEntries += [{\"key\": \"AWS_ACCESS_KEY_ID\", \"value\": $AKID_ESCAPED}, {\"key\": \"AWS_SECRET_ACCESS_KEY\", \"value\": $SECRET_ESCAPED}, {\"key\": \"AWS_DEFAULT_REGION\", \"value\": $REGION_ESCAPED}, {\"key\": \"AWS_SESSION_TOKEN\", \"value\": $TOKEN_ESCAPED}]" IntegrationTests/XCTestPlans/AWSIntegrationTestsOnCI.xctestplan > testplan.tmp
mv testplan.tmp IntegrationTests/XCTestPlans/AWSIntegrationTestsOnCI.xctestplan
- name: Prepare Integration Tests
run: ./scripts/ci_steps/prepare_integration_tests.sh
- name: Run Integration Tests
run: |
cd IntegrationTests
set -o pipefail && \
NSUnbufferedIO=YES xcodebuild \
-scheme AWSIntegrationTestsOnCI \
-testPlan AWSIntegrationTestsOnCI \
-destination '${{ matrix.destination }}' \
test 2>&1 \
| xcbeautify
linux:
runs-on: ubuntu-latest
container: swift:${{ matrix.version }}-${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- jammy
version:
- "5.9"
- "6.0"
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Configure AWS Credentials for Integration Tests
# configure-aws-credentials@v4 does not work with AL2 images, so @v3 is used instead. See:
# https://github.com/aws-actions/configure-aws-credentials/issues/862
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.INTEGRATION_TEST_ROLE_ARN }}
aws-region: us-west-2
- name: Checkout aws-sdk-swift
uses: actions/checkout@v3
- name: Select smithy-swift branch
run: |
ORIGINAL_REPO_HEAD_REF="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-main}}" \
DEPENDENCY_REPO_URL="https://github.com/smithy-lang/smithy-swift.git" \
./scripts/ci_steps/select_dependency_branch.sh
- name: Checkout smithy-swift
uses: actions/checkout@v3
with:
repository: smithy-lang/smithy-swift
ref: ${{ env.DEPENDENCY_REPO_SHA }}
path: smithy-swift
- name: Move smithy-swift into place
run: mv smithy-swift ..
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: 2-${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
2-${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
2-${{ runner.os }}-gradle-
- name: Cache Swift
uses: actions/cache@v3
with:
path: |
~/Library/Caches/org.swift.swiftpm
~/.cache/org.swift.swiftpm
key: 1-${{ runner.os }}-swift-${{ matrix.version }}-spm-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }}
restore-keys: |
1-${{ runner.os }}-swift-${{ matrix.version }}-spm-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }}
1-${{ runner.os }}-swift-${{ matrix.version }}-spm-
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 17
- name: Install OpenSSL (all OS) and which (AL2 only)
run: ./scripts/ci_steps/install_native_linux_dependencies.sh
- name: Tools Versions
run: ./scripts/ci_steps/log_tool_versions.sh
- name: Prepare Integration Tests
run: ./scripts/ci_steps/prepare_integration_tests.sh
- name: Build Integration Tests
run: |
cd IntegrationTests
swift build --build-tests
cd ..
- name: Run Integration Tests
run: |
cd IntegrationTests
swift test
cd ..