-
Notifications
You must be signed in to change notification settings - Fork 58
365 lines (325 loc) · 12.2 KB
/
eventbuild.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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
name: Image build on event
on:
push:
branches:
- "2.6-evo"
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false # Don't fail all if any of the jobs is failing
matrix:
TARGET: [pi-bullseye, x86-minimal, x86-lunar, radxa-cm3, x20, radxa-zero3w, rock5b, rock5a, qcs405] # <-- Add targets here!
#TARGET: [qrb5165] # <-- Add targets here!
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 100
swap-size-mb: 200
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
overprovision-lvm: 'true'
- name: Setup env
run: |
echo "DT=$(date -d '+1 hour' +'%m-%d-%Y-%H-%M-%S')" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "$GITHUB_ENV"
### ONLY THIS RELEVANT FOR BUILDING ###
- uses: actions/checkout@v4
- name: update
run: sudo apt-get update
- name: remove even more
run: |
sudo apt-get purge -y \
'^llvm-.*' \
'php.*' \
'^mongodb-.*' \
'^mysql-.*' \
azure-cli \
google-chrome-stable \
firefox \
powershell \
microsoft-edge-stable \
mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
- name: dep
run: sudo apt-get install -y unzip curl git qemu qemu-user-static binfmt-support
- name: update e2fsprogs
if: matrix.TARGET == 'x86-lunar'
run: |
git clone https://github.com/tytso/e2fsprogs
cd e2fsprogs
mkdir build
cd build
../configure
make
sudo make install
- name: Build Image
run: |
touch additionalFiles/issue-new.txt
echo "OpenHD-image-${{ matrix.TARGET }}-${{ matrix.DISTRO }}-${GITHUB_REF##*/}-${{ env.DT }}" > additionalFiles/issue-new.txt
sudo ./build.sh ${{ matrix.TARGET }}
# - name: debug
# run: |
# dd if=/dev/zero of=large_image.img bs=1M count=5650
# ls -a
# mkdir deploy
# mv *.img deploy/
- name: remove old image to make space
run: |
sudo rm -Rf -v ./work-jetson-nano-2gb-bionic/03-Preconfiguration/*
sudo rm -Rf -v ./work-jetson-nano-4gb-bionic/03-Preconfiguration/*
sudo rm -Rf -v ./work-pi-bullseye/03-Preconfiguration/*
sudo rm -Rf -v ./work-pi-legacy-bullseye/03-Preconfiguration/*
- name: magic
run: |
ls -a
sudo df -h
sudo mv ./deploy/*.img ./OpenHD-image-${{ matrix.TARGET }}-${{ matrix.DISTRO }}-${GITHUB_REF##*/}-${{ env.DT }}.img
echo "moved image"
sudo rm -rvf deploy*
sudo rm -rvf work*
sudo rm -Rf /usr/share/doc
sudo rm -Rf /home/linuxbrew
sudo rm -Rf /home/runner-admin
sudo rm -Rf /opt/hostedtoolcache
sudo rm -Rf /opt/microsoft
sudo rm -Rf /opt/hhvm
sudo apt autoremove -y
sudo df -h
########################################
- name: Compose release filename
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
run: echo "artifact_name=OpenHD-image-${{ matrix.TARGET }}-${{ matrix.DISTRO }}-${GITHUB_REF##*/}-${{ env.DT }}" >> $GITHUB_ENV
- name: Pack image for ${{ matrix.TARGET }}
uses: 'actions/upload-artifact@v4'
with:
name: "${{ matrix.TARGET }}-${{ env.DT }}"
path: |
*.img
if-no-files-found: error
createEmmcImage:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false # Don't fail all if any of the jobs is failing
matrix:
TARGET: [radxa-zero3w] # <-- Add targets here!
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 100
swap-size-mb: 200
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
overprovision-lvm: 'true'
- name: Setup env
run: |
echo "DT=$(date -d '+1 hour' +'%m-%d-%Y--%H-%M-%S')" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
if [ "${{ matrix.TARGET }}" == "radxa-zero3w" ]; then
ARTIFACT_PREFIX="zero3w"
elif [ "${{ matrix.TARGET }}" == "radxa-cm3" ]; then
ARTIFACT_PREFIX="34te"
elif [ "${{ matrix.TARGET }}" == "radxa-cm5" ]; then
ARTIFACT_PREFIX="radxa-323"
else
echo "Unsupported TARGET"
exit 1
fi
echo "ARTIFACT_PREFIX=${ARTIFACT_PREFIX}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: dep
run: sudo apt update && sudo apt-get install -y unzip curl git qemu qemu-user-static binfmt-support
- name: List Artifacts
run: |
for artifact in $(find . -name "${{ matrix.TARGET }}*"); do
echo $artifact
done
- name: Print Artifacts
run: |
echo "Artifacts: ${{ steps.list_artifacts.outputs.artifacts_filtered }}"
- name: Download Zero3w Artifact
id: download_zero3w_artifact
uses: actions/download-artifact@v4
with:
name: ${{ steps.list_artifacts.outputs.zero3w_artifacts }}
- name: debug_step
run: |
mkdir -p additionalFiles
touch emmc
touch additionalFiles/emmc
ls -a
- name: buildImage
run: |
ls -a
sudo apt install -y xz-utils
cd ${{ matrix.TARGET }}*
ls -a
cp *.img ../additionalFiles/emmc.img
cd ../additionalFiles
gzip -c *.img > emmc.img.gz
rm *.img
cd ../
ls -a
sudo ./build.sh ${{ matrix.TARGET }}
cd deploy
sudo mv *.img ../OpenHD-EMMC-${{ matrix.TARGET }}-${{ matrix.DISTRO }}-${GITHUB_REF##*/}.img
- name: Compose release filename
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
run: echo "artifact_name=OpenHD-EMMC-image-${{ matrix.TARGET }}-${{ matrix.DISTRO }}-${GITHUB_REF##*/}-${{ env.DT }}" >> $GITHUB_ENV
- name: Pack image for ${{ matrix.TARGET }}
uses: 'actions/upload-artifact@v4'
with:
name: "${{ matrix.TARGET }}-${{ env.DT }}-EMMC"
path: |
*.img
if-no-files-found: error
upload:
if: "github.event_name == 'push' && github.ref == 'refs/heads/release'"
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false # Don't fail all if any of the jobs is failing
matrix:
TARGET: [radxa-zero3w] # <-- Add targets here!
steps:
- name: debug
run: df -h
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: "${{ matrix.TARGET }}*"
- name: compress
run: |
mkdir OpenHD
cp radxa-zero3w*
mv *.img ../OpenHD
cd ../OpenHD*
sha256sum * | cut -f 1 -d " " > ../sha256
echo 'NAME<<EOF' >> $GITHUB_ENV
ls -1 | sed -e 's/.img/.img.xz/g' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo 'SIZEFULL<<EOF' >> $GITHUB_ENV
wc -c *.img | cut -f 1 -d " " >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
xz -v7T0 *.img
mv * ../
- name: Upload to R2
shell: bash
env:
aws_endpoint: "https://fra1.digitaloceanspaces.com"
aws_key_id: ${{ secrets.DIGITALOCEAN_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.DIGITALOCEAN_SECRET_ACCESS_KEY }}
aws_s3_bucket: openhd-images
AWS_EC2_METADATA_DISABLED: true
run: |
aws configure set aws_access_key_id $aws_key_id
aws configure set aws_secret_access_key $aws_secret_access_key
aws s3 --endpoint-url $aws_endpoint cp ${{ env.NAME }} s3://$aws_s3_bucket/Downloader/temp/${{ env.NAME }}
- name: generate variables for the ImageWriter
run: |
export NAME=$(cat last.release)
export FILESIZE=${{ env.SIZEFULL }}
export FILENAME=${{ env.NAME }}
export DOWNLOADSIZE=$(wc -c *.xz | cut -f 1 -d " ")
export SUM=$(cat sha256)
export RELEASEDATE=$(date -d '+1 hour' +'%m-%d-%Y--%H-%M-%S')
echo "$NAME" >> ${{ matrix.TARGET }}.txt
echo "$FILESIZE" >> ${{ matrix.TARGET }}.txt
echo "$FILENAME" >> ${{ matrix.TARGET }}.txt
echo "$DOWNLOADSIZE" >> ${{ matrix.TARGET }}.txt
echo "$SUM" >> ${{ matrix.TARGET }}.txt
echo "$RELEASEDATE" >> ${{ matrix.TARGET }}.txt
wc -c *.xz | cut -f 1 -d " "
- name: Upload text-files to aws
shell: bash
env:
aws_endpoint: "https://fra1.digitaloceanspaces.com"
aws_key_id: ${{ secrets.DIGITALOCEAN_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.DIGITALOCEAN_SECRET_ACCESS_KEY }}
aws_s3_bucket: openhd-images
AWS_EC2_METADATA_DISABLED: true
run: |
aws configure set aws_access_key_id $aws_key_id
aws configure set aws_secret_access_key $aws_secret_access_key
aws s3 --endpoint-url $aws_endpoint cp ${{ matrix.TARGET }}.txt s3://$aws_s3_bucket/Downloader/temp/${{ matrix.TARGET }}.txt
# upload2:
# if: "github.event_name == 'push' && github.ref == 'refs/heads/release'"
# needs: createEmmcImage
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false # Don't fail all if any of the jobs is failing
# matrix:
# TARGET: [radxa-zero3w] # <-- Add targets here!
# steps:
# - name: debug
# run: df -h
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# with:
# name: "${{ matrix.TARGET }}-${{ env.DT }}"
# - name: compress
# run: |
# mkdir OpenHD
# mv *.img OpenHD
# cd OpenHD*
# rm -Rf OpenHD-image-radxa-zero3w*
# sha256sum * | cut -f 1 -d " " > ../sha256
# echo 'NAME<<EOF' >> $GITHUB_ENV
# ls -1 | sed -e 's/.img/.img.xz/g' >> $GITHUB_ENV
# echo 'EOF' >> $GITHUB_ENV
# echo 'SIZEFULL<<EOF' >> $GITHUB_ENV
# wc -c *.img | cut -f 1 -d " " >> $GITHUB_ENV
# echo 'EOF' >> $GITHUB_ENV
# xz -v7T0 *.img
# mv * ../
# - name: Upload to R2
# shell: bash
# env:
# aws_endpoint: "https://fra1.digitaloceanspaces.com"
# aws_key_id: ${{ secrets.DIGITALOCEAN_ACCESS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.DIGITALOCEAN_SECRET_ACCESS_KEY }}
# aws_s3_bucket: openhd-images
# AWS_EC2_METADATA_DISABLED: true
# run: |
# aws configure set aws_access_key_id $aws_key_id
# aws configure set aws_secret_access_key $aws_secret_access_key
# aws s3 --endpoint-url $aws_endpoint cp ${{ env.NAME }} s3://$aws_s3_bucket/Downloader/temp/${{ env.NAME }}
# - name: generate variables for the ImageWriter
# run: |
# export NAME=$(cat last.release)
# export FILESIZE=${{ env.SIZEFULL }}
# export FILENAME=${{ env.NAME }}
# export DOWNLOADSIZE=$(wc -c *.xz | cut -f 1 -d " ")
# export SUM=$(cat sha256)
# export RELEASEDATE=$(date -d '+1 hour' +'%m-%d-%Y--%H-%M-%S')
# echo "$NAME" >> ${{ matrix.TARGET }}.txt
# echo "$FILESIZE" >> ${{ matrix.TARGET }}.txt
# echo "$FILENAME" >> ${{ matrix.TARGET }}.txt
# echo "$DOWNLOADSIZE" >> ${{ matrix.TARGET }}.txt
# echo "$SUM" >> ${{ matrix.TARGET }}.txt
# echo "$RELEASEDATE" >> ${{ matrix.TARGET }}.txt
# wc -c *.xz | cut -f 1 -d " "
# - name: Upload text-files
# shell: bash
# env:
# aws_endpoint: "https://fra1.digitaloceanspaces.com"
# aws_key_id: ${{ secrets.DIGITALOCEAN_ACCESS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.DIGITALOCEAN_SECRET_ACCESS_KEY }}
# aws_s3_bucket: openhd-images
# AWS_EC2_METADATA_DISABLED: true
# run: |
# aws configure set aws_access_key_id $aws_key_id
# aws configure set aws_secret_access_key $aws_secret_access_key
# aws s3 --endpoint-url $aws_endpoint cp ${{ matrix.TARGET }}.txt s3://$aws_s3_bucket/Downloader/temp/${{ matrix.TARGET }}.txt