Skip to content

Commit 690ab2e

Browse files
CI: deploy for multiple architectures and base OSs
1 parent 8c35177 commit 690ab2e

File tree

2 files changed

+45
-14
lines changed

2 files changed

+45
-14
lines changed

.github/workflows/test-and-deploy.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,29 @@ jobs:
249249
needs: deploy-docker-images
250250
if: github.event_name != 'pull_request' && github.repository_owner == 'bluerobotics'
251251
timeout-minutes: 180 # Detect if it gets into an infinite loop or some unexpected state
252-
runs-on: blueos-ci
253-
# The runner for this job is a Raspberry Pi OS Bullseye.
254-
# Just install docker (curl -sSL https://get.docker.com/ | sh) and follow the instructions for setting up a new runner in
255-
# https://github.com/bluerobotics/BlueOS-docker/settings/actions/runners/new
256-
257252
strategy:
258253
matrix:
259-
platforms: ["linux/arm/v7"]
254+
include:
255+
- runner: blueos-ci
256+
platform: "linux/arm/v7"
257+
os: "bookworm"
258+
image: "raspios_lite_armhf/images/raspios_lite_armhf-2024-07-04/2024-07-04-raspios-bookworm-armhf-lite.img.xz"
259+
- runner: blueos-ci
260+
platform: "linux/arm/v7"
261+
os: "bullseye"
262+
image: "raspios_lite_armhf/images/raspios_lite_armhf-2022-01-28/2022-01-28-raspios-bullseye-armhf-lite.zip"
263+
- runner: pi5-ci
264+
platform: "linux/arm64/v8"
265+
os: "bookworm"
266+
image: "raspios_lite_arm64/images/raspios_lite_arm64-2024-07-04/2024-07-04-raspios-bookworm-arm64-lite.img.xz"
267+
268+
runs-on: ${{ matrix.runner }}
269+
# The runners for this job are:
270+
# - blueos-ci: A Raspberry Pi OS Bullseye (32-bit).
271+
# - pi5-ci: A Raspberry Pi OS Bookworm lite 64-bit.
272+
# For pi5-ci, install docker (curl -sSL https://get.docker.com/ | sh) and follow the instructions for setting up a new runner in
273+
# https://github.com/bluerobotics/BlueOS-docker/settings/actions/runners/new
274+
260275
steps:
261276
- name: Install git
262277
run: sudo apt install -y git
@@ -278,23 +293,39 @@ jobs:
278293
-e PATH=/pimod:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
279294
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
280295
-e VERSION=$GITHUB_REF_NAME \
296+
-e BASE_IMAGE=${{ matrix.image }} \
281297
--workdir=/files \
282-
--platform ${{ matrix.platforms }} nature40/pimod:latest pimod.sh deploy/pimod/blueos.Pifile
298+
--platform ${{ matrix.platform }} nature40/pimod:latest pimod.sh deploy/pimod/blueos.Pifile
299+
300+
- name: Add /boot additions
301+
run: |
302+
sudo apt-get update && sudo apt-get install -y parted kpartx
303+
# Create mount point if it doesn't exist
304+
sudo mkdir -p /mnt/piboot
305+
# Map the image file
306+
LOOP_DEVICE=$(sudo kpartx -avs deploy/pimod/blueos.img | sed -E 's/.*(loop[0-9]+)p[0-9]+.*/\1/g' | head -1)
307+
# Mount the boot partition
308+
sudo mount "/dev/mapper/${LOOP_DEVICE}p1" /mnt/piboot
309+
# Create ssh and userconf files
310+
sudo cp install/boards/config.toml /mnt/piboot/custom.toml
311+
sudo umount /mnt/piboot
312+
sudo kpartx -d deploy/pimod/blueos.img
313+
echo "Boot partition updated successfully."
283314
284-
# TODO: add GITHUB_REF_NAME after https://github.com/actions/upload-artifact/issues/231 is fixed
285-
# name: blueos-${{ env.GITHUB_REF_NAME }}.zip
286315
- name: Zip image
287316
if: startsWith(github.ref, 'refs/tags/')
288317
run: |
289318
sudo apt install zip
290-
zip BlueOS-raspberry.zip deploy/pimod/blueos.img
319+
zip BlueOS-raspberry-${{ matrix.platform }}-${{ matrix.os }}.zip deploy/pimod/blueos.img
320+
321+
- name: Sanitize platform name
322+
run: echo "SANITIZED_PLATFORM=$(echo ${{ matrix.platform }} | tr '/' '-')" >> $GITHUB_ENV
291323

292324
- name: Upload artifact
293325
uses: actions/upload-artifact@v4
294326
timeout-minutes: 120
295327
with:
296-
# We use the .img to avoid a zip of a zip
297-
name: BlueOS-raspberry.zip
328+
name: BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}
298329
path: deploy/pimod/blueos.img
299330
if-no-files-found: error
300331
retention-days: 7
@@ -304,7 +335,7 @@ jobs:
304335
if: startsWith(github.ref, 'refs/tags/')
305336
with:
306337
repo_token: ${{ secrets.GITHUB_TOKEN }}
307-
file: BlueOS-raspberry.zip
338+
file: BlueOS-raspberry-${{ env.SANITIZED_PLATFORM }}-${{ matrix.os }}.zip
308339
tag: ${{ github.ref }}
309340
overwrite: true
310341
prerelease: true

deploy/pimod/blueos.Pifile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2022-01-28/2022-01-28-raspios-bullseye-armhf-lite.zip
1+
FROM https://downloads.raspberrypi.org/${BASE_IMAGE}
22

33
PUMP 2200M
44

0 commit comments

Comments
 (0)