Ci/gitea actions #1
+28
-11
@@ -37,7 +37,7 @@ jobs:
|
||||
echo "=== runner environment ==="
|
||||
uname -a
|
||||
[ -r /etc/os-release ] && . /etc/os-release && echo "$PRETTY_NAME"
|
||||
echo "HOME=$HOME workspace=$GITEA_WORKSPACE nproc=$(nproc)"
|
||||
echo "HOME=$HOME workspace=$(pwd) 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"
|
||||
@@ -91,6 +91,7 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export YOCTO_HOME="${YOCTO_HOME:-$HOME/yocto-build}"
|
||||
WS="$(pwd)" # workspace; upload-artifact's path is relative to it
|
||||
cd "$YOCTO_HOME/yocto_rpi"
|
||||
IMG_DIR="$(find build -type d -path '*/tmp/deploy/images/raspberrypi4-64' | head -1)"
|
||||
if [ -z "$IMG_DIR" ]; then
|
||||
@@ -98,16 +99,32 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
echo "images in: $IMG_DIR"
|
||||
ls -lh "$IMG_DIR"
|
||||
mkdir -p "$GITEA_WORKSPACE/dist"
|
||||
# only the image artefacts, not the million symlinks/cache dirs
|
||||
find "$IMG_DIR" -maxdepth 1 -type f \( -name '*.wic*' -o -name '*.ext4*' -o -name '*.rootfs*' -o -name '*.tar.bz2' -o -name '*.dtb' -o -name 'Image*' -o -name 'modules*' \) -exec cp -av {} "$GITEA_WORKSPACE/dist/" \;
|
||||
{
|
||||
echo "## RPi4 image built"
|
||||
echo
|
||||
echo "- commit: ${GITEA_SHA}"
|
||||
echo "- build tree on runner host: \`$YOCTO_HOME/yocto_rpi/$IMG_DIR\`"
|
||||
} >> "$GITEA_STEP_SUMMARY"
|
||||
mkdir -p "$WS/dist"
|
||||
shopt -s nullglob
|
||||
# only the timestamped canonical names - the short "...rootfs.wic.bz2"
|
||||
# entries are hardlinks to the same inode (would double the upload)
|
||||
FILES=("$IMG_DIR"/rpilinux-image-*.rootfs-[0-9]*.wic.bz2 "$IMG_DIR"/rpilinux-image-*.rootfs-[0-9]*.wic.bmap)
|
||||
if [ ${#FILES[@]} -eq 0 ]; then
|
||||
echo "::error::no flashable .wic image found in $IMG_DIR"
|
||||
exit 1
|
||||
fi
|
||||
cp -v "${FILES[@]}" "$WS/dist/"
|
||||
( cd "$WS/dist" && sha256sum * > SHA256SUMS )
|
||||
ls -lh "$WS/dist"
|
||||
SUMMARY="${GITEA_STEP_SUMMARY:-${GITHUB_STEP_SUMMARY:-}}"
|
||||
if [ -n "$SUMMARY" ]; then
|
||||
{
|
||||
echo "## RPi4 image built"
|
||||
echo
|
||||
echo "| file | sha256 |"
|
||||
echo "|---|---|"
|
||||
( cd "$WS/dist" && while read -r sum f; do echo "| \`$f\` | \`${sum:0:16}\` |"; done < SHA256SUMS )
|
||||
echo
|
||||
echo "Flash: \`bzcat <file> | sudo dd of=/dev/sdX bs=4M status=progress\`"
|
||||
echo
|
||||
echo "Build tree (incremental) on runner host: \`$YOCTO_HOME/yocto_rpi\`"
|
||||
} >> "$SUMMARY"
|
||||
fi
|
||||
|
||||
- name: Upload images
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
Reference in new issue
Block a user