Add Gitea Actions build workflow for rpilinux-image
Host-based kas build on a dedicated 'yocto:host' runner with a persistent project dir ($HOME/yocto-ci) for incremental sstate reuse. Uploads deploy images from raspberrypi4-64 as artifacts.
This commit is contained in:
1 parent
a38ffd09f4
commit
25dd8e1f28
1 file changed
+91
@@ -0,0 +1,91 @@
|
|||||||
|
name: Build RPi image
|
||||||
|
|
||||||
|
# Yocto (kas) build of rpilinux-image for raspberrypi4-64.
|
||||||
|
#
|
||||||
|
# Runner requirements (see chat/notes):
|
||||||
|
# - label "yocto:host" (host job: Yocto needs ~250GB persistent disk,
|
||||||
|
# container jobs are not suitable)
|
||||||
|
# - ~250GB free in $HOME, plus the poky host dependencies + node
|
||||||
|
# - runner.timeout >= 8h for the first build (runner default is 3h)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Never run two builds at once on the same (single) runner.
|
||||||
|
concurrency:
|
||||||
|
group: yocto-rpi-build
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: yocto
|
||||||
|
timeout-minutes: 600
|
||||||
|
steps:
|
||||||
|
- uses: builtin:checkout
|
||||||
|
|
||||||
|
- name: Probe host dependencies
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
missing=""
|
||||||
|
for t in git python3 curl wget rsync gawk xz diffstat chrpath node npm; do
|
||||||
|
command -v "$t" >/dev/null 2>&1 || missing="$missing $t"
|
||||||
|
done
|
||||||
|
if [ -n "$missing" ]; then
|
||||||
|
echo "::error::Missing host tools:$missing"
|
||||||
|
echo "Install on the runner host, e.g.:"
|
||||||
|
echo ' sudo apt-get install -y --no-install-recommends build-essential \
|
||||||
|
bison chrpath curl diffstat file gawk git libpython3-dev libssl-dev \
|
||||||
|
make python3 python3-venv python3-pip python3-dev rsync swig unzip \
|
||||||
|
wget xz-utils zstd bzip2 nodejs npm'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Set up kas (persistent venv)
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
export YOCTO_HOME="$HOME/yocto-ci"
|
||||||
|
mkdir -p "$YOCTO_HOME"
|
||||||
|
[ -d "$YOCTO_HOME/venv" ] || python3 -m venv "$YOCTO_HOME/venv"
|
||||||
|
"$YOCTO_HOME/venv/bin/pip" -q install -U kas
|
||||||
|
"$YOCTO_HOME/venv/bin/kas" --version
|
||||||
|
|
||||||
|
- name: Sync to persistent project dir and build
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
export YOCTO_HOME="$HOME/yocto-ci"
|
||||||
|
# Persistent project dir: keeps extern/ (layer clones) and build/
|
||||||
|
# (sstate + tmp) between runs -> incremental builds after the first.
|
||||||
|
rsync -a --delete \
|
||||||
|
--exclude .git --exclude extern --exclude build \
|
||||||
|
./ "$YOCTO_HOME/yocto_rpi/"
|
||||||
|
cd "$YOCTO_HOME/yocto_rpi"
|
||||||
|
git config --global --add safe.directory "$YOCTO_HOME/yocto_rpi" || true
|
||||||
|
"$YOCTO_HOME/venv/bin/kas" build
|
||||||
|
|
||||||
|
- name: Collect images
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
export YOCTO_HOME="$HOME/yocto-ci"
|
||||||
|
cd "$YOCTO_HOME/yocto_rpi"
|
||||||
|
IMG_DIR="build/*/tmp/deploy/images/raspberrypi4-64"
|
||||||
|
ls -lh $IMG_DIR
|
||||||
|
mkdir -p "$GITEA_WORKSPACE/dist"
|
||||||
|
cp $IMG_DIR/* "$GITEA_WORKSPACE/dist/"
|
||||||
|
{
|
||||||
|
echo "## RPi4 image built"
|
||||||
|
echo
|
||||||
|
echo "- commit: ${GITEA_SHA}"
|
||||||
|
echo "- images also on the runner host at: \`$YOCTO_HOME/yocto_rpi/$IMG_DIR\`"
|
||||||
|
} >> "$GITEA_STEP_SUMMARY"
|
||||||
|
|
||||||
|
- name: Upload images
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: rpilinux-image-rpi4
|
||||||
|
path: dist/
|
||||||
|
retention-days: 14
|
||||||
Reference in new issue
Block a user