Compare commits
2
Commits
main
..
439b5c53a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
439b5c53a8 | ||
|
|
25dd8e1f28 |
@@ -0,0 +1,104 @@
|
||||
name: Build RPi image
|
||||
|
||||
# Yocto (kas) build of rpilinux-image for raspberrypi4-64.
|
||||
#
|
||||
# Runner requirements (see chat/notes):
|
||||
# - matches the instance runner's "ubuntu-latest" label (bare label = job
|
||||
# runs on the runner's machine, i.e. a host job). Yocto needs ~250GB
|
||||
# persistent disk, so the runner must actually be a machine (or a
|
||||
# container with a big persistent volume), not a throwaway sandbox.
|
||||
# - ~250GB free in $HOME, plus the poky host dependencies + node
|
||||
# - runner.timeout >= 8h for the first build (runner default is 3h)
|
||||
#
|
||||
# Upgrade path: register a dedicated runner with label "yocto:host" and
|
||||
# change runs-on below to "yocto".
|
||||
|
||||
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: ubuntu-latest
|
||||
timeout-minutes: 600
|
||||
steps:
|
||||
- uses: builtin:checkout
|
||||
|
||||
- name: Probe environment and host dependencies
|
||||
run: |
|
||||
echo "=== runner environment ==="
|
||||
uname -a
|
||||
[ -r /etc/os-release ] && . /etc/os-release && echo "$PRETTY_NAME"
|
||||
echo "HOME=$HOME nproc=$(nproc)"
|
||||
df -h "$HOME" | tail -1
|
||||
free -h 2>/dev/null | sed -n 2p || true
|
||||
command -v docker >/dev/null && docker info --format 'docker: {{.ServerVersion}}' 2>/dev/null || echo "no docker daemon"
|
||||
echo "=== dependency check ==="
|
||||
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