🔨 Update build/CI scripts
This commit is contained in:
parent
bc91b1cdcd
commit
c801cc4830
|
@ -2,6 +2,19 @@
|
|||
#
|
||||
# build_all_examples base_branch [resume_point]
|
||||
#
|
||||
# build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo
|
||||
# [-c|--continue] - Continue the paused build
|
||||
# [-d|--debug] - Print extra debug output
|
||||
# [-i|--ini] - Archive ini/json/yml files in the temp config folder
|
||||
# [-l|--limit=#] - Limit the number of builds in this run
|
||||
# [-n|--nobuild] - Don't actually build anything.
|
||||
# [-r|--resume=<path>] - Start at some config in the filesystem order
|
||||
# [-s|--skip] - Do the thing
|
||||
#
|
||||
# build_all_examples [...] branch [resume-from]
|
||||
#
|
||||
|
||||
. mfutil
|
||||
|
||||
GITREPO=https://github.com/MarlinFirmware/Configurations.git
|
||||
STAT_FILE=./.pio/.buildall
|
||||
|
@ -13,8 +26,34 @@ which git 1>/dev/null 2>&1 || { echo "git not found! Please install it."; exit ;
|
|||
SED=$(command -v gsed 2>/dev/null || command -v sed 2>/dev/null)
|
||||
[[ -z "$SED" ]] && { echo "No sed found, please install sed" ; exit 1 ; }
|
||||
|
||||
SELF=`basename "$0"`
|
||||
HERE=`dirname "$0"`
|
||||
while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
|
||||
case "${OFLAG}" in
|
||||
b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;;
|
||||
r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;;
|
||||
c) CONTINUE=1 ; bugout "Continue" ;;
|
||||
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
|
||||
i) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
|
||||
h) EXIT_USAGE=1 ; break ;;
|
||||
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
|
||||
d|v) DEBUG=1 ; bugout "Debug ON" ;;
|
||||
n) DRYRUN=1 ; bugout "Dry Run" ;;
|
||||
-) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
|
||||
case "$ONAM" in
|
||||
branch) BRANCH=$OVAL ; bugout "Branch: $BRANCH" ;;
|
||||
resume) FIRST_CONF="$OVAL" ; bugout "Resume: $FIRST_CONF" ;;
|
||||
continue) CONTINUE=1 ; bugout "Continue" ;;
|
||||
skip) CONTSKIP=2 ; bugout "Continue, skipping" ;;
|
||||
limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;;
|
||||
ini) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
|
||||
help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
|
||||
debug) DEBUG=1 ; bugout "Debug ON" ;;
|
||||
nobuild) DRYRUN=1 ; bugout "Dry Run" ;;
|
||||
*) EXIT_USAGE=2 ; echo "$SELF: unrecognized option \`--$ONAM'" ; break ;;
|
||||
esac
|
||||
;;
|
||||
*) EXIT_USAGE=2 ; break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if called in the right location
|
||||
[[ -e "Marlin/src" ]] || { echo -e "This script must be called from a Marlin working copy with:\n ./buildroot/bin/$SELF $1" ; exit ; }
|
||||
|
@ -92,10 +131,37 @@ for CONF in $CONF_TREE ; do
|
|||
[[ $SKIP_CONF ]] && { unset SKIP_CONF ; continue ; }
|
||||
# ...if skipping, don't build this one
|
||||
compgen -G "${CONF}Con*.h" > /dev/null || continue
|
||||
echo "${BRANCH}*${DIR}" >"$STAT_FILE"
|
||||
"$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
|
||||
|
||||
# Build or print build command for --nobuild
|
||||
if [[ $DRYRUN ]]; then
|
||||
echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m"
|
||||
else
|
||||
# Remember where we are in case of failure
|
||||
echo "${BRANCH}*${DIR}" >"$STAT_FILE"
|
||||
# Build folder is unknown so delete all report files
|
||||
if [[ $COPY_INI ]]; then
|
||||
IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"'
|
||||
$IFIND -exec rm "{}" \;
|
||||
fi
|
||||
((DEBUG)) && echo "\"$HERE/build_example\" internal \"$TMP\" \"$DIR\""
|
||||
"$HERE/build_example" internal "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
|
||||
# Build folder is unknown so copy all report files
|
||||
[[ $COPY_INI ]] && $IFIND -exec cp "{}" "$CONF" \;
|
||||
fi
|
||||
|
||||
((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; }
|
||||
|
||||
done
|
||||
|
||||
# Delete the temp folder and build state
|
||||
[[ -e "$TMP/config/examples" ]] && rm -rf "$TMP"
|
||||
rm "$STAT_FILE"
|
||||
# Delete the build state if not paused early
|
||||
[[ $PAUSE ]] || rm "$STAT_FILE"
|
||||
|
||||
# Delete the temp folder if not preserving generated INI files
|
||||
if [[ -e "$TMP/config/examples" ]]; then
|
||||
if [[ $COPY_INI ]]; then
|
||||
OPEN=$( which gnome-open xdg-open open | head -n1 )
|
||||
$OPEN "$TMP"
|
||||
elif [[ ! $PAUSE ]]; then
|
||||
rm -rf "$TMP"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
git checkout Marlin/Configuration*.h 2>/dev/null
|
||||
git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
|
||||
rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h marlin_config.json .pio/build/mc.zip
|
||||
|
||||
if [[ $1 == '-d' || $1 == '--default' ]]; then
|
||||
use_example_configs
|
||||
else
|
||||
git checkout Marlin/Configuration.h 2>/dev/null
|
||||
git checkout Marlin/Configuration_adv.h 2>/dev/null
|
||||
git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
|
||||
fi
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# use_example_configs [repo:]configpath
|
||||
#
|
||||
# Examples:
|
||||
# use_example_configs
|
||||
# use_example_configs Creality/CR-10/CrealityV1
|
||||
# use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue