diff --git a/contrib/teamcity/build-configurations.py b/contrib/teamcity/build-configurations.py --- a/contrib/teamcity/build-configurations.py +++ b/contrib/teamcity/build-configurations.py @@ -34,6 +34,7 @@ self.build_directory = None self.junit_reports_dir = None self.test_logs_dir = None + self.jobs = (os.cpu_count() or 0) + 1 self.project_root = PurePath( subprocess.run( @@ -115,7 +116,7 @@ self.environment_variables = { "BUILD_DIR": str(self.build_directory), "CMAKE_PLATFORMS_DIR": self.project_root.joinpath("cmake", "platforms"), - "THREADS": str(os.cpu_count() or 1), + "THREADS": str(self.jobs), "TOPLEVEL": str(self.project_root), } @@ -178,10 +179,15 @@ "-DCMAKE_CXX_FLAGS=-Werror", ]) - # Some generator flags - generator_flags = [] - if self.config.get("fail_fast", False): - generator_flags.append("-k0") + # Get the generator, default to ninja + generator = self.config.get("generator", {}) + generator_name = generator.get("name", "Ninja") + generator_command = generator.get("command", "ninja") + generator_flags = generator.get("flags", ["-k0"]) + + # Max out the jobs by default when the generator uses make + if generator_command == "make": + generator_flags.append("-j{}".format(self.jobs)) # Handle cross build configuration cross_build = self.config.get("cross_build", None) @@ -222,16 +228,14 @@ self.build_steps.append( { "bin": "cmake", - # TODO: let the generator be configurable - "args": ["-G", "Ninja", str(self.project_root)] + self.cmake_flags, + "args": ["-G", generator_name, str(self.project_root)] + self.cmake_flags, } ) for target_group in targets: self.build_steps.append( { - # TODO: let the generator be configurable - "bin": "ninja", + "bin": generator_command, "args": generator_flags + target_group, } ) diff --git a/contrib/teamcity/build-configurations.yml b/contrib/teamcity/build-configurations.yml --- a/contrib/teamcity/build-configurations.yml +++ b/contrib/teamcity/build-configurations.yml @@ -214,9 +214,13 @@ QEMU_LD_PREFIX: /usr/arm-linux-gnueabihf build-make-generator: - script: builds/build-make-generator.sh + generator: + name: 'Unix Makefiles' + command: make + flags: + - '-k' templates: - - common_unix_artifacts + - check+secp256k1 timeout: 1200 build-master: diff --git a/contrib/teamcity/builds/build-make-generator.sh b/contrib/teamcity/builds/build-make-generator.sh deleted file mode 100755 --- a/contrib/teamcity/builds/build-make-generator.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C.UTF-8 - -set -euxo pipefail - -# shellcheck source=../ci-fixture.sh -source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" - -# Ensure that the build using cmake and the "Unix Makefiles" generator is not -# broken. -git clean -xffd -cmake -G "Unix Makefiles" "${TOPLEVEL}" -make -j "${THREADS}" all check