Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2464c4c
add cache action
crschardt Apr 25, 2026
9dbed46
image_path is in env
crschardt Apr 25, 2026
6f8b363
try putting it in outputs
crschardt Apr 25, 2026
a7b215a
deal with undefined
crschardt Apr 25, 2026
177e8d3
not allowed to assign like that
crschardt Apr 25, 2026
f92eb44
don't modify files in the cached location
crschardt Apr 25, 2026
22b9972
recursive
crschardt Apr 25, 2026
fe5a18e
only copy the files
crschardt Apr 25, 2026
be95bcb
try not to use sudo
crschardt Apr 25, 2026
319b501
need sudo here
crschardt Apr 25, 2026
2df01df
add option to control caching
crschardt Apr 25, 2026
919d0da
test disabling cache
crschardt Apr 25, 2026
c595024
use caching as default
crschardt Apr 26, 2026
2d308b9
fix the name of the test opi image
crschardt Apr 26, 2026
b9e5c7d
test zstd for speed
crschardt Apr 26, 2026
fe5a0d8
wow
crschardt Apr 26, 2026
2445a4e
try -19 to approximate default xz compression
crschardt Apr 26, 2026
7482d47
try compression level 10
crschardt Apr 26, 2026
9029f80
try compression level 15
crschardt Apr 26, 2026
50312e2
Revert "try compression level 15"
crschardt Apr 26, 2026
452f3ac
clean up test workflows
crschardt Apr 26, 2026
ba667a9
needed the checkout action
crschardt Apr 26, 2026
428b853
place rootdir in same filesystem as image
crschardt Apr 26, 2026
f950a8c
fix bugs in workflows
crschardt Apr 26, 2026
003651b
nicer action log messages
crschardt Apr 26, 2026
86a509c
clean up build script
crschardt Apr 26, 2026
0379434
wrong directory refernce
crschardt Apr 26, 2026
002e9fe
image should include the full path
crschardt Apr 26, 2026
f4c816d
make sure to extract the tar file in the right place
crschardt Apr 26, 2026
a58d308
image_path should be in outputs
crschardt Apr 26, 2026
e5df5e0
do these need to be sudo?
crschardt Apr 26, 2026
5ab92c5
Revert "do these need to be sudo?"
crschardt Apr 26, 2026
af55128
Revert "image_path should be in outputs" and fix the problem that I w…
crschardt Apr 26, 2026
389c36c
tweak comments
crschardt Apr 26, 2026
cf0c910
clean up get_image.sh
crschardt Apr 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/test-opi.yml

This file was deleted.

53 changes: 0 additions & 53 deletions .github/workflows/test-raspi.yml

This file was deleted.

30 changes: 19 additions & 11 deletions .github/workflows/test-rubikpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,45 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
- uses: ./

- name: Test using downloaded (cached) image
id: test_download_image
uses: ./
with:
image_url: https://people.canonical.com/~platform/images/qualcomm-iot/rubikpi3/ubuntu-server-24.04/x01/ubuntu-24.04-preinstalled-server-arm64+rubikpi3-20250926-145.yaml
minimum_free_mb: 2000
root_location: "offset=569376768"
shrink_image: "no"
use_cache: "yes"
boot_partition: ""
commands: |
echo "Testing Rubik Pi image"
echo "Testing Rubik Pi image from .yaml"
uname -a
lsblk
echo "${loopdev}"
id: build_image
touch /photon-image-modifier-was-here
ls /

- name: Test using image file
id: test_file_image
uses: ./ # photonvision/photon-image-runner@HEAD
with:
image_url: "file://${{ steps.build_image.outputs.image }}"
image_url: "file://${{ steps.test_download_image.outputs.image }}"
root_location: "offset=569376768"
shrink_image: "no"
use_cache: "yes"
boot_partition: ""
commands: |
echo "Testing file access Rubik Pi image"
uname -a
lsblk
echo "/boot contents:"
ls -la /boot
touch /boot/photon-image-modifier-file-was-here
echo "${loopdev}"
touch /photon-image-modifier-file-was-here
Comment thread
mcm001 marked this conversation as resolved.
ls /

