The workflow was mostly inline bash. Moves the logic into reusable composite actions under .gitea/actions/, keeps host paths in the YOCTO_HOME repo variable, adds a workflow_dispatch skip-build option and publishes step outputs (build dir, image list, kas path).
38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
name: check-build-host
|
|
description: >-
|
|
Report the build host and fail fast when executables, CPU or disk that the
|
|
build needs are missing - a mistake should cost seconds, not hours.
|
|
inputs:
|
|
tools:
|
|
description: Space separated executables that must be on PATH
|
|
required: false
|
|
default: git python3
|
|
min-disk-gb:
|
|
description: Warn when the build filesystem has less than this much free
|
|
required: false
|
|
default: "100"
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Host report
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
echo "os : $(. /etc/os-release && echo "$PRETTY_NAME") ($(uname -m), $(uname -r))"
|
|
echo "user : $(id -un) home=$HOME"
|
|
echo "cpu : $(nproc) cores / $(awk '/MemTotal/{printf "%.0fG", $2/1048576}' /proc/meminfo) ram"
|
|
df -h . | tail -1 | sed 's/^/disk : /'
|
|
missing=""
|
|
for tool in ${{ inputs.tools }}; do
|
|
command -v "$tool" >/dev/null 2>&1 || missing="$missing $tool"
|
|
done
|
|
if [ -n "$missing" ]; then
|
|
echo "::error::Host is missing:$missing"
|
|
echo "Install them on the runner host, e.g. sudo apt-get install -y $missing"
|
|
exit 1
|
|
fi
|
|
free_gb="$(df --output=avail -BG . | tail -1 | tr -d ' ')"
|
|
if [ "$free_gb" -lt "${{ inputs.min-disk-gb }}" ]; then
|
|
echo "::warning::only ${free_gb}G free on $(df --output=target . | tail -1); expected >= ${{ inputs.min-disk-gb }}G"
|
|
fi
|