From 5b17007be05ad12bd0fc814cd6a8a71903bce64c Mon Sep 17 00:00:00 2001 From: Kevin Granade Date: Tue, 14 May 2024 18:32:34 -0700 Subject: [PATCH] Serialize game and test build to ease pressure on RAM, especially in CI --- Makefile | 30 ++++++++++++++++++++++++------ build-scripts/gha_compile_only.sh | 2 +- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0dd15eb9fb472..22f3ce12efa77 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,8 @@ # make RUNTESTS=1 # Build source files in order of how often the matching header is included # make HEADERPOPULARITY=1 +# Serializing the game and test sub-builds avoids putting pressure on memory +# make SERIALIZE_TEST_BUILD=1 # comment these to toggle them as one sees fit. # DEBUG is best turned on if you plan to debug in gdb -- please do! @@ -220,12 +222,22 @@ endif # Can't run tests if we aren't going to build them ifeq ($(TESTS), 1) - ifeq ($(RUNTESTS), 1) - # Build and run the tests - TESTSTARGET = check + ifeq ($(SERIALIZE_TEST_BUILD), 1) + ifeq ($(RUNTESTS), 1) + # Build and run the tests, sequentially with the game + TESTSTARGET = check-no-parallel + else + # Only build the tests, sequentially with the game + TESTSTARGET = tests-no-parallel + endif else - # Only build the tests - TESTSTARGET = tests + ifeq ($(RUNTESTS), 1) + # Build and run the tests + TESTSTARGET = check + else + # Only build the tests + TESTSTARGET = tests + endif endif endif @@ -1392,12 +1404,18 @@ $(JSON_FORMATTER_BIN): $(JSON_FORMATTER_SOURCES) python-check: flake8 -tests: version $(BUILD_PREFIX)cataclysm.a $(LOCALIZE_TEST_DEPS) +tests: version $(BUILD_PREFIX)cataclysm.a $(LOCALIZE_TEST_DEPS) | $(TARGET) + $(MAKE) -C tests + +tests-no-parallel: version $(BUILD_PREFIX)cataclysm.a $(LOCALIZE_TEST_DEPS) | $(TARGET) $(MAKE) -C tests check: version $(BUILD_PREFIX)cataclysm.a $(LOCALIZE_TEST_DEPS) $(MAKE) -C tests check +check-no-parallel: version $(BUILD_PREFIX)cataclysm.a $(LOCALIZE_TEST_DEPS) + $(MAKE) -C tests check + clean-tests: $(MAKE) -C tests clean diff --git a/build-scripts/gha_compile_only.sh b/build-scripts/gha_compile_only.sh index 4fdc72246503e..eaece6b49fba1 100755 --- a/build-scripts/gha_compile_only.sh +++ b/build-scripts/gha_compile_only.sh @@ -64,7 +64,7 @@ then .. make -j$num_jobs else - make -j "$num_jobs" CCACHE=1 CROSS="$CROSS_COMPILATION" LINTJSON=0 FRAMEWORK=1 UNIVERSAL_BINARY=1 DEBUG_SYMBOLS=1 + make -j "$num_jobs" CCACHE=1 CROSS="$CROSS_COMPILATION" LINTJSON=0 FRAMEWORK=1 UNIVERSAL_BINARY=1 DEBUG_SYMBOLS=1 SERIALIZE_TEST_BUILD=1 # For CI on macOS, patch the test binary so it can find SDL2 libraries. if [[ ! -z "$OS" && "$OS" = "macos-12" ]]