From cb89358d749548ce590c871671be6ae9b0ea6542 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 2 Sep 2024 23:25:54 +0530 Subject: [PATCH] ci: Don't build the gtk subproject unless the changes are relevant Part-of: --- .gitlab-ci.yml | 23 ++++++++++++++++------- ci/scripts/build.sh | 5 ++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c63bce87fe..abdd477e80 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -320,6 +320,16 @@ commitlint: - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH' when: manual +# Check whether the gtk wrap had any changes, and if so, build it +.gtk-build-rules: + rules: + - changes: + - .gitlab-ci.yml + - meson.build + - subprojects/*.wrap + variables: + GTK_ARGS: "-Dgtk=enabled" + .build: stage: 'build' needs: @@ -465,8 +475,8 @@ build debian x86_64: -Dgst-plugins-good:cairo=enabled -Dgst-plugins-good:soup=enabled -Dgst-plugins-bad:d3d11-wgc=enabled - -Dgtk=enabled rules: + - !reference [.gtk-build-rules, rules] - !reference [.upstream-branch-rules, rules] - changes: *modules_changes @@ -484,7 +494,7 @@ build debian x86_64: - $env:PYTHONUNBUFFERED = '1' - ci/scripts/handle-subprojects-cache.py --cache-dir /subprojects subprojects/ - $env:PYTHONUNBUFFERED = '' - - echo $env:MESON_ARGS + - echo $env:MESON_ARGS $env:GTK_ARGS # We do not pick up any deps with cmake, so speed up dependency checks - $env:CMAKE = 'false' artifacts: @@ -497,7 +507,7 @@ build vs2022 amd64: extends: '.build windows' script: - !reference [".build windows", "script"] - - meson setup --vsenv build $env:MESON_ARGS + - meson setup --vsenv build $env:MESON_ARGS $env:GTK_ARGS - meson compile -C build --jobs $env:FDO_CI_CONCURRENT - .\gst-env.py gst-inspect-1.0.exe --version - .\gst-env.py gst-inspect-1.0.exe @@ -512,7 +522,6 @@ build vs2022 amd64 full-static: extends: ".build windows" script: - !reference [".build windows", "script"] - - echo $env:MESON_ARGS - cmd.exe /C "meson setup --vsenv build --default-library=static $env:MESON_ARGS" - meson compile -C build --jobs $env:FDO_CI_CONCURRENT - .\gst-env.py gst-inspect-1.0.exe --version @@ -532,7 +541,7 @@ build vs2022 amd64 full-static: # Setting up a cross build with MSVC is still non-trivial because # the --vsenv argument cannot be used to set it up - echo $env:MESON_CROSS_ARGS - - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH && meson setup build $env:MESON_ARGS $env:MESON_CROSS_ARGS" + - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH && meson setup build $env:MESON_ARGS $env:GTK_ARGS $env:MESON_CROSS_ARGS" - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH && meson compile -C build --jobs $env:FDO_CI_CONCURRENT" build vs2022 x86: @@ -576,7 +585,7 @@ build msys2: - $env:MESON_ARGS = $env:MESON_ARGS.replace('-Dgst-plugins-bad:d3d11-wgc=enabled','') + ' -Dpython=disabled -Dintrospection=disabled' # Configure MSYS2 to use the UCRT64 environment, start in the same directory # and inherit PATH - - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "meson setup build $env:MESON_ARGS && meson compile -C build --jobs $env:FDO_CI_CONCURRENT" + - C:\msys64\msys2_shell.cmd -ucrt64 -defterm -no-start -here -use-full-path -lc "meson setup build $env:MESON_ARGS $env:GTK_ARGS && meson compile -C build --jobs $env:FDO_CI_CONCURRENT" build macos: extends: @@ -588,6 +597,7 @@ build macos: MESON_ARGS: "${DEFAULT_MESON_ARGS}" SUBPROJECTS_CACHE_DIR: "/Users/gst-ci/subprojects" rules: + - !reference [.gtk-build-rules, rules] - !reference [.upstream-branch-rules, rules] - changes: *modules_changes @@ -609,7 +619,6 @@ build macos: -Dgst-plugins-base:pango=enabled -Dgst-plugins-good:cairo=enabled -Dgst-plugins-good:soup=enabled - -Dgtk=enabled # ---- Tests ----- # diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh index a943aebc23..7697bba9e3 100755 --- a/ci/scripts/build.sh +++ b/ci/scripts/build.sh @@ -22,6 +22,9 @@ 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) @@ -30,7 +33,7 @@ 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}" +ARGS="${BUILD_TYPE:---default-library=both} ${BUILD_GST_DEBUG:--Dgstreamer:gst_debug=true} ${MESON_ARGS} ${GTK_ARGS}" echo "Werror: $GST_WERROR" if [ "$GST_WERROR" = "true" ]; then