CI: expand functionality of build.sh
Make it easier to "just do the nightly build" in a Docker setting by passing the name of the workflow to the script.
This commit is contained in:
parent
17b72b0fd8
commit
2c52adc8e8
@ -154,10 +154,15 @@ dependencies for the image (in this example, for openSUSE and Qt6).
|
||||
- `./ci/deps-opensuse-qt6.sh`
|
||||
|
||||
Then run CMake (add any CMake options you like at the end) and ninja.
|
||||
There is a script `ci/build.sh` that does this, too (without options).
|
||||
- `cmake -S /src -B /build -G Ninja`
|
||||
- `ninja -C /build`
|
||||
|
||||
There is a script `ci/build.sh` that does the CMake an ninja steps.
|
||||
- If you set `CMAKE_ARGS` in the environment those extra CMake options are used.
|
||||
- If you add an argument to the script command which names a workflow
|
||||
(e.g. "nightly-opensuse-qt6") then `CMAKE_ARGS` are extracted from that
|
||||
workflow and used for the build.
|
||||
|
||||
### Running in Docker
|
||||
|
||||
To run Calamares inside the container, or e.g. `loadmodule` to test
|
||||
|
30
ci/build.sh
30
ci/build.sh
@ -5,6 +5,36 @@
|
||||
# - BUILDDIR (e.g. /build)
|
||||
# - CMAKE_ARGS (e.g. "-DWITH_QT6=ON -DCMAKE_BUILD_TYPE=Debug")
|
||||
#
|
||||
# If SRCDIR is not set, it is assumed to be the directory above
|
||||
# wherever this script is being run from (this script is in ci/).
|
||||
#
|
||||
# If BUILDDIR is not set, and /build exists (e.g. in the recommended
|
||||
# Docker setup) then /build is used.
|
||||
#
|
||||
# If CMAKE_ARGS is not set, but the script is given an argument
|
||||
# that exists as a workflow (e.g. "nightly-opensuse-qt6" or
|
||||
# "nightly-debian.yml") and yq is installed, then the CMAKE_ARGS
|
||||
# are extracted from that workflow file.
|
||||
#
|
||||
# Summary, pick one:
|
||||
# - set environment variables, run "build.sh"
|
||||
# - set no variables, run "build.sh <workflow-name>"
|
||||
|
||||
if test -z "$SRCDIR" ; then
|
||||
_d=$(dirname "$0" )
|
||||
_d=$(dirname "$_d" )
|
||||
test -f "$_d/CMakeLists.txt" && SRCDIR="$_d"
|
||||
fi
|
||||
if test -z "$BUILDDIR" ; then
|
||||
test -d "/build" && BUILDDIR=/build
|
||||
fi
|
||||
if test -z "$CMAKE_ARGS" -a -n "$1" ; then
|
||||
test -x "$(which yq)" || { echo "! No yq command for finding CMAKE_ARGS for workflow $1" ; exit 1 ; }
|
||||
_d="$SRCDIR/.github/workflows/$1"
|
||||
test -f "$_d" || _d="$SRCDIR/.github/workflows/$1.yml"
|
||||
test -f "$_d" || { echo "! No workflow $1" ; exit 1 ; }
|
||||
CMAKE_ARGS=$(yq ".env.CMAKE_ARGS" "$_d")
|
||||
fi
|
||||
|
||||
# Sanity check
|
||||
test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; }
|
||||
|
Loading…
Reference in New Issue
Block a user