@@ -12,41 +12,8 @@ concurrency:
1212 cancel-in-progress : true
1313
1414jobs :
15- rubik :
16- env :
17- script : " ./tmp/build/install_rubikpi3.sh"
18- base_image : " https://people.canonical.com/~platform/images/qualcomm-iot/rubikpi3/ubuntu-server-24.04/x00/ubuntu-24.04-preinstalled-server-arm64+rubikpi3-20250912-127.yaml"
19-
20- runs-on : ubuntu-24.04-arm
21-
22- name : " Build for RubikPi3"
23-
24- steps :
25- - uses : actions/checkout@v4.1.7
26- with :
27- fetch-depth : 0
28- - name : Fetch tags
29- run : git fetch --tags --force
30-
31- - name : Build rubikpi3 with mounting
32- run : |
33- chmod +x ./mount_rubikpi3.sh
34- ./mount_rubikpi3.sh ${{ env.base_image }} ${{ env.script }} ${{ github.ref_name }}
35-
36- - name : Compress built image
37- run : |
38- tar -I 'xz -T0' -cf photonvision_rubikpi3.tar.xz photonvision_rubikpi3 --checkpoint=10000 --checkpoint-action=echo='%T'
39-
40- - uses : actions/upload-artifact@v4.3.4
41- with :
42- name : photonvision_rubikpi3.tar.xz
43- path : photonvision_rubikpi3.tar.xz
44- if-no-files-found : error
45- retention-days : 1
46-
4715 build :
48- runs-on : ubuntu-24.04
49-
16+ runs-on : ubuntu-24.04-arm
5017 strategy :
5118 fail-fast : false
5219 matrix :
@@ -93,44 +60,97 @@ jobs:
9360 - name : rock5c
9461 script : ./install_opi5.sh
9562 base_image : https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v2.4.0/ubuntu-24.04-preinstalled-server-arm64-rock-5c.img.xz
63+ - name : rubikpi3
64+ script : ./install_rubikpi3.sh
65+ 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
66+ root_location : " offset=569376768"
67+ shrink_image : " no"
9668
9769 name : " Build for ${{ matrix.name }}"
9870
9971 steps :
100- - uses : actions/checkout@v4.1.7
72+ - uses : actions/checkout@v4
10173 with :
10274 fetch-depth : 0
10375 - name : Fetch tags
10476 run : git fetch --tags --force
10577
106- - uses : pguyot/arm-runner-action@HEAD
78+ - name : Generate version file
79+ run : |
80+
81+ # Build the final JSON object
82+ json_string=$(jq -n \
83+ --arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
84+ --arg commit_sha "${GITHUB_SHA}" \
85+ --arg commit_tag "$(git describe --tags --abbrev=0 2>/dev/null || echo "untagged")" \
86+ --arg image_name "${{ matrix.name }}" \
87+ --arg image_source "${{ matrix.base_image }}" \
88+ '{build_date: $date, commit_sha: $commit_sha, commit_tag: $commit_tag, image_name: $image_name, image_source: $image_source}')
89+
90+ echo "$json_string"
91+
92+ echo "$json_string" > image-version.json
93+
94+ - name : Install dependencies and build image
95+ uses : photonvision/photon-image-runner@HEAD
10796 id : install_deps
10897 with :
109- image_additional_mb : 1500
110- bind_mount_repository : true
111- base_image : ${{ matrix.base_image }}
98+ minimum_free_mb : 2000
99+ image_url : ${{ matrix.base_image }}
100+ root_location : ${{ matrix.root_location || 'partition=2' }}
101+ shrink_image : ${{ matrix.shrink_image || 'yes' }}
112102 commands : |
113- chmod +x ${{matrix.script}}
114- ${{ matrix.script }}
115- chmod +x ./install_common.sh
116- ./ install_common.sh
117- mkdir -p /opt/photonvision/
118- echo "${{ github.ref_name }};${{ matrix.name }}" > /opt/photonvision/image-version
103+ echo "Running ${{ matrix.script }}"
104+ chmod +x " ${{ matrix.script }}"
105+ "./${{ matrix.script }}"
106+ echo "Running install_common.sh"
107+ chmod +x "./install_common.sh"
108+ "./install_common.sh"
119109
120- - name : Compress built image
110+ - name : Compress built image
111+ # Compress the standard images
112+ if : ${{ ! startsWith(matrix.name, 'rubik') }}
121113 run : |
122- mv ${{ steps.install_deps.outputs.image }} photonvision_${{ matrix.name }}.img
114+ sudo mv ${{ steps.install_deps.outputs.image }} photonvision_${{ matrix.name }}.img
123115 sudo xz -T 0 -v photonvision_${{ matrix.name }}.img
116+ echo "artifact=photonvision_${{ matrix.name }}.img.xz" >> "$GITHUB_ENV"
117+
118+ - name : Tar built image
119+ # Build the RubikPi3-specific tar file
120+ if : ${{ startsWith(matrix.name, 'rubik') }}
121+ run : |
122+ imagedir=$(dirname ${{ steps.install_deps.outputs.image }})
123+ target=photonvision_${{ matrix.name }}
124+ tardir=${target}
125+ mkdir --parents ${tardir}
126+ echo "Contents of imagedir: ${imagedir}"
127+ ls -la ${imagedir}
128+ if ls ${imagedir}/*.tar.gz 1>/dev/null 2>&1; then
129+ sudo tar -xzf ${imagedir}/*.tar.gz -C ${tardir} --strip-components=1
130+ fi
131+ sudo mv ${imagedir}/rawprogram*.xml ${tardir}/ 2>/dev/null || true
132+ sudo mv ${imagedir}/dtb.bin ${tardir}/ 2>/dev/null || true
133+ sudo mv ${imagedir}/*.img ${tardir}/ 2>/dev/null || true
134+ sudo find ${tardir} -mindepth 2 -type f -exec mv {} ${tardir}/ \;
135+ sudo find ${tardir} -mindepth 1 -type d -empty -delete
136+ echo "Contents of tardir: ${tardir}"
137+ ls -la ${tardir}
138+ sudo tar -I 'xz -T0' --create --file=${target}.tar.xz ${tardir} --checkpoint=10000 --checkpoint-action=echo='%T'
139+ echo "Contents of tar file:"
140+ # Expenive operation (has to unzip the file), only use for debugging
141+ # echo "Contents of tar file:"
142+ # tar --list --file=${target}.tar.xz
143+ echo "artifact=${target}.tar.xz" >> "$GITHUB_ENV"
124144
125- - uses : actions/upload-artifact@v4.3.4
145+ - uses : actions/upload-artifact@v4
126146 with :
127- name : photonvision_ ${{ matrix.name }}.img.xz
128- path : photonvision_ ${{ matrix.name }}.img.xz
147+ name : ${{ env.artifact }}
148+ path : ${{ env.artifact }}
129149 if-no-files-found : error
130150 retention-days : 1
131151
132152 release :
133- needs : [build, rubik ]
153+ needs : [build]
134154 runs-on : ubuntu-24.04
135155 steps :
136156 # Download literally every single artifact
0 commit comments