Changeset View
Changeset View
Standalone View
Standalone View
contrib/teamcity/build-configurations.py
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | def __init__(self, configuration, project_root): | ||||
# Create the build directory as needed | # Create the build directory as needed | ||||
self.build_directory = Path( | self.build_directory = Path( | ||||
self.project_root.joinpath( | self.project_root.joinpath( | ||||
'abc-ci-builds', | 'abc-ci-builds', | ||||
self.configuration.name)) | self.configuration.name)) | ||||
self.build_directory.mkdir(exist_ok=True, parents=True) | self.build_directory.mkdir(exist_ok=True, parents=True) | ||||
self.artifact_dir = self.build_directory.joinpath("artifacts") | self.artifact_dir = self.build_directory.joinpath("artifacts") | ||||
self.junit_reports_dir = self.build_directory.joinpath("test/junit") | |||||
# We will provide the required environment variables | # We will provide the required environment variables | ||||
self.environment_variables = { | self.environment_variables = { | ||||
"BUILD_DIR": str(self.build_directory), | "BUILD_DIR": str(self.build_directory), | ||||
"CMAKE_PLATFORMS_DIR": self.project_root.joinpath("cmake", "platforms"), | "CMAKE_PLATFORMS_DIR": self.project_root.joinpath("cmake", "platforms"), | ||||
"THREADS": str(os.cpu_count() or 1), | "THREADS": str(os.cpu_count() or 1), | ||||
"TOPLEVEL": str(self.project_root), | "TOPLEVEL": str(self.project_root), | ||||
} | } | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | async def wait_for_build(self, timeout, args=[]): | ||||
finally: | finally: | ||||
self.print_line_to_logs(message) | self.print_line_to_logs(message) | ||||
# Always add the build logs to the root of the artifacts | # Always add the build logs to the root of the artifacts | ||||
artifacts = { | artifacts = { | ||||
**self.configuration.get("artifacts", {}), | **self.configuration.get("artifacts", {}), | ||||
str(self.logs["full_log"].relative_to(self.build_directory)): "", | str(self.logs["full_log"].relative_to(self.build_directory)): "", | ||||
str(self.logs["clean_log"].relative_to(self.build_directory)): "", | str(self.logs["clean_log"].relative_to(self.build_directory)): "", | ||||
str(self.junit_reports_dir.relative_to(self.build_directory)): "", | |||||
} | } | ||||
self.copy_artifacts(artifacts) | self.copy_artifacts(artifacts) | ||||
return (return_code, message) | return (return_code, message) | ||||
def run(self, args=[]): | def run(self, args=[]): | ||||
return_code, message = asyncio.run( | return_code, message = asyncio.run( | ||||
Show All 16 Lines | def __init__(self, configuration, project_root): | ||||
# TODO abstract out the volume mapping | # TODO abstract out the volume mapping | ||||
self.artifact_dir = Path("/results/artifacts") | self.artifact_dir = Path("/results/artifacts") | ||||
self.teamcity_messages = TeamcityServiceMessages() | self.teamcity_messages = TeamcityServiceMessages() | ||||
def copy_artifacts(self, artifacts): | def copy_artifacts(self, artifacts): | ||||
super().copy_artifacts(artifacts) | super().copy_artifacts(artifacts) | ||||
# Start loading the junit reports. | |||||
junit_reports_pattern = "{}/junit/*.xml".format( | |||||
str(self.artifact_dir.relative_to("/")) | |||||
) | |||||
self.teamcity_messages.importData("junit", junit_reports_pattern) | |||||
# Instruct teamcity to upload our artifact directory | # Instruct teamcity to upload our artifact directory | ||||
artifact_path_pattern = "+:{}=>artifacts.tar.gz".format( | artifact_path_pattern = "+:{}=>artifacts.tar.gz".format( | ||||
str(self.artifact_dir.relative_to("/")) | str(self.artifact_dir.relative_to("/")) | ||||
) | ) | ||||
self.teamcity_messages.publishArtifacts(artifact_path_pattern) | self.teamcity_messages.publishArtifacts(artifact_path_pattern) | ||||
def run(self, args=[]): | def run(self, args=[]): | ||||
# Let the user know what build is being run. | # Let the user know what build is being run. | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |