-
Notifications
You must be signed in to change notification settings - Fork 77
286 lines (274 loc) · 11.4 KB
/
ci.yml
File metadata and controls
286 lines (274 loc) · 11.4 KB
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
name: CI
on:
push:
branches-ignore:
- 'main'
- 'docs'
env:
BUILDER_VERSION: v0.9.84
BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-iot-device-sdk-java-v2
RUN: ${{ github.run_id }}-${{ github.run_number }}
AWS_DEFAULT_REGION: us-east-1
AWS_DEVICE_FARM_REGION: us-west-2 # Device Farm only available in us-west-2 region
DA_TOPIC: test/da
DA_SHADOW_NAME: DATestShadow
DA_SHADOW_PROPERTY: datest
DA_SHADOW_VALUE_SET: ON
DA_SHADOW_VALUE_DEFAULT: OFF
CI_FLEET_PROVISIONING_ROLE: arn:aws:iam::180635532705:role/service-role/CI_FleetProvisioning_Role
CI_MQTT5_ROLE: arn:aws:iam::180635532705:role/CI_MQTT5_Role
CI_ANDROID_DEVICE_TESTING_ROLE: arn:aws:iam::180635532705:role/CI_Android_Device_Testing_Role
CI_SHADOW_SERVICE_CLIENT_ROLE: arn:aws:iam::180635532705:role/CI_ShadowServiceClient_Role
CI_JOBS_SERVICE_CLIENT_ROLE: arn:aws:iam::180635532705:role/CI_JobsServiceClient_Role
jobs:
windows-java-compat:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
version:
- 8
- 11
- 17
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v3.14.1
with:
distribution: temurin
java-version: ${{ matrix.version }}
cache: maven
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
python builder.pyz build -p ${{ env.PACKAGE_NAME }} --spec=downstream
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Service tests
shell: bash
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=ShadowTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=JobsTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=IdentityTests -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT311 tests
shell: bash
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=MqttBuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT5 tests
shell: bash
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=Mqtt5BuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
osx-java-compat:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
version:
- 8
- 11
- 17
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v3.14.1
with:
distribution: ${{ matrix.version == 8 && 'corretto' || 'temurin' }}
java-version: ${{ matrix.version }}
cache: maven
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Service tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=ShadowTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=JobsTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=IdentityTests -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT311 tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=MqttBuilderTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT5 tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=Mqtt5BuilderTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
linux-java-compat:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 8
- 11
- 17
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v3.14.1
with:
distribution: temurin
java-version: ${{ matrix.version }}
cache: maven
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
java -version
mvn compile
mvn install -Dmaven.test.skip
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Service tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=ShadowTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=JobsTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=IdentityTests -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT311 tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=MqttBuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT5 tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=Mqtt5BuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
android-device-farm:
name: Android Device Farm
runs-on: ubuntu-22.04 # latest
permissions:
# These permissions needed to interact with GitHub's OIDC Token endpoint
id-token: write # This is required for requesting the JWT
steps:
- name: Checkout Sources
uses: actions/checkout@v2
with:
submodules: true
# Setup JDK 17
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
# Ensure Gradle uses this JDK (important when toolchains are present)
- name: Point Gradle at JDK 17
run: echo "ORG_GRADLE_JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Mirror ANDROID_HOME → ANDROID_SDK_ROOT
run: echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> "$GITHUB_ENV"
- name: Configure AWS credentials for Device Farm
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_ANDROID_DEVICE_TESTING_ROLE }}
aws-region: ${{ env.AWS_DEVICE_FARM_REGION }}
- name: Build ${{ env.PACKAGE_NAME }}
run: |
cd android
./gradlew assembledebug
./gradlew publishToMavenLocal -PnewVersion="1.0.0-SNAPSHOT"
echo "Build status report=${{ job.status }}."
- name: Setup Android Test Files New
run: |
cd sdk/tests/android/testapp/src/main/assets
python3 -m pip install boto3
python3 ./android_file_creation.py
- name: Set Android keystore home
run: |
echo "ANDROID_SDK_HOME=$GITHUB_WORKSPACE/.android-home" >> "$GITHUB_ENV"
echo "ANDROID_PREFS_ROOT=$GITHUB_WORKSPACE/.android-home" >> "$GITHUB_ENV"
mkdir -p "$GITHUB_WORKSPACE/.android-home/.android"
- name: Create debug keystore
run: |
keytool -genkeypair \
-keystore "$ANDROID_SDK_HOME/.android/debug.keystore" \
-storepass android -keypass android \
-alias androiddebugkey \
-dname "CN=Android Debug,O=Android,C=US" \
-keyalg RSA -keysize 2048 -validity 14000
- name: Build Test App
run: |
cd sdk/tests/android/testapp
../../../../android/gradlew assembledebug
../../../../android/gradlew assembleAndroidTest
cd ~
- name: Device Farm Tests Highly Available
run: |
echo "Attempting to run python script"
python3 -m pip install requests
python3 ./utils/run_android_ci.py \
--region ${{ env.AWS_DEVICE_FARM_REGION }} \
--run_id ${{ github.run_id }} \
--run_attempt ${{ github.run_attempt }} \
--project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \
--device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/DevicePoolArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \
--device_pool highly_available
- name: Device Farm Tests Android 8
run: |
echo "Attempting to run python script"
python3 -m pip install requests
python3 ./utils/run_android_ci.py \
--region ${{ env.AWS_DEVICE_FARM_REGION }} \
--run_id ${{ github.run_id }} \
--run_attempt ${{ github.run_attempt }} \
--project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \
--device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/DevicePoolArn/Android8" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \
--device_pool android_8
# check that docs can still build
check-docs:
runs-on: ubuntu-22.04 # latest
steps:
- uses: actions/checkout@v2
- name: Check docs
run: |
mvn install -Dmaven.test.skip
./make-docs.py
# ensure that aws-crt version is consistent among different files
consistent-crt-version:
runs-on: ubuntu-22.04 # latest
steps:
- uses: actions/checkout@v2
- name: Consistent aws-crt version
run: |
./update-crt.py --check_consistency
check-codegen-edits:
runs-on: ubuntu-22.04 # latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check for edits to code-generated files
run: |
./utils/check_codegen_edits.py