-
Notifications
You must be signed in to change notification settings - Fork 44
262 lines (247 loc) · 11.1 KB
/
ci.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
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
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
name: CI
permissions:
id-token: write
contents: write
on:
push:
branches: ["*"]
tags: ["v*.*.*"]
pull_request:
branches: ["*"]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
linting:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- run: sudo apt-get install expect
- run: pip install pre-commit
- run: unbuffer pre-commit run --all-files
build-amd64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/fwe-build"
with:
build-arch: "native"
upload-arch: "amd64"
extra-options:
"--with-someip-support --with-lks-support --with-greengrassv2-support
--with-custom-function-examples --with-store-and-forward-support --with-uds-dtc-example"
dist-name: "aws-iot-fleetwise-edge"
cache-paths: /usr/local/x86_64-linux-gnu
dist-files: build/aws-iot-fleetwise-edge:.
build-arm64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/fwe-build"
with:
build-arch: "cross-arm64"
upload-arch: "arm64"
extra-options:
"--with-greengrassv2-support --with-someip-support --with-lks-support
--with-custom-function-examples --with-store-and-forward-support --with-uds-dtc-example"
dist-name: "aws-iot-fleetwise-edge"
cache-paths: /usr/local/aarch64-linux-gnu:/usr/local/x86_64-linux-gnu
dist-files: build/aws-iot-fleetwise-edge:.
build-armhf:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/fwe-build"
with:
build-arch: "cross-armhf"
upload-arch: "armhf"
extra-options:
"--with-greengrassv2-support --with-someip-support --with-lks-support
--with-iwave-gps-support --with-custom-function-examples
--with-store-and-forward-support --with-uds-dtc-example"
dist-name: "aws-iot-fleetwise-edge"
cache-paths: /usr/local/arm-linux-gnueabihf:/usr/local/x86_64-linux-gnu
dist-files: build/aws-iot-fleetwise-edge:.
build-ros2-amd64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/fwe-build"
with:
build-arch: "native"
upload-arch: "amd64"
extra-options:
"--with-greengrassv2-support --with-ros2-support --with-someip-support
--with-lks-support --with-custom-function-examples --with-store-and-forward-support
--with-uds-dtc-example"
dist-name: "aws-iot-fleetwise-edge-ros2"
cache-paths: /usr/local/x86_64-linux-gnu:/opt/ros
dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:.
build-ros2-arm64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/fwe-build"
with:
build-arch: "cross-arm64"
upload-arch: "arm64"
extra-options:
"--with-greengrassv2-support --with-ros2-support --with-someip-support
--with-lks-support --with-custom-function-examples --with-store-and-forward-support
--with-uds-dtc-example"
dist-name: "aws-iot-fleetwise-edge-ros2"
cache-paths: /usr/local/aarch64-linux-gnu:/usr/local/x86_64-linux-gnu:/opt/ros
dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:.
build-ros2-armhf:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/fwe-build"
with:
build-arch: "cross-armhf"
upload-arch: "armhf"
extra-options:
"--with-greengrassv2-support --with-ros2-support --with-someip-support
--with-lks-support --with-custom-function-examples --with-store-and-forward-support
--with-uds-dtc-example"
dist-name: "aws-iot-fleetwise-edge-ros2"
cache-paths: /usr/local/arm-linux-gnueabihf:/usr/local/x86_64-linux-gnu:/opt/ros
dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:.
build-android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/fwe-build"
with:
build-arch: "cross-android"
upload-arch: "android"
extra-options: "--with-lks-support --with-custom-function-examples"
dist-name: "aws-iot-fleetwise-edge"
cache-paths: /usr/local/x86_64-linux-android:/usr/local/aarch64-linux-android:/usr/local/armv7a-linux-androideabi:/usr/local/x86_64-linux-gnu
dist-files:
build/x86_64/libaws-iot-fleetwise-edge.so:x86_64
build/armeabi-v7a/libaws-iot-fleetwise-edge.so:armeabi-v7a
build/arm64-v8a/libaws-iot-fleetwise-edge.so:arm64-v8a
- name: build-app
run: |
mkdir -p tools/android-app/app/src/main/jniLibs
cp -r build/dist/x86_64 build/dist/arm64-v8a build/dist/armeabi-v7a tools/android-app/app/src/main/jniLibs
cp THIRD-PARTY-LICENSES tools/android-app/app/src/main/assets
if [ "${GITHUB_REPOSITORY}" == "aws/aws-iot-fleetwise-edge" ]; then
curl -o tools/android-app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp \
https://fleetwise-app.automotive.iot.aws.dev/ic_launcher.webp
fi
cd tools/android-app
unset ANDROID_SDK_ROOT
ANDROID_HOME=/usr/local/android_sdk ./gradlew assembleRelease
- uses: aws-actions/configure-aws-credentials@v4
if: github.repository == 'aws/aws-iot-fleetwise-edge' && github.event_name == 'push'
with:
role-to-assume: ${{ secrets.ANDROID_SIGNING_ROLE }}
aws-region: us-east-1
- name: sign-app
if: github.repository == 'aws/aws-iot-fleetwise-edge' && github.event_name == 'push'
run: |
source tools/install-deps-versions.sh
SIGNING_INFO=`aws secretsmanager get-secret-value --region us-east-1 --secret-id AndroidAppKeyStore | jq -r .SecretString`
echo "${SIGNING_INFO}" | jq -r .KeyStore | base64 --decode > ~/android-signing.jks
KEYSTORE_PASSWORD=`echo "${SIGNING_INFO}" | jq -r .KeyStorePassword`
cd tools/android-app
/usr/local/android_sdk/build-tools/${VERSION_ANDROID_BUILD_TOOLS}/zipalign -v -p 4 \
app/build/outputs/apk/release/app-release-unsigned.apk \
app/build/outputs/apk/release/app-release-unsigned-aligned.apk
/usr/local/android_sdk/build-tools/${VERSION_ANDROID_BUILD_TOOLS}/apksigner sign \
--ks ~/android-signing.jks \
--ks-pass "pass:${KEYSTORE_PASSWORD}" \
--out app/build/outputs/apk/release/aws-iot-fleetwise-edge.apk \
app/build/outputs/apk/release/app-release-unsigned-aligned.apk
shred -u ~/android-signing.jks
- name: upload-artifacts
if: github.repository == 'aws/aws-iot-fleetwise-edge' && github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: build-android-app
path: |
tools/android-app/app/build/outputs/apk/release/aws-iot-fleetwise-edge.apk
- name: upload-asset
if: github.repository == 'aws/aws-iot-fleetwise-edge' && github.ref_type == 'tag'
run: |
RELEASE_VERSION="${GITHUB_REF/refs\/tags\//}"
gh release upload ${RELEASE_VERSION} tools/android-app/app/build/outputs/apk/release/aws-iot-fleetwise-edge.apk
build-docker:
runs-on: ubuntu-20.04
needs:
- build-amd64
- build-arm64
- build-armhf
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Move artifacts to match buildx TARGETPLATFORM structure
run: |
mkdir -p linux/amd64
mv aws-iot-fleetwise-edge-amd64/aws-iot-fleetwise-edge-amd64.tar.gz linux/amd64/aws-iot-fleetwise-edge.tar.gz
tar -zcf linux/amd64/opt.tar.gz -T /dev/null # Create empty tar.gz
mkdir -p linux/arm64
mv aws-iot-fleetwise-edge-arm64/aws-iot-fleetwise-edge-arm64.tar.gz linux/arm64/aws-iot-fleetwise-edge.tar.gz
tar -zcf linux/arm64/opt.tar.gz -T /dev/null # Create empty tar.gz
mkdir -p linux/arm/v7
mv aws-iot-fleetwise-edge-armhf/aws-iot-fleetwise-edge-armhf.tar.gz linux/arm/v7/aws-iot-fleetwise-edge.tar.gz
tar -zcf linux/arm/v7/opt.tar.gz -T /dev/null # Create empty tar.gz
- uses: "./.github/template/docker-build"
with:
dist-name: aws-iot-fleetwise-edge
push-role: ${{ secrets.PUBLIC_ECR_PUSH_ROLE }}
build-docker-ros2:
runs-on: ubuntu-20.04
needs:
- build-ros2-amd64
- build-ros2-arm64
- build-ros2-armhf
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Move artifacts to match buildx TARGETPLATFORM structure
run: |
mkdir -p linux/amd64
mv aws-iot-fleetwise-edge-ros2-amd64/aws-iot-fleetwise-edge-ros2-amd64.tar.gz linux/amd64/aws-iot-fleetwise-edge.tar.gz
mv aws-iot-fleetwise-edge-ros2-amd64/opt.tar.gz linux/amd64/opt.tar.gz
mkdir -p linux/arm64
mv aws-iot-fleetwise-edge-ros2-arm64/aws-iot-fleetwise-edge-ros2-arm64.tar.gz linux/arm64/aws-iot-fleetwise-edge.tar.gz
mv aws-iot-fleetwise-edge-ros2-arm64/opt.tar.gz linux/arm64/opt.tar.gz
mkdir -p linux/arm/v7
mv aws-iot-fleetwise-edge-ros2-armhf/aws-iot-fleetwise-edge-ros2-armhf.tar.gz linux/arm/v7/aws-iot-fleetwise-edge.tar.gz
mv aws-iot-fleetwise-edge-ros2-armhf/opt.tar.gz linux/arm/v7/opt.tar.gz
- uses: "./.github/template/docker-build"
with:
dist-name: aws-iot-fleetwise-edge-ros2
push-role: ${{ secrets.PUBLIC_ECR_PUSH_ROLE }}
copy-cfn-templates:
runs-on: ubuntu-20.04
if:
github.repository == 'aws/aws-iot-fleetwise-edge' && (github.ref_type == 'tag' ||
(github.event_name == 'push' && github.ref == 'refs/heads/main'))
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CFN_TEMPLATES_COPY_ROLE }}
aws-region: us-east-1
- name: copy-to-s3
run: |
SRC_PATH="tools/cfn-templates/"
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
RELEASE_VERSION="${GITHUB_REF/refs\/tags\//}"
DEST_URL="s3://aws-iot-fleetwise/${RELEASE_VERSION}/cfn-templates/"
aws s3 cp --recursive --acl "authenticated-read" --exclude README.md ${SRC_PATH} ${DEST_URL}
fi
if [ "${GITHUB_EVENT_NAME}" == "push" ] && [ "${GITHUB_REF}" == "refs/heads/main" ]; then
LATEST_URL="s3://aws-iot-fleetwise/latest/"
aws s3 rm --recursive ${LATEST_URL}
DEST_URL="${LATEST_URL}cfn-templates/"
aws s3 cp --recursive --acl "authenticated-read" --exclude README.md ${SRC_PATH} ${DEST_URL}
fi