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