- name: Compress image
run: |
imagedir=$(dirname ${{ steps.build_image.outputs.image }})
imagedir=$(dirname ${{ steps.test_download_image.outputs.image }})
tardir=photonvision_rubikpi3_fromYAML
mkdir --parents ${tardir}
echo "Contents of imagedir: ${imagedir}"
Expand All @@ -60,11 +67,12 @@ jobs:
sudo find ${tardir} -mindepth 1 -type d -empty -delete
echo "After cleanup contents of tardir: ${tardir}"
ls -la ${tardir}
sudo tar -I 'xz -T0' -cf ./photonvision_rubikpi3_fromYAML.tar.xz ${tardir} --checkpoint=10000 --checkpoint-action=echo='%T'
sudo tar -I 'zstdmt -10' -cf ./photonvision_rubikpi3_fromYAML.tar.zst ${tardir} --checkpoint=10000 --checkpoint-action=echo='%T'

- uses: actions/upload-artifact@v6
with:
name: photonvision_rubikpi3_fromYAML.tar.xz
path: ./photonvision_rubikpi3_fromYAML.tar.xz
name: photonvision_rubikpi3_fromYAML.tar.zst
path: ./photonvision_rubikpi3_fromYAML.tar.zst
compression-level: 0
if-no-files-found: error
retention-days: 1
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/test-standard-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 'Test modifying standard images'
on:
push:
branches:
- 'main'
- 'releases/**'
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
include:
- name: RaspberryPi_1
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2025-05-13/2025-05-13-raspios-bookworm-arm64-lite.img.xz
- name: RaspberryPi_2
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2025-05-13/2025-05-13-raspios-bookworm-arm64-lite.img.xz
- name: OrangePi
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: Test ${{ matrix.name }}
steps:
- uses: actions/checkout@v6

- name: Test using downloaded (cached) image
id: test_download_image
uses: ./ # photonvision/photon-image-runner@HEAD
with:
image_url: "${{ matrix.base_image }}"
additional_mb: 200
minimum_free_mb: 500
boot_partition: ""
use_cache: "yes"
commands: |
echo "Testing $(basename ${{ matrix.base_image }}) image"
uname -a
lsblk
echo "${loopdev}"
touch /photon-image-modifier-was-here
ls /

- name: Test using image file
id: test_file_image
uses: ./ # photonvision/photon-image-runner@HEAD
with:
image_url: "file://${{ steps.test_download_image.outputs.image }}"
minimum_free_mb: 500
boot_partition: ""
use_cache: "yes"
commands: |
echo "Testing file access to ${{ steps.test_download_image.outputs.image }} image"
uname -a
lsblk
touch /photon-image-modifier-file-was-here
ls /

- name: Compress image
run: |
sudo zstdmt -10 -v -k ${{ steps.test_download_image.outputs.image }}

- uses: actions/upload-artifact@v6
with:
name: ${{ matrix.name }}.img.zst
path: ${{ steps.test_download_image.outputs.image }}.zst
compression-level: 0
if-no-files-found: error
retention-days: 1


35 changes: 21 additions & 14 deletions .github/workflows/test-tar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,45 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
- uses: ./

- name: Test using downloaded (cached) image
id: test_download_image
uses: ./ # photonvision/photon-image-runner@HEAD
with:
image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2026.0.6/photonvision_rubikpi3.tar.xz
image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2027.0.0/photonvision_rubikpi3.tar.xz
minimum_free_mb: 2000
root_location: "offset=569376768"
boot_partition: ""
shrink_image: "no"
use_cache: "yes"
commands: |
echo "Testing Rubik Pi tar image"
uname -a
lsblk
echo "${loopdev}"
echo "/boot contents:"
ls -la /boot
id: build_image
touch /photon-image-modifier-was-here
ls /

- name: Test using image file
id: test_file_image
uses: ./ # photonvision/photon-image-runner@HEAD
with:
image_url: "file://${{ steps.build_image.outputs.image }}"
image_url: "file://${{ steps.test_download_image.outputs.image }}"
root_location: "offset=569376768"
shrink_image: "no"
boot_partition: ""
shrink_image: "no"
use_cache: "yes"
commands: |
echo "Testing file access Rubik Pi tar image"
uname -a
lsblk
echo "/boot contents:"
ls -la /boot
touch /boot/photon-image-modifier-file-was-here
echo "${loopdev}"
touch /photon-image-modifier-file-was-here
ls /

