mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
CI/CD: Add new -p (PHASE) argument to ci_build.sh
The new PHASE argument can be build, test, or all. all is the default. This way, the CI/CD script can differentiate between the build and test phases to make it easier to track down errors when they happen.
This commit is contained in:
parent
6fd39664de
commit
4de35fd6b5
1 changed files with 67 additions and 55 deletions
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
USAGE="Usage: $0 -b [autotools|cmake] -c [crc32|crc64|sha256] -d [encoders,decoders,bcj,delta,threads] -l [destdir] -s [srcdir]"
|
USAGE="Usage: $0 -b [autotools|cmake] -c [crc32|crc64|sha256] -d [encoders|decoders|bcj|delta|threads] -l [destdir] -s [srcdir] -p [all|build|test]"
|
||||||
|
|
||||||
# Absolute path of script directory
|
# Absolute path of script directory
|
||||||
ABS_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
|
ABS_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
@ -31,9 +31,10 @@ DECODERS="y"
|
||||||
THREADS="y"
|
THREADS="y"
|
||||||
SRC_DIR="$ABS_DIR/../"
|
SRC_DIR="$ABS_DIR/../"
|
||||||
DEST_DIR="$SRC_DIR/../xz_build"
|
DEST_DIR="$SRC_DIR/../xz_build"
|
||||||
|
PHASE="all"
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
while getopts b:c:d:l:s: opt; do
|
while getopts b:c:d:l:s:p: opt; do
|
||||||
# b option can have either value "autotools" OR "cmake"
|
# b option can have either value "autotools" OR "cmake"
|
||||||
case ${opt} in
|
case ${opt} in
|
||||||
b)
|
b)
|
||||||
|
@ -74,68 +75,79 @@ while getopts b:c:d:l:s: opt; do
|
||||||
;;
|
;;
|
||||||
s) SRC_DIR="$OPTARG"
|
s) SRC_DIR="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
p) PHASE="$OPTARG"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Build based on arguments
|
if [ "$PHASE" = "all" ] || [ "$PHASE" = "build" ]; then
|
||||||
mkdir -p "$DEST_DIR"
|
# Build based on arguments
|
||||||
case $BUILD_SYSTEM in
|
mkdir -p "$DEST_DIR"
|
||||||
autotools)
|
case $BUILD_SYSTEM in
|
||||||
# Run autogen.sh script
|
autotools)
|
||||||
cd "$SRC_DIR"
|
# Run autogen.sh script
|
||||||
"./autogen.sh"
|
cd "$SRC_DIR"
|
||||||
cd "$DEST_DIR"
|
"./autogen.sh"
|
||||||
# Generate configure option values
|
cd "$DEST_DIR"
|
||||||
|
# Generate configure option values
|
||||||
|
|
||||||
EXTRA_OPTIONS=""
|
EXTRA_OPTIONS=""
|
||||||
FILTER_LIST="lzma1,lzma2"
|
FILTER_LIST="lzma1,lzma2"
|
||||||
|
|
||||||
if [ "$BCJ" = "y" ]
|
if [ "$BCJ" = "y" ]
|
||||||
then
|
then
|
||||||
FILTER_LIST="$FILTER_LIST,x86,powerpc,ia64,arm,armthumb,arm64,sparc"
|
FILTER_LIST="$FILTER_LIST,x86,powerpc,ia64,arm,armthumb,arm64,sparc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DELTA" = "y" ]
|
if [ "$DELTA" = "y" ]
|
||||||
then
|
then
|
||||||
FILTER_LIST="$FILTER_LIST,delta"
|
FILTER_LIST="$FILTER_LIST,delta"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENCODERS" = "y" ]
|
if [ "$ENCODERS" = "y" ]
|
||||||
then
|
then
|
||||||
EXTRA_OPTIONS="$EXTRA_OPTIONS --enable-encoders=$FILTER_LIST"
|
EXTRA_OPTIONS="$EXTRA_OPTIONS --enable-encoders=$FILTER_LIST"
|
||||||
else
|
else
|
||||||
EXTRA_OPTIONS="$EXTRA_OPTIONS --disable-encoders"
|
EXTRA_OPTIONS="$EXTRA_OPTIONS --disable-encoders"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DECODERS" = "y" ]
|
if [ "$DECODERS" = "y" ]
|
||||||
then
|
then
|
||||||
EXTRA_OPTIONS="$EXTRA_OPTIONS --enable-decoders=$FILTER_LIST"
|
EXTRA_OPTIONS="$EXTRA_OPTIONS --enable-decoders=$FILTER_LIST"
|
||||||
else
|
else
|
||||||
EXTRA_OPTIONS="$EXTRA_OPTIONS --disable-decoders"
|
EXTRA_OPTIONS="$EXTRA_OPTIONS --disable-decoders"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$THREADS" = "n" ]
|
if [ "$THREADS" = "n" ]
|
||||||
then
|
then
|
||||||
EXTRA_OPTIONS="$EXTRA_OPTIONS --disable-threads"
|
EXTRA_OPTIONS="$EXTRA_OPTIONS --disable-threads"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run configure script
|
# Run configure script
|
||||||
"$SRC_DIR"/configure --enable-checks=$CHECK_TYPE $EXTRA_OPTIONS
|
"$SRC_DIR"/configure --enable-checks=$CHECK_TYPE $EXTRA_OPTIONS
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
make
|
make
|
||||||
|
;;
|
||||||
|
cmake)
|
||||||
|
# CMake currently does not support disabling encoders, decoders,
|
||||||
|
# threading, or check types. For now, just run the full build.
|
||||||
|
cd "$DEST_DIR"
|
||||||
|
cmake "$SRC_DIR/CMakeLists.txt" -B "$DEST_DIR"
|
||||||
|
make
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
# Run the tests
|
if [ "$PHASE" = "all" ] || [ "$PHASE" = "test" ]; then
|
||||||
make check
|
case $BUILD_SYSTEM in
|
||||||
;;
|
autotools)
|
||||||
|
cd "$DEST_DIR"
|
||||||
cmake)
|
make check
|
||||||
# CMake currently does not support disabling encoders, decoders,
|
;;
|
||||||
# threading, or check types. For now, just run the full build.
|
cmake)
|
||||||
cd "$DEST_DIR"
|
cd "$DEST_DIR"
|
||||||
cmake "$SRC_DIR/CMakeLists.txt" -B "$DEST_DIR"
|
make "test"
|
||||||
make
|
;;
|
||||||
make test
|
esac
|
||||||
;;
|
fi
|
||||||
|
|
||||||
esac
|
|
Loading…
Reference in a new issue