This change however involves adding a couple of new environment variables as well as tuning the helper script to support local container executions properly. The overall motivation here is to move all script logic from .gitlab-ci.yml to the build.sh script so that the steps are consistent and identical when executing in local containers and GitLab. By adding the new env variables and increasing the granularity in meson commands executed in the script it gives us better options on how to port the existing code from .gitlab-ci.yml to a standalone Bash script. Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx> --- ci/Makefile | 11 +++++++---- ci/build.sh | 3 ++- ci/helper | 21 ++++++++++++++------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ci/Makefile b/ci/Makefile index 8f1be4318d..217eda3cc0 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -162,7 +162,9 @@ CI_ENGINE_ARGS = \ --workdir "$(CI_USER_HOME)" \ --env CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)" \ --env MESON_ARGS="$(MESON_ARGS)" \ - --env NINJA_ARGS="$(NINJA_ARGS)" \ + --env MESON_BUILD_ARGS="$(MESON_BUILD_ARGS)" \ + --env MESON_RUN_TEST=$(MESON_RUN_TEST) \ + --env MESON_TEST_ARGS="$(MESON_TEST_ARGS)" \ $(CI_PODMAN_ARGS) \ $(CI_PWDB_MOUNTS) \ $(CI_HOME_MOUNTS) \ @@ -209,7 +211,7 @@ ci-build@%: $(MAKE) -C $(CI_ROOTDIR) ci-run-command@$* CI_COMMAND="$(CI_USER_HOME)/build" ci-test@%: - $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_NINJA_ARGS=test + $(MAKE) -C $(CI_ROOTDIR) ci-build@$* ci-help: @echo @@ -240,6 +242,7 @@ ci-help: @echo " CI_USER_LOGIN= - which user should run in the container (default is $$USER)" @echo " CI_IMAGE_PREFIX= - override to prefer a locally built image, (default is $(CI_IMAGE_PREFIX))" @echo " CI_IMAGE_TAG=:latest - optionally use in conjunction with 'CI_IMAGE_PREFIX'" - @echo " CI_MESON_ARGS= - extra arguments passed to meson" - @echo " CI_NINJA_ARGS= - extra arguments passed to ninja" + @echo " MESON_ARGS= - extra configure arguments passed to meson setup" + @echo " MESON_BUILD_ARGS= - extra build arguments passed to meson compile" + @echo " MESON_TEST_ARGS= - extra arguments passed to meson test" @echo diff --git a/ci/build.sh b/ci/build.sh index 9489c4ab2f..2a83f756d5 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -11,4 +11,5 @@ export VIR_TEST_DEBUG=1 meson setup build --werror -Dsystem=true $MESON_OPTS $MESON_ARGS || \ (cat build/meson-logs/meson-log.txt && exit 1) -ninja -C build $NINJA_ARGS +meson compile -C build $MESON_BUILD_ARGS +meson test -C build $MESON_TEST_ARGS diff --git a/ci/helper b/ci/helper index fb562d55e1..7b8f2e6826 100755 --- a/ci/helper +++ b/ci/helper @@ -48,15 +48,21 @@ class Parser: # project's build system mesonparser = argparse.ArgumentParser(add_help=False) mesonparser.add_argument( - "--meson-args", + "--meson-configure-args", default="", - help="additional arguments passed to meson " - "(eg --meson-args='-Dopt1=enabled -Dopt2=disabled')", + help="additional arguments passed to meson setup" + "(eg --meson-configure-args='-Dopt1=enabled -Dopt2=disabled')", ) mesonparser.add_argument( - "--ninja-args", + "--meson-build-args", default="", - help="additional arguments passed to ninja", + help="additional arguments passed to meson compile" + "(eg --meson-build-args='--clean --jobs N <build target>')", + ) + mesonparser.add_argument( + "--meson-test-args", + default="", + help="additional arguments passed to meson test", ) # Options that are common to actions communicating with a GitLab @@ -152,8 +158,9 @@ class Application: if self._args.action in ["build", "test"]: args.extend([ - f"MESON_ARGS={self._args.meson_args}", - f"NINJA_ARGS={self._args.ninja_args}", + f"MESON_ARGS={self._args.meson_configure_args}", + f"MESON_BUILD_ARGS={self._args.meson_build_args}", + f"MESON_TEST_ARGS={self._args.meson_test_args}", ]) if pty.spawn(["make"] + args) != 0: -- 2.39.1