pentoo-overlay/scripts/qa/test-build
Rick Farina (Zero_Chaos) 56834d9d2e
yet another way to diff
2025-12-12 18:20:31 -05:00

29 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
FAILED="0"
if [ -z "${1:-}" ]; then
printf 'Must pass github.sha as argument 1\n'
exit 1
fi
set -x
#if [ -z "$(git diff-tree --no-commit-id --name-only -r "${1}")" ]; then
if [ -z "$(git --no-pager diff --name-only $(git rev-parse --verify master) HEAD)" ]; then
printf "No changed files detected, nothing to do\n"
exit 1
# this hits because the diff-tree command finds nothing despite working on my computer
fi
#for i in $(git diff-tree --no-commit-id --name-only -r "${1}"); do
for i in $(git --no-pager diff --name-only $(git rev-parse --verify master) HEAD); do
if [ "${i%.ebuild}" != "${i}" ]; then
printf "%s looks like an ebuild, testing\n" "${i}"
if FEATURES="-ipc-sandbox -network-sandbox -pid-sandbox" emerge --getbinpkg=y --buildpkg=n --jobs="$(nproc)" --load-average="$(nproc)" --verbose "$(printf '%s' "${i%.ebuild}" | awk -F'/' '{print "="$1"/"$3}')" --pretend; then
printf '%s appears to be unmasked, build testing' "${i}"
if FEATURES="-ipc-sandbox -network-sandbox -pid-sandbox" emerge --getbinpkg=y --buildpkg=n --jobs="$(nproc)" --load-average="$(nproc)" --verbose "$(printf '%s' "${i%.ebuild}" | awk -F'/' '{print "="$1"/"$3}')"; then
printf '%s build SUCCESS\n' "${i}"
else
printf '%s build FAILED\n' "${i}"
FAILED="1"
fi
fi
fi
done
exit "${FAILED}"