forked from PhotonVision/photon-image-modifier
-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (169 loc) · 7.94 KB
/
main.yml
File metadata and controls
181 lines (169 loc) · 7.94 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
name: Build driver
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
include:
- name: limelight
script: ./install_limelight.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: limelight3
script: ./install_limelight3.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: limelight3g
script: ./install_limelight3g.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: limelight4
script: ./install_limelight4.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: raspi
script: ./install_pi.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: raspi_dev
script: ./install_dev_pi.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: snakeyes
script: ./install_snakeyes.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: luma_p1
script: ./install_luma_p1.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz
- name: opi5
script: ./install_opi5.sh
base_image: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.4.0/ubuntu-24.04-preinstalled-server-arm64-orangepi-5.img.xz
- name: opi5b
script: ./install_opi5.sh
base_image: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.4.0/ubuntu-24.04-preinstalled-server-arm64-orangepi-5b.img.xz
- name: opi5plus
script: ./install_opi5.sh
base_image: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.4.0/ubuntu-24.04-preinstalled-server-arm64-orangepi-5-plus.img.xz
- name: opi5pro
script: ./install_opi5.sh
base_image: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.4.0/ubuntu-24.04-preinstalled-server-arm64-orangepi-5-pro.img.xz
- name: opi5max
script: ./install_opi5.sh
base_image: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.4.0/ubuntu-24.04-preinstalled-server-arm64-orangepi-5-max.img.xz
- name: opi6plus
script: ./install_opi6.sh
base_image: https://sidequests.reduxrobotics.com/opi6/Orangepi6plus_1.0.2_debian_bookworm_server_linux6.6.89.img.xz
- name: rock5c
script: ./install_opi5.sh
base_image: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.4.0/ubuntu-24.04-preinstalled-server-arm64-rock-5c.img.xz
- name: rubikpi3
script: ./install_rubikpi3.sh
base_image: https://people.canonical.com/~platform/images/qualcomm-iot/rubikpi3/ubuntu-server-24.04/x01/ubuntu-24.04-preinstalled-server-arm64+rubikpi3-20250926-145.yaml
root_location: "offset=569376768"
shrink_image: "no"
name: "Build for ${{ matrix.name }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
df -h
- name: Generate version file
run: |
# Build the final JSON object
json_string=$(jq -n \
--arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--arg commit_sha "${GITHUB_SHA}" \
--arg commit_tag "$(git describe --tags --abbrev=0 2>/dev/null || echo "untagged")" \
--arg image_name "${{ matrix.name }}" \
--arg image_source "${{ matrix.base_image }}" \
'{build_date: $date, commit_sha: $commit_sha, commit_tag: $commit_tag, image_name: $image_name, image_source: $image_source}')
echo "$json_string"
echo "$json_string" > image-version.json
- name: Install dependencies and build image
uses: photonvision/photon-image-runner@HEAD
id: install_deps
with:
additional_mb: 6000
minimum_free_mb: 6000
image_url: ${{ matrix.base_image }}
root_location: ${{ matrix.root_location || 'partition=2' }}
boot_partition:
shrink_image: ${{ matrix.shrink_image || 'yes' }}
commands: |
set -e
df -h
echo "Running ${{ matrix.script }}"
chmod +x "${{ matrix.script }}"
"./${{ matrix.script }}"
df -h
echo "Running install_common.sh"
chmod +x "./install_common.sh"
"./install_common.sh"
- name: Compress built image
# Compress the standard images
if: ${{ ! startsWith(matrix.name, 'rubik') }}
run: |
sudo mv ${{ steps.install_deps.outputs.image }} photonvision_${{ matrix.name }}.img
sudo xz -T 0 -v photonvision_${{ matrix.name }}.img
echo "artifact=photonvision_${{ matrix.name }}.img.xz" >> "$GITHUB_ENV"
- name: Tar built image
# Build the RubikPi3-specific tar file
if: ${{ startsWith(matrix.name, 'rubik') }}
run: |
imagedir=$(dirname ${{ steps.install_deps.outputs.image }})
target=photonvision_${{ matrix.name }}
tardir=${target}
mkdir --parents ${tardir}
echo "Contents of imagedir: ${imagedir}"
ls -la ${imagedir}
if ls ${imagedir}/*.tar.gz 1>/dev/null 2>&1; then
sudo tar -xzf ${imagedir}/*.tar.gz -C ${tardir} --strip-components=1
fi
sudo mv ${imagedir}/rawprogram*.xml ${tardir}/ 2>/dev/null || true
sudo mv ${imagedir}/dtb.bin ${tardir}/ 2>/dev/null || true
sudo mv ${imagedir}/*.img ${tardir}/ 2>/dev/null || true
sudo find ${tardir} -mindepth 2 -type f -exec mv {} ${tardir}/ \;
sudo find ${tardir} -mindepth 1 -type d -empty -delete
echo "Contents of tardir: ${tardir}"
ls -la ${tardir}
sudo tar -I 'xz -T0' --create --file=${target}.tar.xz ${tardir} --checkpoint=10000 --checkpoint-action=echo='%T'
echo "Contents of tar file:"
# Expenive operation (has to unzip the file), only use for debugging
# echo "Contents of tar file:"
# tar --list --file=${target}.tar.xz
echo "artifact=${target}.tar.xz" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact }}
path: ${{ env.artifact }}
if-no-files-found: error
retention-days: 1
- run: df -h
if: always()
release:
needs: [build]
runs-on: ubuntu-24.04
steps:
# Download literally every single artifact
- uses: actions/download-artifact@v4.1.8
- run: find
# Push to dev release and/or to a real release if tagged using semantic versioning
# See https://github.com/pyTooling/Actions/tree/dev/releaser
- uses: pyTooling/Actions/releaser@v1.0.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: 'Dev'
rm: true
files: |
**/*.xz
if: github.event_name == 'push'