diff --git a/ci/scripts/build-docs.sh b/ci/scripts/build-docs.sh index d8e68b2723..534f27ab50 100755 --- a/ci/scripts/build-docs.sh +++ b/ci/scripts/build-docs.sh @@ -1,7 +1,6 @@ #! /bin/bash builddir="$1" - if [[ -z "$builddir" ]]; then echo "Usage: build-docs.sh " exit 1 @@ -9,14 +8,11 @@ fi set -eux -export PATH="/usr/local/cargo/bin/:/usr/local/bin/:$PATH" -export RUSTUP_HOME="/usr/local/rustup" -export CARGO_HOME="/usr/local/cargo" +source "ci/scripts/source_image_env.sh" -./ci/scripts/handle-subprojects-cache.py --cache-dir /subprojects subprojects/ - -echo "$MESON_ARGS" -meson setup "$builddir" $MESON_ARGS +meson_args="${MESON_ARGS:--Ddoc=enabled -Drs=enabled -Dgst-docs:fatal_warnings=true}" +echo "$meson_args" +meson setup "$builddir" $meson_args ccache --show-stats ninja -C "$builddir" update_girs diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh index 7697bba9e3..93c068733b 100755 --- a/ci/scripts/build.sh +++ b/ci/scripts/build.sh @@ -2,6 +2,10 @@ builddir="$1" +error="${GST_WERROR:-false}" +gtk_args="${GTK_ARGS:-}" +meson_args="${MESON_ARGS:-}" + if [[ -z "$builddir" ]]; then echo "Usage: build.sh " exit 1 @@ -9,6 +13,8 @@ fi set -eux +source "ci/scripts/source_image_env.sh" + # Expects: # BUILD_TYPE: Proxy of meson's --default-library arg # must be 'shared' or 'static' or 'both' @@ -18,25 +24,18 @@ set -eux # must be a string of a boolean, "true" or "false". Not yaml bool. # SUBPROJECTS_CACHE_DIR: The location in the image of the subprojects cache -export RUSTUP_HOME="/usr/local/rustup" -export CARGO_HOME="/usr/local/cargo" -export PATH="/usr/local/cargo/bin:$PATH" - -# Allow unbound variable -GTK_ARGS="${GTK_ARGS:-}" - # nproc works on linux # sysctl for macos _jobs=$(nproc || sysctl -n hw.ncpu) jobs="${FDO_CI_CONCURRENT:-$_jobs}" date -R -ci/scripts/handle-subprojects-cache.py --cache-dir "${SUBPROJECTS_CACHE_DIR}" subprojects/ -ARGS="${BUILD_TYPE:---default-library=both} ${BUILD_GST_DEBUG:--Dgstreamer:gst_debug=true} ${MESON_ARGS} ${GTK_ARGS}" -echo "Werror: $GST_WERROR" +ARGS="${BUILD_TYPE:---default-library=both} ${BUILD_GST_DEBUG:--Dgstreamer:gst_debug=true} $meson_args $gtk_args" +echo "Werror: $error" -if [ "$GST_WERROR" = "true" ]; then +# If the variable is not true, we are either running locally or explicitly false. Thus false by default. +if [ "$error" = "true" ]; then ARGS="$ARGS --native-file ./ci/meson/gst-werror.ini" fi diff --git a/ci/scripts/install-rust.sh b/ci/scripts/install-rust.sh index 0fa72b728a..9f244c8340 100644 --- a/ci/scripts/install-rust.sh +++ b/ci/scripts/install-rust.sh @@ -24,6 +24,7 @@ cargo install --locked cargo-c --version 0.10.5+cargo-0.83.0 rustup --version cargo --version rustc --version +cargo cinstall --version # Cleanup the registry after install # so we don't have to save 200mb of the index in the ci image diff --git a/ci/scripts/source_image_env.sh b/ci/scripts/source_image_env.sh new file mode 100644 index 0000000000..97094836af --- /dev/null +++ b/ci/scripts/source_image_env.sh @@ -0,0 +1,25 @@ +#! /bin/bash + +image_cache="${SUBPROJECTS_CACHE_DIR:-}" + +# On the CI image we install the rust toolcahin under this path +# If it exists set the HOME and PATH variables and print the versions +# of what we have installed +cargo_binary="/usr/local/cargo/bin/cargo"; +if [[ -e "$cargo_binary" ]]; then + export RUSTUP_HOME="/usr/local/rustup" + export CARGO_HOME="/usr/local/cargo" + export PATH="/usr/local/cargo/bin:$PATH" + + rustup --version + rustc --version + cargo --version + cargo cinstall --version +fi + +# Only copy the cache over if the variable is set, which usually only happens on CI. +if [ -n "$image_cache" ]; then + date -R + ci/scripts/handle-subprojects-cache.py --cache-dir "$image_cache" subprojects/ + date -R +fi