-
Notifications
You must be signed in to change notification settings - Fork 24
189 lines (188 loc) · 10.8 KB
/
build-gg-lite.yml
File metadata and controls
189 lines (188 loc) · 10.8 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
name: build-gg-lite
on:
pull_request:
workflow_dispatch:
inputs:
upload-zip:
description: 'Create image zip files, upload to GH artifact store and provide a link.'
type: boolean
required: false
default: false
upload-source-zip:
description: 'Create source zip files, upload to GH artifact store and a provide a link, this means also building images without network.'
type: boolean
required: false
default: false
clean:
description: 'Clean sstate + downloads dir, force download + rebuild of everything.'
type: boolean
required: false
default: false
push:
branches:
- master-next
permissions:
contents: read
jobs:
clean:
runs-on: codebuild-${{ vars.CODEBUILD_RUNNER_NAME || 'meta-aws-demos' }}-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: clean sstate-cache + downloads
if: inputs.clean
shell: bash
run:
rm -rf /sstate-cache/*
rm -rf /downloads/*
build:
needs: clean
strategy:
fail-fast: false
matrix:
include:
# aws-iot-greengrass-lite-demo-image (only on raspberrypi devices)
- { device: raspberrypi2, image: aws-iot-greengrass-lite-demo-image }
- { device: raspberrypi-64, image: aws-iot-greengrass-lite-demo-image }
# aws-iot-greengrass-lite-demo-simple-image (all devices)
- { device: qemuarm, image: aws-iot-greengrass-lite-demo-simple-image }
- { device: qemuarm64, image: aws-iot-greengrass-lite-demo-simple-image }
- { device: qemux86-64, image: aws-iot-greengrass-lite-demo-simple-image }
- { device: aws-ec2-arm64, image: aws-iot-greengrass-lite-demo-simple-image }
- { device: aws-ec2-x86-64, image: aws-iot-greengrass-lite-demo-simple-image }
- { device: raspberrypi2, image: aws-iot-greengrass-lite-demo-simple-image }
- { device: raspberrypi-64, image: aws-iot-greengrass-lite-demo-simple-image }
- { device: stm32mp13-disco, image: aws-iot-greengrass-lite-demo-simple-image }
# aws-iot-greengrass-lite-demo-tiny-image (all devices)
- { device: qemuarm, image: aws-iot-greengrass-lite-demo-tiny-image }
- { device: qemuarm64, image: aws-iot-greengrass-lite-demo-tiny-image }
- { device: qemux86-64, image: aws-iot-greengrass-lite-demo-tiny-image }
- { device: aws-ec2-arm64, image: aws-iot-greengrass-lite-demo-tiny-image }
- { device: aws-ec2-x86-64, image: aws-iot-greengrass-lite-demo-tiny-image }
- { device: raspberrypi2, image: aws-iot-greengrass-lite-demo-tiny-image }
- { device: raspberrypi-64, image: aws-iot-greengrass-lite-demo-tiny-image }
- { device: stm32mp13-disco, image: aws-iot-greengrass-lite-demo-tiny-image }
# aws-iot-greengrass-lite-container-demo-image (qemuarm64 only)
- { device: qemuarm64, image: aws-iot-greengrass-lite-container-demo-image }
runs-on: codebuild-${{ vars.CODEBUILD_RUNNER_NAME || 'meta-aws-demos' }}-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Debug - Print Public IP Address
run: |
echo "Runner Public IP Address:"
curl -s https://checkip.amazonaws.com || curl -s https://api.ipify.org
- name: checkout meta-aws-demos branch to build
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: build fast
if: ${{ !inputs.upload-source-zip }}
shell: bash
run: |
chown yoctouser /sstate-cache
chown yoctouser /downloads
chown -R yoctouser .
sysctl vm.mmap_min_addr=65536
env
sudo -u yoctouser bash -c '\
whoami && \
id && \
. init-build-env &&
export SSTATE_DIR=/sstate-cache && \
export DL_DIR=/downloads && \
export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS SSTATE_DIR DL_DIR" && \
export DEVICE=${{ matrix.device }} && \
export IMAGE=${{ matrix.image }} && \
bitbake $IMAGE -f && \
[[ "${{ matrix.image }}" == "aws-iot-greengrass-lite-demo-image" ]] && bitbake aws-iot-greengrass-lite-demo-bundle -f || true && \
bitbake-getvar -q --value -r greengrass-lite SRCREV > GREENGRASS_SRCREV && \
bitbake-getvar -q --value -r greengrass-lite PV > GREENGRASS_PV '
- name: fetch sources and build from pre-fetched sources without network
if: inputs.upload-source-zip
shell: bash
run: |
chown -R yoctouser .
sysctl vm.mmap_min_addr=65536
env
sudo -u yoctouser bash -c '\
whoami && \
id && \
. init-build-env &&
export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS" && \
export DEVICE=${{ matrix.device }} && \
export IMAGE=${{ matrix.image }} && \
bitbake $IMAGE --runall=fetch && \
[[ "${{ matrix.image }}" == "aws-iot-greengrass-lite-demo-image" ]] && bitbake aws-iot-greengrass-lite-demo-bundle --runall=fetch || true && \
echo BB_NO_NETWORK = \"1\" > conf/site.conf && \
rm -rf downloads/git2/* && \
bitbake $IMAGE && \
[[ "${{ matrix.image }}" == "aws-iot-greengrass-lite-demo-image" ]] && bitbake aws-iot-greengrass-lite-demo-bundle || true && \
bitbake-getvar -q --value -r greengrass-lite SRCREV > GREENGRASS_SRCREV && \
bitbake-getvar -q --value -r greengrass-lite PV > GREENGRASS_PV '
- name: Generate readme
run: |
mkdir ${{ github.workspace }}/zipfile/
cp ${{ github.workspace }}/.github/workflows/build-gg-artifacts/readme-greengrass-lite-template.txt ${{ github.workspace }}/zipfile/readme.txt
cat ${{ github.workspace }}/.github/workflows/build-gg-artifacts/readme-license.txt >> ${{ github.workspace }}/zipfile/readme.txt
sed -i 's|{{ VERSION_LINK }}|${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|g' ${{ github.workspace }}/zipfile/readme.txt
sed -i "s|{{ GREENGRASS_SRCREV }}|$(cat ${{ github.workspace }}/build/GREENGRASS_SRCREV)|g" ${{ github.workspace }}/zipfile/readme.txt
sed -i "s|{{ GREENGRASS_PV }}|$(cat ${{ github.workspace }}/build/GREENGRASS_PV)|g" ${{ github.workspace }}/zipfile/readme.txt
- name: Generate readme, raspberrypi-64
if: ${{ startsWith(matrix.device, 'raspberrypi-64') && startsWith(matrix.image, 'aws-iot-greengrass-lite-demo-image') }}
run: |
echo -e "\n###############################################################################\n#" >> ${{ github.workspace }}/zipfile/readme.txt
echo -e "# LIST OF PACKAGES WITH THEIR LICENSE AND VERSION\n#" >> ${{ github.workspace }}/zipfile/readme.txt
echo -e "###############################################################################\n" >> ${{ github.workspace }}/zipfile/readme.txt
cat ${{ github.workspace }}/build/tmp/deploy/licenses/raspberrypi_armv8/${{ matrix.image }}-raspberrypi-armv8.rootfs/license.manifest >> ${{ github.workspace }}/zipfile/readme.txt
- name: cp image (raspberrypi) to zip dir
if: startsWith(matrix.device, 'raspberrypi2')
shell: bash
run: |
cp ${{ github.workspace }}/build/tmp/deploy/images/${{ matrix.device }}/${{ matrix.image }}-${{ matrix.device }}.rootfs.wic ${{ github.workspace }}/zipfile/${{ matrix.image }}-${{ matrix.device }}.img
ls -la ${{ github.workspace }}/zipfile/
- name: cp image (raspberrypi-) to zip dir
if: startsWith(matrix.device, 'raspberrypi-64')
shell: bash
run: |
cp ${{ github.workspace }}/build/tmp/deploy/images/raspberrypi-armv8/${{ matrix.image }}-raspberrypi-armv8.rootfs.wic ${{ github.workspace }}/zipfile/${{ matrix.image }}-${{ matrix.device }}.img
[[ "${{ matrix.image }}" == "aws-iot-greengrass-lite-demo-image" ]] && mkdir ${{ github.workspace }}/bundle/
[[ "${{ matrix.image }}" == "aws-iot-greengrass-lite-demo-image" ]] && cp ${{ github.workspace }}/build/tmp/deploy/images/raspberrypi-armv8/aws-iot-greengrass-lite-demo-bundle-raspberrypi-armv8.raucb ${{ github.workspace }}/bundle/${{ matrix.image }}-${{ matrix.device }}.raucb
ls -la ${{ github.workspace }}/zipfile/
- name: cp image (aws-ec2) to zip dir
if: startsWith(matrix.device, 'aws-ec2')
shell: bash
run: |
cp ${{ github.workspace }}/build/tmp/deploy/images/${{ matrix.device }}/${{ matrix.image }}-${{ matrix.device }}.rootfs.wic.vhd ${{ github.workspace }}/zipfile/aws-greengrass-lite-demo-image.wic.vhd
cp ${{ github.workspace }}/build/tmp/deploy/images/${{ matrix.device }}/${{ matrix.image }}-${{ matrix.device }}.rootfs.testdata.json ${{ github.workspace }}/zipfile/
cp ${{ github.workspace }}/layers/sw/meta-aws/scripts/ec2-ami/README.md ${{ github.workspace }}/zipfile/
cp ${{ github.workspace }}/layers/sw/meta-aws/scripts/ec2-ami/vmimport-cfn.yml ${{ github.workspace }}/zipfile/
cp ${{ github.workspace }}/.github/workflows/build-gg-artifacts/ec2/create-ec2-ami.sh ${{ github.workspace }}/zipfile/
cp -r ${{ github.workspace }}/layers/sw/meta-aws/scripts/ec2-ami/* ${{ github.workspace }}/zipfile/
echo "To upload the image to EC2 run: bash ./create-ec2-ami.sh amitest-bucket 16 aws-greengrass-lite-demo-image aws-ec2-arm64" >> ${{ github.workspace }}/zipfile/readme.txt
ls -la ${{ github.workspace }}/zipfile/
- name: Create and save zipfile
if: (startsWith(matrix.device, 'raspberrypi') || startsWith(matrix.device, 'aws-ec2') ) && inputs.upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.image }}_${{ matrix.device }}
path: |
${{ github.workspace }}/zipfile/*
retention-days: 5
compression-level: 9
- name: Upload src zipfile
if: (startsWith(matrix.device, 'raspberrypi') || startsWith(matrix.device, 'aws-ec2') ) && inputs.upload-source-zip
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.image }}_${{ matrix.device }}_downloads
path: |
${{ github.workspace }}/build/downloads/*
!${{ github.workspace }}/build/downloads/*/
retention-days: 5
compression-level: 9
- name: Upload bundle zipfile
if: ${{ startsWith(matrix.device, 'raspberrypi-64') && startsWith(matrix.image, 'aws-iot-greengrass-lite-demo-image') }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.image }}_${{ matrix.device }}_raucb
path: |
${{ github.workspace }}/bundle/*
retention-days: 5
compression-level: 9