From 91dc2ae658b211284c1a6c06c7e356ab3fc2f8e0 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven Date: Tue, 12 Jul 2022 17:02:00 +0000 Subject: [PATCH] Pull request #11: Optimize build time with parrallel node Merge in WMN_TOOLS/matter from optimize_ci_build_time to silabs Squashed commit of the following: commit 7ec0d686f99aac591c24a7a1492cd9238979a758 Author: jepenven-silabs Date: Tue Jul 12 10:06:57 2022 -0400 Optimize build time with parrallel node --- Jenkinsfile | 87 ++++++++++++++++++- .../build_openthread_csa_examples.py | 14 ++- 2 files changed, 97 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 244d93ebe31896..c6f216f91258be 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -125,6 +125,87 @@ def buildOpenThreadExamples() } } +def buildOpenThreadLight() +{ + actionWithRetry { + node(buildFarmLabel) + { + def workspaceTmpDir = createWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + buildOverlayDir) + def dirPath = workspaceTmpDir + createWorkspaceOverlay.overlayMatterPath + def saveDir = 'matter/' + dir(dirPath) { + withDockerContainer(image: "connectedhomeip/chip-build-efr32:0.5.64", args: "-u root") + { + // CSA Examples build + withEnv(['PW_ENVIRONMENT_ROOT='+dirPath]) + { + sh 'python3 ./silabs_ci_scripts/build_openthread_csa_examples.py lighting-app' + } + } + } + deactivateWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + workspaceTmpDir, + 'matter/', + '-name "*.s37" -o -name "*.map"') + } + } +} + +def buildOpenThreadLock() +{ + actionWithRetry { + node(buildFarmLabel) + { + def workspaceTmpDir = createWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + buildOverlayDir) + def dirPath = workspaceTmpDir + createWorkspaceOverlay.overlayMatterPath + def saveDir = 'matter/' + dir(dirPath) { + withDockerContainer(image: "connectedhomeip/chip-build-efr32:0.5.64", args: "-u root") + { + // CSA Examples build + withEnv(['PW_ENVIRONMENT_ROOT='+dirPath]) + { + sh 'python3 ./silabs_ci_scripts/build_openthread_csa_examples.py lock-app' + } + } + } + deactivateWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + workspaceTmpDir, + 'matter/', + '-name "*.s37" -o -name "*.map"') + } + } +} + +def buildOpenThreadSwitch() +{ + actionWithRetry { + node(buildFarmLabel) + { + def workspaceTmpDir = createWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + buildOverlayDir) + def dirPath = workspaceTmpDir + createWorkspaceOverlay.overlayMatterPath + def saveDir = 'matter/' + dir(dirPath) { + withDockerContainer(image: "connectedhomeip/chip-build-efr32:0.5.64", args: "-u root") + { + // CSA Examples build + withEnv(['PW_ENVIRONMENT_ROOT='+dirPath]) + { + sh 'python3 ./silabs_ci_scripts/build_openthread_csa_examples.py light-switch-app' + } + } + } + deactivateWorkspaceOverlay(advanceStageMarker.getBuildStagesList(), + workspaceTmpDir, + 'matter/', + '-name "*.s37" -o -name "*.map"') + } + } +} + def buildSilabsCustomOpenThreadExamples() { actionWithRetry { @@ -268,7 +349,11 @@ def pipeline() def parallelNodes = [:] // Docker container solution - parallelNodes['Build OpenThread Examples'] = { this.buildOpenThreadExamples() } + parallelNodes['Build OpenThread Lighting'] = { this.buildOpenThreadLight() } + parallelNodes['Build OpenThread Lock'] = { this.buildOpenThreadLock() } + parallelNodes['Build OpenThread Light switch'] = { this.buildOpenThreadSwitch() } + + parallelNodes['Build Wifi Examples'] = { this.buildWiFiExamples() } // TODO Fix ME // parallelNodes['Build Custom Examples'] = { this.buildSilabsCustomOpenThreadExamples() } diff --git a/silabs_ci_scripts/build_openthread_csa_examples.py b/silabs_ci_scripts/build_openthread_csa_examples.py index 031f66b49fa947..325f0b8d8f9ff9 100644 --- a/silabs_ci_scripts/build_openthread_csa_examples.py +++ b/silabs_ci_scripts/build_openthread_csa_examples.py @@ -4,19 +4,27 @@ import json from pathlib import Path + +if (len(sys.argv) > 1): + APPS = sys.argv + # Remove path to the scripts + APPS.pop(0) +else: + APPS = {"lighting-app", "lock-app", "light-switch-app"} + #Defines -APPS = {"lighting-app", "lock-app", "light-switch-app"} BOARDS = {"BRD4161A", "BRD4186A"} BUILDS = {"OpenThread"} BUILD_TYPES = {("standard", ""), ("release", "\"chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false is_debug=false show_qr_code=false chip_build_libshell=false enable_openthread_cli=false chip_openthread_ftd=true\"")} building_command = './scripts/examples/gn_efr32_example.sh ./examples/{app}/efr32 ./out/CSA/{app}{network} {board} {buildArguments}' #Build everything -for build in BUILDS: - for app_name in APPS: +for app_name in APPS: + for build in BUILDS: for board in BOARDS: for build_type in BUILD_TYPES: #Build all examples c = building_command.format(app=app_name, network= "/" + build + "/" + build_type[0], board=board, buildArguments=build_type[1]) val = subprocess.check_call(c, shell= True) +