- name: Compress image
run: |
imagedir=$(dirname ${{ steps.build_image.outputs.image }})
imagedir=$(dirname ${{ steps.test_download_image.outputs.image }})
echo "Imagedir: ${imagedir}"
ls -la ${imagedir}
tardir=photonvision_rubikpi3_fromTAR
Expand All @@ -54,11 +60,12 @@ jobs:
sudo mv ${imagedir}/* ${tardir}/
echo "After move"
ls -la ${tardir}
sudo tar -I 'xz -T0' -cf ./photonvision_rubikpi3_fromTAR.tar.xz ${tardir} --checkpoint=10000 --checkpoint-action=echo='%T'
sudo tar -I 'zstdmt -10' -cf ./photonvision_rubikpi3_fromTAR.tar.zst ${tardir} --checkpoint=10000 --checkpoint-action=echo='%T'

- uses: actions/upload-artifact@v6
with:
name: photonvision_rubikpi3_fromTAR.tar.xz
path: ./photonvision_rubikpi3_fromTAR.tar.xz
name: photonvision_rubikpi3_fromTAR.tar.zst
path: ./photonvision_rubikpi3_fromTAR.tar.zst
compression-level: 0
if-no-files-found: error
retention-days: 1
Expand Down
34 changes: 28 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Action to modify an os image, targeted at coprocessor images for P

inputs:
image_url:
description: 'The url for the base image. If it is a local file, provide the file path'
description: 'The url for the base image. For local files, provide the file path as a "file:\\" url'
required: true
default: ''
additional_mb:
Expand All @@ -19,7 +19,7 @@ inputs:
required: true
default: 'echo "No commands provided"'
boot_partition:
description: 'Partition number for boot, will be mounted at /boot'
description: '[DEPRECATED] Partition number for boot, will be mounted at /boot'
required: false
default: '1'
root_location:
Expand All @@ -30,18 +30,39 @@ inputs:
description: 'Make the output image file as small as possible'
required: false
default: 'yes'
use_cache:
description: 'Use the GitHub cache to store the unmodified base image'
required: false
default: 'no'

outputs:
image:
description: 'Path to modified image'
description: 'Absolute path to modified image'
value: ${{ steps.get_image.outputs.image }}

runs:
using: 'composite'
steps:
- name: Get base image
- name: Set up the image directory
shell: bash
run: |
download_path="${{ runner.temp }}/download"
mkdir --parents "${download_path}"
echo "download_path=${download_path}" >> "$GITHUB_ENV"
echo "download_path=${download_path}" >> "$GITHUB_OUTPUT"
id: make_directory

- name: Check cache
uses: actions/cache@v5
if: ${{ inputs.use_cache == 'yes' && startsWith(inputs.image_url, 'http') }}
with:
key: ${{ inputs.image_url }}
path: ${{ steps.make_directory.outputs.download_path }}
id: cache_image

- name: Prepare base image
run: |
sudo --preserve-env bash ${GITHUB_ACTION_PATH}/get_image.sh ${{ inputs.image_url }}
bash ${GITHUB_ACTION_PATH}/get_image.sh ${{ inputs.image_url }} "${{ steps.cache_image.outputs.cache-hit }}"
shell: bash
id: get_image

Expand All @@ -59,7 +80,7 @@ runs:
sudo mkdir --parents "${scriptdir}"
sudo mount --bind "${{ github.workspace }}" "${scriptdir}"

cat >> "${scriptdir}/commands.sh" << EOF
cat > "${scriptdir}/commands.sh" << EOF
#!/bin/bash
# set -exo pipefail
# export SHELLOPTS
Expand All @@ -70,6 +91,7 @@ runs:

sudo chmod +x "${scriptdir}/commands.sh"
sudo --preserve-env chroot "${{ env.rootdir }}" bash -c "${chroot_scriptdir}/commands.sh"
sudo rm "${scriptdir}/commands.sh"
shell: bash
id: run_commands

Expand Down
Loading