Skip to content

Build rpi64 recipe under GitHub actions #50

Build rpi64 recipe under GitHub actions

Build rpi64 recipe under GitHub actions #50

Workflow file for this run

name: Build images
on:
push:
pull_request:
workflow_dispatch:
# TODO create debos reusable action: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow
# TODO add all-green job
# TODO add dependabot for this ci file
# TODO can we fallback to no-fakemachine if running in a fork _OR_ at least add a scheduling timeout ?
#jobs:
# build:
# runs-on: ubuntu-latest
# if: github.event_name != "pull_request" || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
# TODO make this a strategy: matrix to build all images in parallel
# TODO build ospacks first
# TODO see if we can set an env variable early to check if running with KVM or not...
# env:
# DAY_OF_WEEK: ${{ blah }}
# ${{ env.DAY_OF_WEEK == 'Monday' }}
# radxa working configuration:
# build:
# runs-on: ubuntu-latest
# - name: Checkout
# uses: actions/checkout@v2
# - name: Build image
# run: |
# docker run --rm --tty --tmpfs /dev/shm:rw,nosuid,nodev,exec,size=4g --user $(id -u) --security-opt label=disable \
# --workdir $PWD --mount "type=bind,source=$PWD,destination=$PWD" --entrypoint ./scripts/build-supported-configuration.sh godebos/debos \
# -b ${{ matrix.BOARD }} -m ${{ matrix.MODEL }} -v ${{ matrix.VARIANT }}
env:
TMP: '/scratch'
jobs:
build_images:
name: Build images
timeout-minutes: 120
# Determine which machine type to run on.
#
# Nested virtualisation is not enabled on the default GitHub-hosted runners. See:
# - https://github.com/actions/runner-images/discussions/7191
# - https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
#
# Use a self-hosted runner (with access to /dev/kvm) tagged with `kvm` if
# te branch is part of the go-debos organisation. Otherwise, run on a shared
# runner without any nested virtualisation.
runs-on: ${{ github.repository_owner == 'go-debos' && 'kvm' || 'ubuntu-latest' }}
# TODO: attempt to disable fakemachine on github actions instead of running under UML ?
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Determine if machine has nested virtualisation
run:
if [ -e /dev/kvm ]; then
echo "KVM_EXISTS=true" >> $GITHUB_ENV;
else
echo "KVM_EXISTS=false" >> $GITHUB_ENV;
fi
- name: Create output directory
run: mkdir out
- name: Build rpi64 image
run:
docker run
--cgroupns=private
-v $(pwd):/recipes
-w /recipes
--tmpfs /scratch:exec
--tmpfs /run
--privileged
-e TMP=/scratch
-e SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=1
ghcr.io/go-debos/debos:main
--artifactdir=out
${{ env.KVM_EXISTS == 'false' && '--disable-fakemachine' }}
rpi64/debimage-rpi64.yaml
- name: Publish rpi64 artifacts
uses: actions/upload-artifact@v3
with:
name: rpi64
path: out/
if-no-files-found: error