From 9b9d01144230c1b18e5917e45cd43f1deaf72c45 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:13:24 +0100 Subject: [PATCH 01/54] Minimal Fix for #5711 - Linux CI: cache /mnt dirs directly instead of through symlinks actions/cache archived the ~/.ccache and ~/.conan2 symlinks rather than their /mnt contents, leaving ~200 B entries that blocked any later save. Point CCACHE_DIR/CONAN_HOME and the cache paths at /mnt directly. (Would need deleting the caches manually right now, I didn't change the key) --- .github/workflows/full-build.yml | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index de5163ac55..55fb61434f 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -151,6 +151,9 @@ jobs: shell: bash env: MAX_BUILD_THREADS: ${{ matrix.max_jobs }} + # Keep caches on /mnt (root partition is too small), and point both the tools and actions/cache at the real dirs: caching a symlink only archives the link (#5711) + CCACHE_DIR: /mnt/.ccache + CONAN_HOME: /mnt/.conan2 permissions: # Needed permission to upload the release asset @@ -189,7 +192,7 @@ jobs: - name: Restore ccache cache uses: actions/cache@v6 with: - path: ~/.ccache + path: ${{ env.CCACHE_DIR }} key: ccache-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} restore-keys: | ccache-${{ matrix.os }}-${{ matrix.platform }}- @@ -197,7 +200,7 @@ jobs: - name: Restore Conan cache uses: actions/cache@v6 with: - path: ~/.conan2 + path: ${{ env.CONAN_HOME }} key: conan-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} restore-keys: | conan-${{ matrix.os }}-${{ matrix.platform }}- @@ -210,22 +213,7 @@ jobs: git config --global --add safe.directory '*' fi - # Use /mnt for build and caches to avoid running out of space on root partition - prepare_dir() { - local target=$1 - local dest=$2 - mkdir -p "$dest" - if [ -d "$target" ] && [ ! -L "$target" ]; then - echo "Moving existing $target to $dest" - cp -a "$target/." "$dest/" - rm -rf "$target" - fi - mkdir -p "$(dirname "$target")" - ln -sfn "$dest" "$target" - } - - prepare_dir "$HOME/.ccache" "/mnt/.ccache" - prepare_dir "$HOME/.conan2" "/mnt/.conan2" + mkdir -p "$CCACHE_DIR" "$CONAN_HOME" if command -v ccache >/dev/null 2>&1; then ccache -M ${{ env.CCACHE_MAXSIZE }} || true echo "Configured ccache:"; ccache -s | sed -n '1,10p' @@ -268,7 +256,7 @@ jobs: conan remote add conancenter https://center2.conan.io conan remote remove nrel-v2 || true conan remote add nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2 - if [ ! -f "$HOME/.conan2/profiles/default" ]; then + if [ ! -f "$CONAN_HOME/profiles/default" ]; then conan profile detect fi From 8298a2e53992d36730e977178082d94a1d57f43b Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:28:30 +0100 Subject: [PATCH 02/54] Linux CI: key ccache on commit SHA / PR branch and save even on failure The conan.lock-keyed ccache got an exact hit on every run after the first, so it was never refreshed. Key it on the commit SHA for pushes and on the head ref for PRs (falling back to the current base branch tip), and save it in a separate step under always( --- .github/workflows/full-build.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 55fb61434f..1bf4c7c68e 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -189,13 +189,22 @@ jobs: with: fetch-depth: 1 + - name: Get base branch SHA + if: github.event_name == 'pull_request' + run: | + # github.event.pull_request.base.sha is the base at PR creation, not the current tip + BASE_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/${{ github.base_ref }}" | cut -f1) + echo "BASE_SHA=$BASE_SHA" >> "$GITHUB_ENV" + - name: Restore ccache cache - uses: actions/cache@v6 + id: ccache-restore + uses: actions/cache/restore@v6 with: path: ${{ env.CCACHE_DIR }} - key: ccache-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} + key: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} restore-keys: | - ccache-${{ matrix.os }}-${{ matrix.platform }}- + ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ env.BASE_SHA }} + ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- - name: Restore Conan cache uses: actions/cache@v6 @@ -340,6 +349,13 @@ jobs: command -v ninja >/dev/null 2>&1 && ninja -d stats || true exit $BUILD_EXIT + - name: Save ccache cache + if: always() && steps.ccache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} + - name: Run CTest suite id: ctest continue-on-error: true From 4ab0164967a787f8a4087005624f4dc57b6424bc Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:31:07 +0100 Subject: [PATCH 03/54] Linux CI: save Conan cache right after install instead of at job end actions/cache only saves in its post step when the job succeeds, so a conan.lock change followed by any build/test failure lost the rebuilt dependencies. Save it explicitly after conan install (on a key miss only), after cleaning build/source/download/temp folders to keep it small --- .github/workflows/full-build.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 1bf4c7c68e..bd29ecefaa 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -207,7 +207,8 @@ jobs: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- - name: Restore Conan cache - uses: actions/cache@v6 + id: conan-restore + uses: actions/cache/restore@v6 with: path: ${{ env.CONAN_HOME }} key: conan-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} @@ -299,6 +300,18 @@ jobs: -s build_type=${{ env.BUILD_TYPE }} \ ${CONAN_EXTRA_ARGS:-} + - name: Clean Conan cache before saving + if: steps.conan-restore.outputs.cache-hit != 'true' + run: conan cache clean "*" --source --build --download --temp + + - name: Save Conan cache + # Saved right after install (only when the lockfile changed) so a later build failure doesn't lose it + if: steps.conan-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ${{ env.CONAN_HOME }} + key: ${{ steps.conan-restore.outputs.cache-primary-key }} + - name: Locate Ruby run: | ruby_path=$(command -v ruby) From 718c287e1f1f418552c15661ceb6d831e993ecd3 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:37:21 +0100 Subject: [PATCH 04/54] Disable Clang PCH timestamp so ccache can hit PCH-using TUs Clang embeds a timestamp in the .pch, so its content differs every build and every TU including it is a ccache miss (macOS CI: 98/2484 hits, i.e. only the non-PCH TUs) --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b7f80cbae..9080375823 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -415,6 +415,14 @@ endif() option(ENABLE_PCH "Enable Precompiled Headers" ON) mark_as_advanced(ENABLE_PCH) +if(ENABLE_PCH AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Without this, Clang embeds a timestamp in the generated .pch, so its content hash differs + # on every build even when sources/headers are unchanged. ccache hashes that .pch content for + # both the direct-mode manifest and the preprocessor-mode result key, so every TU using + # -include-pch becomes a guaranteed cache miss. See ccache manual, "Precompiled Headers". + add_compile_options("$<$:SHELL:-Xclang -fno-pch-timestamp>") +endif() + option(USE_LTO "Use Link-Time-Optimization" OFF) if (USE_LTO) From 8ff55fe538b6397233d24389ef9c7f4b02983379 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:41:02 +0100 Subject: [PATCH 05/54] Windows CI: replace sccache with ccache sccache refuses to cache MSVC compiles that use precompiled headers (/Fp, /Yc), which is ~95% of them (2370/2484 non-cacheable on develop). ccache handles them. Use the same SHA / head_ref keying and separate always() save as on Linux. Also set CCACHE_COMPILERCHECK=content: the default mtime check is unreliable across fresh runner VMs. --- .github/workflows/full-build.yml | 46 ++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index bd29ecefaa..21ef4e17a6 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -85,9 +85,8 @@ env: CCACHE_MAXSIZE: "10G" CCACHE_DEPEND: "true" CCACHE_NOHASHDIR: "true" - SCCACHE_GHA_ENABLED: "false" - SCCACHE_DIR: "${{ github.workspace }}\\.sccache" - SCCACHE_CACHE_SIZE: "10G" + # mtime-based compiler check is unreliable across fresh runner VMs, where the compiler binary's mtime can differ even though its content doesn't + CCACHE_COMPILERCHECK: content ENABLE_PCH: ON jobs: @@ -1253,6 +1252,7 @@ jobs: shell: pwsh env: MAX_BUILD_THREADS: ${{ matrix.max_jobs }} + CCACHE_DIR: ${{ github.workspace }}\.ccache RUBYOPT: "-Eutf-8:utf-8" PYTHONUTF8: "1" permissions: @@ -1281,21 +1281,32 @@ jobs: if ($LASTEXITCODE) { exit 1 } ./.github/signing-client/Test-AssertAuthenticodeSigned.ps1 - - name: Restore sccache cache - uses: actions/cache@v6 + - name: Get base branch SHA + if: github.event_name == 'pull_request' + shell: bash + run: | + # github.event.pull_request.base.sha is the base at PR creation, not the current tip + BASE_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/${{ github.base_ref }}" | cut -f1) + echo "BASE_SHA=$BASE_SHA" >> "$GITHUB_ENV" + + - name: Restore ccache cache + id: ccache-restore + uses: actions/cache/restore@v6 with: - path: ${{ github.workspace }}\.sccache - key: sccache-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} + path: ${{ env.CCACHE_DIR }} + key: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} restore-keys: | - sccache-${{ matrix.os }}-${{ matrix.platform }}- + ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ env.BASE_SHA }} + ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- - name: Prepare workspace run: | git config --global --add safe.directory "*" New-Item -ItemType Directory -Path "${{ env.OPENSTUDIO_BUILD }}" -Force - - name: Setup sccache - uses: Mozilla-Actions/sccache-action@v0.0.5 + - name: Install ccache + # Not sccache: it refuses to cache MSVC compiles using PCH (/Yc, /Fp), i.e. ~95% of them + run: choco install ccache -y --no-progress - name: Restore Conan cache uses: actions/cache@v6 @@ -1382,14 +1393,14 @@ jobs: - name: Configure with CMake working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | - $sccacheExe = (Get-Command sccache).Source - & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=`"$sccacheExe`" -DCMAKE_CXX_COMPILER_LAUNCHER=`"$sccacheExe`" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console `"../${{ env.OPENSTUDIO_SOURCE }}"`" + $ccacheExe = (Get-Command ccache).Source + & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_CXX_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console `"../${{ env.OPENSTUDIO_SOURCE }}"`" - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} shell: pwsh run: | - if (Get-Command sccache -ErrorAction SilentlyContinue) { sccache -s } + if (Get-Command ccache -ErrorAction SilentlyContinue) { ccache -s } # Use $env:ComSpec to ensure we call the Windows Command Prompt, not the MSYS2 cmd found in PATH & $env:ComSpec /c "call conanbuild.bat && cmake --build . --parallel ${{ matrix.max_jobs }} -- -d stats 2>&1" | Tee-Object -FilePath "build.log" @@ -1398,7 +1409,14 @@ jobs: Write-Error "Build failed with exit code $LASTEXITCODE" exit $LASTEXITCODE } - if (Get-Command sccache -ErrorAction SilentlyContinue) { sccache -s } + if (Get-Command ccache -ErrorAction SilentlyContinue) { ccache -s } + + - name: Save ccache cache + if: always() && steps.ccache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} - name: Wait for network stability if: always() From ff2ab9c7c739be9af054b837ce3347c3945d1676 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:48:44 +0100 Subject: [PATCH 06/54] macOS/Windows CI: check out at workspace root like Linux The OpenStudio/ subfolder checkout made every hashFiles() in cache keys resolve to an empty string, so conan / external-deps / embedded-files keys never changed and those caches were frozen forever. Drop OPENSTUDIO_SOURCE and use the same layout as Linux. --- .github/workflows/full-build.yml | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 21ef4e17a6..0177caa189 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -72,7 +72,6 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_TYPE: Release OPENSTUDIO_BUILD: build - OPENSTUDIO_SOURCE: OpenStudio PYTHON_REQUIRED_VERSION: "3.12.2" SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk AWS_S3_BUCKET: openstudio-ci-builds @@ -691,7 +690,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v7 with: - path: ${{ env.OPENSTUDIO_SOURCE }} fetch-depth: 1 - name: Verify space @@ -709,13 +707,12 @@ jobs: echo - name: Git safe directory - working-directory: ${{ env.OPENSTUDIO_SOURCE }} run: git config --global --add safe.directory '*' - name: Setup ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: ccache-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} + key: ccache-${{ matrix.os }}-${{ matrix.platform }} max-size: ${{ env.CCACHE_MAXSIZE }} - name: Restore Conan cache @@ -740,7 +737,6 @@ jobs: # check-latest: true # Force pick up the python I built instead of the (potential) toolcache one. I could also do `rm -Rf $RUNNER_TOOL_CACHE/Python/3.12.2` before this action - name: Install Python dependencies - working-directory: ${{ env.OPENSTUDIO_SOURCE }} run: | python -m pip install --upgrade pip pip install setuptools wheel @@ -811,12 +807,11 @@ jobs: conan config home - name: Conan install - working-directory: ${{ env.OPENSTUDIO_SOURCE }} env: CONAN_BUILD_POLICY: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} run: | conan install . \ - --output-folder=../${{ env.OPENSTUDIO_BUILD }} \ + --output-folder=${{ env.OPENSTUDIO_BUILD }} \ --build="$CONAN_BUILD_POLICY" \ -c tools.cmake.cmaketoolchain:generator=Ninja \ -s compiler.cppstd=20 \ @@ -869,7 +864,7 @@ jobs: -DPython_ROOT_DIR:PATH="$(dirname $(dirname $SYSTEM_PYTHON_PATH))" \ -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \ -DCMAKE_JOB_POOL_LINK:STRING=console \ - ../${{ env.OPENSTUDIO_SOURCE }} + .. - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -1047,7 +1042,7 @@ jobs: # Loop through all generated DMGs find . -maxdepth 1 -name "*.dmg" -print0 | while IFS= read -r -d '' dmg_file; do - ../${{ env.OPENSTUDIO_SOURCE }}/developer/scripts/patch_adhoc_dmg.sh "$dmg_file" + ../developer/scripts/patch_adhoc_dmg.sh "$dmg_file" done - name: Sign DMG and Notarize @@ -1262,7 +1257,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v7 with: - path: ${{ env.OPENSTUDIO_SOURCE }} fetch-depth: 1 - name: Verify space @@ -1271,11 +1265,9 @@ jobs: Get-CimInstance Win32_OperatingSystem | Select-Object TotalVisibleMemorySize,FreePhysicalMemory,TotalVirtualMemorySize,FreeVirtualMemory - name: Git safe directory - working-directory: ${{ env.OPENSTUDIO_SOURCE }} run: git config --global --add safe.directory '*' - name: Test signing scripts - working-directory: ${{ env.OPENSTUDIO_SOURCE }} run: | ./.github/signing-client/Test-SigningWithRetry.ps1 if ($LASTEXITCODE) { exit 1 } @@ -1323,13 +1315,11 @@ jobs: cache: 'pip' - name: Install Python dependencies - working-directory: ${{ env.OPENSTUDIO_SOURCE }} run: | python -m pip install --upgrade pip setuptools wheel python -m pip install -r python/requirements.txt - name: Install Conan - working-directory: ${{ env.OPENSTUDIO_SOURCE }} run: | python -m pip install conan @@ -1367,12 +1357,11 @@ jobs: conan config home - name: Conan install - working-directory: ${{ env.OPENSTUDIO_SOURCE }} env: CONAN_BUILD_POLICY: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} run: | conan install . ` - --output-folder="../${{ env.OPENSTUDIO_BUILD }}" ` + --output-folder="${{ env.OPENSTUDIO_BUILD }}" ` --build="$env:CONAN_BUILD_POLICY" ` -c tools.cmake.cmaketoolchain:generator=Ninja ` -s compiler.cppstd=20 ` @@ -1394,7 +1383,7 @@ jobs: working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | $ccacheExe = (Get-Command ccache).Source - & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_CXX_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console `"../${{ env.OPENSTUDIO_SOURCE }}"`" + & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_CXX_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console .." - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -1567,7 +1556,7 @@ jobs: working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | # This step only runs on refs that publish, so a missing client or secret must fail rather than ship unsigned - $signingDir = "../${{ env.OPENSTUDIO_SOURCE }}/.github/signing-client" + $signingDir = "../.github/signing-client" if (-not (Test-Path "$signingDir/code-signing.js")) { Write-Host "::error::Code signing client not found at .github/signing-client/code-signing.js" exit 1 @@ -1632,7 +1621,7 @@ jobs: working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | # The binaries step already failed if the client or secret is missing - $signingDir = "../${{ env.OPENSTUDIO_SOURCE }}/.github/signing-client" + $signingDir = "../.github/signing-client" Write-Host "------------------------------------------------------------" Write-Host "Signing Final Installer" From d4ba4011e5a155a9d6ae3670a17c0ba0b331c637 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:53:12 +0100 Subject: [PATCH 07/54] macOS/Windows: save conan cache right after install instead of at job end Same as on Linux: actions/cache only saves when the job succeeds, so a conan.lock change followed by any build/test failure lost the rebuilt dependencies. macOS CI: replace hendrikmuhs/ccache-action with the same restore/save as Linux/Windows Same SHA / head_ref keying with base branch tip fallback and always() save, instead of a timestamped key saved on every run (including every PR push). --- .github/workflows/full-build.yml | 60 ++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 0177caa189..31aa75e9a0 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -681,6 +681,7 @@ jobs: max_jobs: 3 env: MAX_BUILD_THREADS: ${{ matrix.max_jobs }} + CCACHE_DIR: ${{ github.workspace }}/.ccache permissions: # Needed permission to upload the release asset @@ -709,14 +710,26 @@ jobs: - name: Git safe directory run: git config --global --add safe.directory '*' - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 + - name: Get base branch SHA + if: github.event_name == 'pull_request' + run: | + # github.event.pull_request.base.sha is the base at PR creation, not the current tip + BASE_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/${{ github.base_ref }}" | cut -f1) + echo "BASE_SHA=$BASE_SHA" >> "$GITHUB_ENV" + + - name: Restore ccache cache + id: ccache-restore + uses: actions/cache/restore@v6 with: - key: ccache-${{ matrix.os }}-${{ matrix.platform }} - max-size: ${{ env.CCACHE_MAXSIZE }} + path: ${{ env.CCACHE_DIR }} + key: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + restore-keys: | + ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ env.BASE_SHA }} + ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- - name: Restore Conan cache - uses: actions/cache@v6 + id: conan-restore + uses: actions/cache/restore@v6 with: path: ~/.conan2 key: conan-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} @@ -767,7 +780,7 @@ jobs: # The MACOSX_DEPLOYMENT_TARGET environment variable sets the default value for the CMAKE_OSX_DEPLOYMENT_TARGET variable. # We use cmake commands to build some subprojects, so setting it globally echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_dev_target }} >> $GITHUB_ENV - brew install ninja + brew install ninja ccache - name: Create Build Directory run: cmake -E make_directory ${{ env.OPENSTUDIO_BUILD }} @@ -819,6 +832,18 @@ jobs: -s os.version=${{ matrix.macos_dev_target }} \ -o readline/*:with_library=termcap + - name: Clean Conan cache before saving + if: steps.conan-restore.outputs.cache-hit != 'true' + run: conan cache clean "*" --source --build --download --temp + + - name: Save Conan cache + # Saved right after install (only when the lockfile changed) so a later build failure doesn't lose it + if: steps.conan-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ~/.conan2 + key: ${{ steps.conan-restore.outputs.cache-primary-key }} + - name: Locate Ruby run: | ruby_path=$(command -v ruby) @@ -883,9 +908,17 @@ jobs: build_exit=${PIPESTATUS[0]} kill $heartbeat_pid || true command -v ninja >/dev/null 2>&1 && ninja -d stats || true + command -v ccache >/dev/null 2>&1 && ccache -s || true if [ -f build.log ]; then tail -n 40 build.log; fi exit $build_exit + - name: Save ccache cache + if: always() && steps.ccache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} + - name: Wait for network stability if: always() run: sleep 5 @@ -1301,7 +1334,8 @@ jobs: run: choco install ccache -y --no-progress - name: Restore Conan cache - uses: actions/cache@v6 + id: conan-restore + uses: actions/cache/restore@v6 with: path: ~/.conan2 key: conan-${{ matrix.os }}-windows-${{ hashFiles('conan.lock') }} @@ -1369,6 +1403,18 @@ jobs: --lockfile-partial --lockfile-out=conan.lock git diff conan.lock + - name: Clean Conan cache before saving + if: steps.conan-restore.outputs.cache-hit != 'true' + run: conan cache clean "*" --source --build --download --temp + + - name: Save Conan cache + # Saved right after install (only when the lockfile changed) so a later build failure doesn't lose it + if: steps.conan-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ~/.conan2 + key: ${{ steps.conan-restore.outputs.cache-primary-key }} + - name: Locate Ruby run: | $rubyPath = (Get-Command ruby).Source From 7045cb76e594097f45eb319923244eabb90c20ab Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 15:54:59 +0100 Subject: [PATCH 08/54] macOS CI: stop installing BasicTeX Nothing uses LaTeX: BUILD_DOCUMENTATION is OFF and the docs only need Doxygen anyway. --- .github/workflows/full-build.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 31aa75e9a0..1b47946111 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -854,11 +854,6 @@ jobs: python_path=$(command -v python3) echo "SYSTEM_PYTHON_PATH=$python_path" >> $GITHUB_ENV - - name: Install Documentation Dependencies (Mac) - run: | - brew install --cask basictex - echo "/Library/TeX/texbin" >> $GITHUB_PATH - - name: Configure with CMake working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | From a09e40fb60589c2e5fd5a016579d1babf34e18fa Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:00:18 +0100 Subject: [PATCH 09/54] Linux CI: drop the Install CA Certificates step It imported Kitware's apt key without adding the repo and nothing installs from apt afterwards. ca-certificates is already installed in both openstudio-cmake-tools images (Dockerfile and Dockerfile_centos9). --- .github/workflows/full-build.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 1b47946111..49e1041f1a 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -268,14 +268,6 @@ jobs: conan profile detect fi - - name: Install CA Certificates - if: startsWith(matrix.platform, 'ubuntu') - run: | - apt-get update || true - apt-get install -y ca-certificates gnupg wget - wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null - apt-get update - - name: Add libc setting to Conan (CentOS) # nrel-v2's gcc 14 binaries are built on ubuntu-24.04 with GLIBC 2.39 (AlmaLinux 9 has 2.34). Making the libc version part of the # package_id means they never match, so we build from source (or pull the glibc 2.34 ones once uploaded to nrel-v2). From 818aeb112aeeae293c8ba047eeb62b47f25e138c Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:00:49 +0100 Subject: [PATCH 10/54] macOS/Windows CI: drop unused aqtinstall and bundler-cache aqtinstall is never called (Qt IFW is downloaded as a zip), and there is no Gemfile for bundler-cache to cache --- .github/workflows/full-build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 49e1041f1a..a6847d9582 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -746,13 +746,12 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel pip install -r python/requirements.txt - pip install conan aqtinstall + pip install conan - name: Install Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3.2.2' - bundler-cache: true - name: Set up Qt IFW run: | @@ -1348,7 +1347,6 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: '3.2.2' - bundler-cache: true - name: Setup QtIFW 4.x uses: jmarrec/setup-qtifw@v1 From 3e4fc933ebe4dd4dba5a91f0ba572c5f73d5366f Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:07:56 +0100 Subject: [PATCH 11/54] Linux CI: drop the /mnt volume GitHub-hosted Linux runners now have a single disk (actions/runner-images#13587), so /mnt is the same filesystem as / and no longer buys any space. Keep caches in $HOME (/github/home) and the swapfile in RUNNER_TEMP (bind-mounted; swapon doesn't work on the container overlayfs). --- .github/workflows/full-build.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index a6847d9582..1ac3ddd529 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -95,7 +95,7 @@ jobs: runs-on: ${{ matrix.os }} container: image: ${{ matrix.container_image }} - options: ${{ matrix.container_options }} --volume /mnt:/mnt + options: ${{ matrix.container_options }} strategy: fail-fast: false matrix: @@ -149,9 +149,9 @@ jobs: shell: bash env: MAX_BUILD_THREADS: ${{ matrix.max_jobs }} - # Keep caches on /mnt (root partition is too small), and point both the tools and actions/cache at the real dirs: caching a symlink only archives the link (#5711) - CCACHE_DIR: /mnt/.ccache - CONAN_HOME: /mnt/.conan2 + # $HOME in GHA containers. Explicit so the tools and actions/cache agree on the paths (#5711) + CCACHE_DIR: /github/home/.ccache + CONAN_HOME: /github/home/.conan2 permissions: # Needed permission to upload the release asset @@ -162,10 +162,12 @@ jobs: run: | echo "Enabling Swap..." # Create and enable 8GB swap file to prevent OOM kills - dd if=/dev/zero of=/mnt/swapfile_extra bs=1M count=8192 status=progress - chmod 600 /mnt/swapfile_extra - mkswap /mnt/swapfile_extra - swapon /mnt/swapfile_extra + # RUNNER_TEMP is bind-mounted from the host disk: swapon doesn't work on the container's overlayfs + SWAPFILE="$RUNNER_TEMP/swapfile_extra" + dd if=/dev/zero of="$SWAPFILE" bs=1M count=8192 status=progress + chmod 600 "$SWAPFILE" + mkswap "$SWAPFILE" + swapon "$SWAPFILE" echo echo "Memory and swap:" From 19c4b86687714d2cc817b1b30021c31053cff8db Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:24:52 +0100 Subject: [PATCH 12/54] CI: remove redundant ccache launcher flags, ccache -M, duplicate safe.directory and tool-existence guards CMakeLists.txt already picks up ccache as compiler launcher, CCACHE_MAXSIZE already sets the max size, and Windows set safe.directory twice. ccache, git and ninja are always installed, so the command -v / Get-Command guards only hid failures (e.g. silently building without ccache). --- .github/workflows/full-build.yml | 39 +++++++------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 1ac3ddd529..686a2fefd7 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -218,16 +218,10 @@ jobs: - name: Prepare workspace run: | - # Git safe directory - if command -v git >/dev/null 2>&1; then - git config --global --add safe.directory '*' - fi + git config --global --add safe.directory '*' mkdir -p "$CCACHE_DIR" "$CONAN_HOME" - if command -v ccache >/dev/null 2>&1; then - ccache -M ${{ env.CCACHE_MAXSIZE }} || true - echo "Configured ccache:"; ccache -s | sed -n '1,10p' - fi + echo "Configured ccache:"; ccache -s | sed -n '1,10p' - name: Fix CMake Path (CentOS) if: matrix.platform == 'centos-9-x64' @@ -316,14 +310,7 @@ jobs: - name: Configure with CMake run: | - # Use absolute path for ccache to avoid resolution issues in containers with symlinked build dirs - CCACHE_ARGS=() - if command -v ccache >/dev/null 2>&1; then - CCACHE_EXE=$(command -v ccache) - CCACHE_ARGS=("-DCMAKE_C_COMPILER_LAUNCHER=$CCACHE_EXE" "-DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_EXE") - fi cmake --preset conan-release \ - "${CCACHE_ARGS[@]}" \ -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} \ -DBUILD_TESTING:BOOL=ON \ -DCPACK_GENERATOR:STRING="${{ matrix.cpack_generators }}" \ @@ -351,7 +338,7 @@ jobs: cmake --build . --parallel ${{ matrix.max_jobs }} 2>&1 | tee build.log BUILD_EXIT=${PIPESTATUS[0]} kill $HB_PID || true - command -v ninja >/dev/null 2>&1 && ninja -d stats || true + ninja -d stats || true exit $BUILD_EXIT - name: Save ccache cache @@ -853,16 +840,8 @@ jobs: set -e chmod +x ./conanbuild.sh . ./conanbuild.sh - # Use absolute path for ccache to avoid resolution issues in containers with symlinked build dirs - CCACHE_ARGS=() - if command -v ccache >/dev/null 2>&1; then - CCACHE_EXE=$(command -v ccache) - CCACHE_ARGS=("-DCMAKE_C_COMPILER_LAUNCHER=$CCACHE_EXE" "-DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_EXE") - fi - # Signing identity is passed to cpack only when the keychain exists (see Create packages) cmake -G Ninja \ - "${CCACHE_ARGS[@]}" \ -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \ -DCMAKE_CXX_FLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -Wno-enum-constexpr-conversion" \ -DENABLE_COVERAGE:BOOL=OFF \ @@ -895,8 +874,8 @@ jobs: cmake --build . --parallel ${MAX_BUILD_THREADS} 2>&1 | tee build.log build_exit=${PIPESTATUS[0]} kill $heartbeat_pid || true - command -v ninja >/dev/null 2>&1 && ninja -d stats || true - command -v ccache >/dev/null 2>&1 && ccache -s || true + ninja -d stats || true + ccache -s if [ -f build.log ]; then tail -n 40 build.log; fi exit $build_exit @@ -1314,7 +1293,6 @@ jobs: - name: Prepare workspace run: | - git config --global --add safe.directory "*" New-Item -ItemType Directory -Path "${{ env.OPENSTUDIO_BUILD }}" -Force - name: Install ccache @@ -1415,14 +1393,13 @@ jobs: - name: Configure with CMake working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | - $ccacheExe = (Get-Command ccache).Source - & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_CXX_COMPILER_LAUNCHER=`"$ccacheExe`" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console .." + & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console .." - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} shell: pwsh run: | - if (Get-Command ccache -ErrorAction SilentlyContinue) { ccache -s } + ccache -s # Use $env:ComSpec to ensure we call the Windows Command Prompt, not the MSYS2 cmd found in PATH & $env:ComSpec /c "call conanbuild.bat && cmake --build . --parallel ${{ matrix.max_jobs }} -- -d stats 2>&1" | Tee-Object -FilePath "build.log" @@ -1431,7 +1408,7 @@ jobs: Write-Error "Build failed with exit code $LASTEXITCODE" exit $LASTEXITCODE } - if (Get-Command ccache -ErrorAction SilentlyContinue) { ccache -s } + ccache -s - name: Save ccache cache if: always() && steps.ccache-restore.outputs.cache-hit != 'true' From eb763e4f7b22a10dd6ee650e57e0f2c8746f2fb9 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:33:05 +0100 Subject: [PATCH 13/54] CI: drop external-deps and embedded-files caches Downloads are negligible on a 2h build, and the external-deps key (conan.lock) never tracked the E+/Radiance versions anyway. Restoring generated embedded files into a fresh build dir is either redundant or risks stale outputs. Frees ~2.3 GB of cache quota for ccache. embedded-files-* keys use matrix.os only. CentOS and Ubuntu x64 both run on ubuntu-24.04, so they share the same key, e.g. external-deps-ubuntu-24.04-23f4... --- .github/workflows/full-build.yml | 46 -------------------------------- 1 file changed, 46 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 686a2fefd7..df686497f7 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -231,29 +231,6 @@ jobs: echo "/usr/local/cmake/bin" >> $GITHUB_PATH fi - - name: Cache External Dependencies - uses: actions/cache@v6 - with: - path: | - ${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.tar.gz - ${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.zip - ${{ env.OPENSTUDIO_BUILD }}/radiance*.tar.gz - ${{ env.OPENSTUDIO_BUILD }}/radiance*.zip - ${{ env.OPENSTUDIO_BUILD }}/openstudio*gems*.tar.gz - key: external-deps-${{ matrix.os }}-${{ hashFiles('conan.lock') }} - restore-keys: | - external-deps-${{ matrix.os }}- - - - name: Restore Generated Embedded Files - uses: actions/cache@v6 - with: - path: | - ${{ env.OPENSTUDIO_BUILD }}/src/*/embedded_files - ${{ env.OPENSTUDIO_BUILD }}/ruby/engine/embedded_files - key: embedded-files-${{ matrix.os }}-${{ hashFiles('resources/**', 'ruby/engine/**', 'src/airflow/**', 'src/energyplus/**', 'src/gbxml/**', 'src/isomodel/**', 'src/model/**', 'src/radiance/**', 'src/sdd/**', 'src/utilities/**') }} - restore-keys: | - embedded-files-${{ matrix.os }}- - - name: Configure Conan remotes run: | conan remote remove conancenter || true @@ -765,29 +742,6 @@ jobs: - name: Create Build Directory run: cmake -E make_directory ${{ env.OPENSTUDIO_BUILD }} - - name: Cache External Dependencies - uses: actions/cache@v6 - with: - path: | - ${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.tar.gz - ${{ env.OPENSTUDIO_BUILD }}/EnergyPlus*.zip - ${{ env.OPENSTUDIO_BUILD }}/radiance*.tar.gz - ${{ env.OPENSTUDIO_BUILD }}/radiance*.zip - ${{ env.OPENSTUDIO_BUILD }}/openstudio*gems*.tar.gz - key: external-deps-${{ matrix.os }}-${{ hashFiles('conan.lock') }} - restore-keys: | - external-deps-${{ matrix.os }}- - - - name: Restore Generated Embedded Files - uses: actions/cache@v6 - with: - path: | - ${{ env.OPENSTUDIO_BUILD }}/src/*/embedded_files - ${{ env.OPENSTUDIO_BUILD }}/ruby/engine/embedded_files - key: embedded-files-${{ matrix.os }}-${{ hashFiles('resources/**', 'ruby/engine/**', 'src/airflow/**', 'src/energyplus/**', 'src/gbxml/**', 'src/isomodel/**', 'src/radiance/**', 'src/sdd/**', 'src/model/**', 'src/utilities/**') }} - restore-keys: | - embedded-files-${{ matrix.os }}- - - name: Configure Conan remotes run: | conan remote remove nrel-v2 || true From 9ab036af03085656f3a493ba858e6b18b189b3e4 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:38:46 +0100 Subject: [PATCH 14/54] CI: show failed tests in the "Fail job on test failures" step (that's the one that fails/is expanded) --- .github/workflows/full-build.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index df686497f7..45abcec9a3 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -456,7 +456,12 @@ jobs: - name: Fail job on test failures if: ${{ steps.ctest.outputs.exit_code != '0' }} + working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | + cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true + if [ -f Testing/Temporary/LastTestsFailed.log ]; then + echo; echo "Failed tests:"; cat Testing/Temporary/LastTestsFailed.log + fi echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" exit 1 @@ -1137,7 +1142,12 @@ jobs: - name: Fail job on test failures if: ${{ steps.mac_ctest.outputs.exit_code != '0' }} + working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | + cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true + if [ -f Testing/Temporary/LastTestsFailed.log ]; then + echo; echo "Failed tests:"; cat Testing/Temporary/LastTestsFailed.log + fi echo "::error::CTest suite failed with exit code ${{ steps.mac_ctest.outputs.exit_code }}" exit 1 macos-publish: @@ -1643,7 +1653,12 @@ jobs: - name: Fail job on test failures if: ${{ steps.ctest.outputs.exit_code != '0' }} + working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | + Get-Content "${{ env.TEST_DASHBOARD_RELATIVE }}" -ErrorAction SilentlyContinue + if (Test-Path Testing/Temporary/LastTestsFailed.log) { + ""; "Failed tests:"; Get-Content Testing/Temporary/LastTestsFailed.log + } echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" exit 1 From f86c8e90201688294e3281aba89b15153dc9ee67 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:42:00 +0100 Subject: [PATCH 15/54] Pin clang format to 24.04 so we keep clang format 18: ubuntu-latest moved to 26.04 (clang-format 21), which reformats code --- .github/workflows/clangformat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clangformat.yml b/.github/workflows/clangformat.yml index f0d92ac46f..f7dbda60b4 100644 --- a/.github/workflows/clangformat.yml +++ b/.github/workflows/clangformat.yml @@ -6,7 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: write # Needed to push a commit From 50b8da4eadd3588e3c9bb8a0fdc25f79f0721699 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:43:05 +0100 Subject: [PATCH 16/54] [chore] Commit clang-format autocorrects --- src/energyplus/ForwardTranslator.cpp | 41 ++++++------------- ...orwardTranslateComfortViewFactorAngles.cpp | 3 +- .../ForwardTranslatePeople.cpp | 34 +++++++-------- .../ForwardTranslateScheduleRuleset.cpp | 4 +- .../DefaultSubSurfaceConstructions_GTest.cpp | 11 ++--- src/energyplus/Test/ScheduleRuleset_GTest.cpp | 4 +- src/energyplus/Test/Surface_GTest.cpp | 10 ++--- src/model/ComfortViewFactorAngles.cpp | 16 ++++---- src/model/ComfortViewFactorAngles_Impl.hpp | 3 +- src/utilities/filetypes/EpwFile.cpp | 4 +- .../filetypes/test/EpwFile_GTest.cpp | 36 +++++++++------- 11 files changed, 78 insertions(+), 88 deletions(-) diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index 1cd57a0753..8e32a6336e 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -3744,38 +3744,21 @@ namespace energyplus { void ForwardTranslator::translateConstructions(const model::Model& model) { std::vector iddObjectTypes{ - IddObjectType::OS_MaterialProperty_GlazingSpectralData, - IddObjectType::OS_Material, - IddObjectType::OS_Material_AirGap, - IddObjectType::OS_Material_InfraredTransparent, - IddObjectType::OS_Material_NoMass, - IddObjectType::OS_Material_RoofVegetation, - - IddObjectType::OS_WindowMaterial_Blind, - IddObjectType::OS_WindowMaterial_DaylightRedirectionDevice, - IddObjectType::OS_WindowMaterial_Gas, - IddObjectType::OS_WindowMaterial_GasMixture, - IddObjectType::OS_WindowMaterial_Glazing, - IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, - IddObjectType::OS_WindowMaterial_Glazing_RefractionExtinctionMethod, - IddObjectType::OS_WindowMaterial_Screen, - IddObjectType::OS_WindowMaterial_Shade, - IddObjectType::OS_WindowMaterial_SimpleGlazingSystem, - IddObjectType::OS_WindowProperty_FrameAndDivider, - IddObjectType::OS_ShadingControl, - - IddObjectType::OS_Construction, - IddObjectType::OS_Construction_AirBoundary, - IddObjectType::OS_Construction_CfactorUndergroundWall, - IddObjectType::OS_Construction_FfactorGroundFloor, - IddObjectType::OS_Construction_InternalSource, - IddObjectType::OS_Construction_WindowDataFile, + IddObjectType::OS_MaterialProperty_GlazingSpectralData, IddObjectType::OS_Material, IddObjectType::OS_Material_AirGap, + IddObjectType::OS_Material_InfraredTransparent, IddObjectType::OS_Material_NoMass, IddObjectType::OS_Material_RoofVegetation, + + IddObjectType::OS_WindowMaterial_Blind, IddObjectType::OS_WindowMaterial_DaylightRedirectionDevice, IddObjectType::OS_WindowMaterial_Gas, + IddObjectType::OS_WindowMaterial_GasMixture, IddObjectType::OS_WindowMaterial_Glazing, + IddObjectType::OS_WindowMaterial_GlazingGroup_Thermochromic, IddObjectType::OS_WindowMaterial_Glazing_RefractionExtinctionMethod, + IddObjectType::OS_WindowMaterial_Screen, IddObjectType::OS_WindowMaterial_Shade, IddObjectType::OS_WindowMaterial_SimpleGlazingSystem, + IddObjectType::OS_WindowProperty_FrameAndDivider, IddObjectType::OS_ShadingControl, + + IddObjectType::OS_Construction, IddObjectType::OS_Construction_AirBoundary, IddObjectType::OS_Construction_CfactorUndergroundWall, + IddObjectType::OS_Construction_FfactorGroundFloor, IddObjectType::OS_Construction_InternalSource, IddObjectType::OS_Construction_WindowDataFile, IddObjectType::OS_StandardsInformation_Construction, // TODO: [ConstructionAssignmentSet purge] Probably not wanted, especially with purge = false in DefaultConstructionSet::collapseToSpaceAndBuilding - IddObjectType::OS_DefaultSubSurfaceConstructions, - IddObjectType::OS_DefaultSurfaceConstructions, - IddObjectType::OS_DefaultConstructionSet, + IddObjectType::OS_DefaultSubSurfaceConstructions, IddObjectType::OS_DefaultSurfaceConstructions, IddObjectType::OS_DefaultConstructionSet, IddObjectType::OS_DefaultScheduleSet, diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateComfortViewFactorAngles.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateComfortViewFactorAngles.cpp index a1b70a401d..0d0e063fdc 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateComfortViewFactorAngles.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateComfortViewFactorAngles.cpp @@ -49,8 +49,7 @@ namespace energyplus { } const auto surfaceThermalZone = space ? space->thermalZone() : boost::none; if (!surfaceThermalZone || (thermalZone && (surfaceThermalZone->handle() != thermalZone->handle()))) { - LOG(Error, modelObject.briefDescription() - << " has surfaces that are not all assigned to the same ThermalZone and will not be translated."); + LOG(Error, modelObject.briefDescription() << " has surfaces that are not all assigned to the same ThermalZone and will not be translated."); return boost::none; } thermalZone = surfaceThermalZone; diff --git a/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp b/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp index ab79f0bde6..8fde5bab5c 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp @@ -125,39 +125,40 @@ namespace energyplus { if (target->optionalCast() || target->optionalCast() || target->optionalCast()) { if (!istringEqual(mrtType, "SurfaceWeighted")) { LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription() - << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType - << "'. Using 'SurfaceWeighted'."); + << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType + << "'. Using 'SurfaceWeighted'."); } if (auto idfTarget = translateAndMapModelObject(*target)) { mrtType = "SurfaceWeighted"; idfObject.setString(PeopleFields::SurfaceName_AngleFactorListName, idfTarget->nameString()); } else { LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription() - << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); + << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); mrtType = "EnclosureAveraged"; } } else if (target->optionalCast()) { if (!istringEqual(mrtType, "AngleFactor")) { LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription() - << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType - << "'. Using 'AngleFactor'."); + << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType + << "'. Using 'AngleFactor'."); } if (auto idfTarget = translateAndMapModelObject(*target)) { mrtType = "AngleFactor"; idfObject.setString(PeopleFields::SurfaceName_AngleFactorListName, idfTarget->nameString()); } else { LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription() - << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); + << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); mrtType = "EnclosureAveraged"; } } else { LOG(Warn, modelObject.briefDescription() << " references unsupported Surface Name/Angle Factor List Name object " - << target->briefDescription() << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); + << target->briefDescription() + << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); mrtType = "EnclosureAveraged"; } } else if (!istringEqual(mrtType, "EnclosureAveraged")) { LOG(Warn, modelObject.briefDescription() << " has Mean Radiant Temperature Calculation Type '" << mrtType - << "' but no Surface Name/Angle Factor List Name; using 'EnclosureAveraged'."); + << "' but no Surface Name/Angle Factor List Name; using 'EnclosureAveraged'."); mrtType = "EnclosureAveraged"; } @@ -252,39 +253,40 @@ namespace energyplus { if (target->optionalCast()) { if (!istringEqual(mrtType, "SurfaceWeighted")) { LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription() - << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType - << "'. Using 'SurfaceWeighted'."); + << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType + << "'. Using 'SurfaceWeighted'."); } if (auto idfTarget = translateAndMapModelObject(*target)) { mrtType = "SurfaceWeighted"; idfObject.setString(People_InstanceFields::SurfaceName_AngleFactorListName, idfTarget->nameString()); } else { LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription() - << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); + << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); mrtType = "EnclosureAveraged"; } } else if (target->optionalCast()) { if (!istringEqual(mrtType, "AngleFactor")) { LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription() - << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType - << "'. Using 'AngleFactor'."); + << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType + << "'. Using 'AngleFactor'."); } if (auto idfTarget = translateAndMapModelObject(*target)) { mrtType = "AngleFactor"; idfObject.setString(People_InstanceFields::SurfaceName_AngleFactorListName, idfTarget->nameString()); } else { LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription() - << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); + << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); mrtType = "EnclosureAveraged"; } } else { LOG(Warn, modelObject.briefDescription() << " references unsupported Surface Name/Angle Factor List Name object " - << target->briefDescription() << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); + << target->briefDescription() + << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type."); mrtType = "EnclosureAveraged"; } } else if (!istringEqual(mrtType, "EnclosureAveraged")) { LOG(Warn, modelObject.briefDescription() << " has Mean Radiant Temperature Calculation Type '" << mrtType - << "' but no Surface Name/Angle Factor List Name; using 'EnclosureAveraged'."); + << "' but no Surface Name/Angle Factor List Name; using 'EnclosureAveraged'."); mrtType = "EnclosureAveraged"; } diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp index 62c545def8..f0602aba2f 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateScheduleRuleset.cpp @@ -136,7 +136,7 @@ namespace energyplus { group.setInt(Schedule_Week_RuleExtensibleFields::EndMonth, _endDate->monthOfYear().value()); group.setInt(Schedule_Week_RuleExtensibleFields::EndDay, _endDate->dayOfMonth()); } - } else { // SpecificDates + } else { // SpecificDates for (const openstudio::Date& specificDate : scheduleRule.specificDates()) { IdfExtensibleGroup group = scheduleWeekRule.pushExtensibleGroup(); group.setInt(Schedule_Week_RuleExtensibleFields::StartMonth, specificDate.monthOfYear().value()); @@ -146,7 +146,7 @@ namespace energyplus { } } - m_idfObjects.push_back(scheduleWeekRule); + m_idfObjects.push_back(scheduleWeekRule); } m_idfObjects.push_back(scheduleYearRules); diff --git a/src/energyplus/Test/DefaultSubSurfaceConstructions_GTest.cpp b/src/energyplus/Test/DefaultSubSurfaceConstructions_GTest.cpp index 6bb2439981..c3ea6d950a 100644 --- a/src/energyplus/Test/DefaultSubSurfaceConstructions_GTest.cpp +++ b/src/energyplus/Test/DefaultSubSurfaceConstructions_GTest.cpp @@ -39,12 +39,10 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_DefaultSubSurfaceConstructions) { Building building = m.getUniqueModelObject(); EXPECT_TRUE(building.setDefaultConstructionSet(defaultConstructionSet)); - DefaultSubSurfaceConstructions defaultSubSurfaceConstructions(m); defaultSubSurfaceConstructions.setName("Exterior SubSurface Constructions"); EXPECT_TRUE(defaultConstructionSet.setDefaultExteriorSubSurfaceConstructions(defaultSubSurfaceConstructions)); - Construction fixedWindowConstruction(m); fixedWindowConstruction.setName("Fixed Window Construction"); EXPECT_TRUE(defaultSubSurfaceConstructions.setFixedWindowConstruction(fixedWindowConstruction)); @@ -84,11 +82,14 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_DefaultSubSurfaceConstructions) { const auto& idfObject = idfObjs.front(); EXPECT_EQ(defaultSubSurfaceConstructions.nameString(), idfObject.nameString()); EXPECT_EQ(fixedWindowConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::FixedWindowConstructionName).get()); - EXPECT_EQ(operableWindowConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::OperableWindowConstructionName).get()); + EXPECT_EQ(operableWindowConstruction.nameString(), + idfObject.getString(SubSurfaceConstructionAssignmentsFields::OperableWindowConstructionName).get()); EXPECT_EQ(doorConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::DoorConstructionName).get()); EXPECT_EQ(glassDoorConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::GlassDoorConstructionName).get()); EXPECT_EQ(overheadDoorConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::OverheadDoorConstructionName).get()); EXPECT_EQ(skylightConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::SkylightConstructionName).get()); - EXPECT_EQ(tubularDaylightDomeConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::TubularDaylightDomeConstructionName).get()); - EXPECT_EQ(tubularDaylightDiffuserConstruction.nameString(), idfObject.getString(SubSurfaceConstructionAssignmentsFields::TubularDaylightDiffuserConstructionName).get()); + EXPECT_EQ(tubularDaylightDomeConstruction.nameString(), + idfObject.getString(SubSurfaceConstructionAssignmentsFields::TubularDaylightDomeConstructionName).get()); + EXPECT_EQ(tubularDaylightDiffuserConstruction.nameString(), + idfObject.getString(SubSurfaceConstructionAssignmentsFields::TubularDaylightDiffuserConstructionName).get()); } diff --git a/src/energyplus/Test/ScheduleRuleset_GTest.cpp b/src/energyplus/Test/ScheduleRuleset_GTest.cpp index a8af340d6c..f4865327c1 100644 --- a/src/energyplus/Test/ScheduleRuleset_GTest.cpp +++ b/src/energyplus/Test/ScheduleRuleset_GTest.cpp @@ -480,7 +480,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ScheduleRuleset_SpecialDays) { for (const WorkspaceObject& scheduleWeekRule : scheduleWeekRules) { const int rulePriorityOrder = scheduleWeekRule.getInt(Schedule_Week_RuleFields::RulePriorityOrder).get(); - if (rulePriorityOrder == 0) { // Weekends + if (rulePriorityOrder == 0) { // Weekends EXPECT_EQ("Yes", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplySunday).get()); EXPECT_EQ("No", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplyMonday).get()); EXPECT_EQ("No", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplyTuesday).get()); @@ -489,7 +489,7 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_ScheduleRuleset_SpecialDays) { EXPECT_EQ("No", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplyFriday).get()); EXPECT_EQ("Yes", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplySaturday).get()); EXPECT_EQ(weekendSchedule.nameString(), scheduleWeekRule.getString(Schedule_Week_RuleFields::DayScheduleName).get()); - } else if (rulePriorityOrder == 1) { // Weekdays + } else if (rulePriorityOrder == 1) { // Weekdays EXPECT_EQ("No", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplySunday).get()); EXPECT_EQ("Yes", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplyMonday).get()); EXPECT_EQ("Yes", scheduleWeekRule.getString(Schedule_Week_RuleFields::ApplyTuesday).get()); diff --git a/src/energyplus/Test/Surface_GTest.cpp b/src/energyplus/Test/Surface_GTest.cpp index 4a9f54595d..e41e54004a 100644 --- a/src/energyplus/Test/Surface_GTest.cpp +++ b/src/energyplus/Test/Surface_GTest.cpp @@ -541,11 +541,11 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_Surface_ExcludeSpaceTranslation_Sear }; EXPECT_EQ(spaceTypeRoofConstruction.nameString(), surfaceConstructionName(roof1)); // SpaceType wins over the Story - EXPECT_EQ(storyWallConstruction.nameString(), surfaceConstructionName(wall)); // Falls through to the Story - EXPECT_EQ("", surfaceConstructionName(floor)); // Building SpaceType: left to E+ - EXPECT_EQ(windowConstruction.nameString(), subSurfaceConstructionName(window)); // SubSurfaces are hard-assigned too - EXPECT_EQ("", subSurfaceConstructionName(door)); // Building: left to E+ - EXPECT_EQ(storyRoofConstruction.nameString(), surfaceConstructionName(roof2)); // Defaulted SpaceType skipped + EXPECT_EQ(storyWallConstruction.nameString(), surfaceConstructionName(wall)); // Falls through to the Story + EXPECT_EQ("", surfaceConstructionName(floor)); // Building SpaceType: left to E+ + EXPECT_EQ(windowConstruction.nameString(), subSurfaceConstructionName(window)); // SubSurfaces are hard-assigned too + EXPECT_EQ("", subSurfaceConstructionName(door)); // Building: left to E+ + EXPECT_EQ(storyRoofConstruction.nameString(), surfaceConstructionName(roof2)); // Defaulted SpaceType skipped // The input model isn't touched for (const auto& surface : {roof1, wall, floor, roof2}) { diff --git a/src/model/ComfortViewFactorAngles.cpp b/src/model/ComfortViewFactorAngles.cpp index 36e17d9920..1e94e283ea 100644 --- a/src/model/ComfortViewFactorAngles.cpp +++ b/src/model/ComfortViewFactorAngles.cpp @@ -77,7 +77,7 @@ namespace model { } ComfortViewFactorAngles_Impl::ComfortViewFactorAngles_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, - bool keepHandle) + bool keepHandle) : ModelObject_Impl(other, model, keepHandle) {} ComfortViewFactorAngles_Impl::ComfortViewFactorAngles_Impl(const ComfortViewFactorAngles_Impl& other, Model_Impl* model, bool keepHandle) @@ -120,7 +120,7 @@ namespace model { boost::optional ComfortViewFactorAngles_Impl::getAngleFactor(unsigned groupIndex) const { if (groupIndex >= numberofAngleFactors()) { LOG(Error, "Asked to get Angle Factor with index " << groupIndex << ", but " << briefDescription() << " has just " << numberofAngleFactors() - << " angle factors."); + << " angle factors."); return boost::none; } @@ -156,8 +156,7 @@ namespace model { boost::optional thermalZone = space->thermalZone(); if (!thermalZone) { - LOG(Error, "Cannot add " << surface.briefDescription() << " to " << briefDescription() - << " because it is not assigned to any ThermalZone."); + LOG(Error, "Cannot add " << surface.briefDescription() << " to " << briefDescription() << " because it is not assigned to any ThermalZone."); return result; } @@ -166,9 +165,8 @@ namespace model { const auto existingThermalZone = existingSpace ? existingSpace->thermalZone() : boost::none; if (!existingThermalZone || (existingThermalZone->handle() != thermalZone->handle())) { LOG(Error, "Cannot add " << surface.briefDescription() << " to " << briefDescription() << " because it is assigned to ThermalZone '" - << thermalZone->nameString() - << "' instead of '" - << (existingThermalZone ? existingThermalZone->nameString() : "an unassigned ThermalZone") << "'."); + << thermalZone->nameString() << "' instead of '" + << (existingThermalZone ? existingThermalZone->nameString() : "an unassigned ThermalZone") << "'."); return result; } } @@ -178,7 +176,7 @@ namespace model { boost::optional existingAngleFactor = getAngleFactor(existingIndex.get()); OS_ASSERT(existingAngleFactor); LOG(Warn, "For " << briefDescription() << ", AngleFactor already exists, will be modified in place from " << existingAngleFactor.get() - << " to " << angleFactor << "."); + << " to " << angleFactor << "."); } double sum = angleFactor.angleFactor(); @@ -194,7 +192,7 @@ namespace model { constexpr double tolerance = 0.000001; if (sum > 1.0 + tolerance) { LOG(Error, "Cannot add an AngleFactor to " << briefDescription() << " because the Angle Factors would sum to " << sum - << ", which is greater than 1."); + << ", which is greater than 1."); return result; } diff --git a/src/model/ComfortViewFactorAngles_Impl.hpp b/src/model/ComfortViewFactorAngles_Impl.hpp index d17d9ff93f..1db5d0d437 100644 --- a/src/model/ComfortViewFactorAngles_Impl.hpp +++ b/src/model/ComfortViewFactorAngles_Impl.hpp @@ -41,9 +41,8 @@ namespace model { private: REGISTER_LOGGER("openstudio.model.ComfortViewFactorAngles"); - }; - } + } // namespace detail } // namespace model } // namespace openstudio diff --git a/src/utilities/filetypes/EpwFile.cpp b/src/utilities/filetypes/EpwFile.cpp index 8fbdb3ef3c..566af9c659 100644 --- a/src/utilities/filetypes/EpwFile.cpp +++ b/src/utilities/filetypes/EpwFile.cpp @@ -5447,8 +5447,8 @@ bool EpwFile::parseDesignConditions(const std::string& line) { int nDesignConditions = std::stoi(split[1]); if (nDesignConditions < 0) { - LOG(Warn, "Negative number of design conditions (" << nDesignConditions << ") in EPW file '" << m_path - << "'. Design conditions will not be parsed."); + LOG(Warn, + "Negative number of design conditions (" << nDesignConditions << ") in EPW file '" << m_path << "'. Design conditions will not be parsed."); return true; } const auto nDC = static_cast(nDesignConditions); diff --git a/src/utilities/filetypes/test/EpwFile_GTest.cpp b/src/utilities/filetypes/test/EpwFile_GTest.cpp index 79eabed2b6..65e1102564 100644 --- a/src/utilities/filetypes/test/EpwFile_GTest.cpp +++ b/src/utilities/filetypes/test/EpwFile_GTest.cpp @@ -1635,8 +1635,10 @@ TEST(Filetypes, EpwDesignCondition_WrongNumberOfSubFields_UnbalancedFields2) { TEST(Filetypes, EpwDesignCondition_HoF_2025) { const std::string line = "2025 ASHRAE Handbook -- Fundamentals - Chapter 14 Climatic Design Information," "Heating,1,-15.9,-13.5,-20.3,0.6,-15.4,-18.1,0.8,-12.7,14.1,-1.0,12.8,-0.4,4.4,260,0.573," - "Cooling,7,8.8,30.3,21.7,29.0,21.2,27.8,20.6,23.7,27.7,22.9,27.0,22.1,26.0,5.2,240,22.4,17.5,26.0,21.5,16.6,25.3,20.7,15.7,24.7,71.8,27.5,68.9,27.1,65.7,25.8,25.9," - "Extremes,11.7,10.3,9.1,-18.5,32.7,2.8,1.4,-20.6,33.7,-22.2,34.5,-23.8,35.2,-25.9,36.2,-19.0,24.7,2.7,0.9,-20.9,25.3,-22.5,25.9,-24.0,26.4,-26.0,27.1"; + "Cooling,7,8.8,30.3,21.7,29.0,21.2,27.8,20.6,23.7,27.7,22.9,27.0,22.1,26.0,5.2,240,22.4,17.5,26.0,21.5,16.6,25.3,20.7,15." + "7,24.7,71.8,27.5,68.9,27.1,65.7,25.8,25.9," + "Extremes,11.7,10.3,9.1,-18.5,32.7,2.8,1.4,-20.6,33.7,-22.2,34.5,-23.8,35.2,-25.9,36.2,-19.0,24.7,2.7,0.9,-20.9,25.3,-22." + "5,25.9,-24.0,26.4,-26.0,27.1"; auto dc_ = EpwDesignCondition::fromDesignConditionsString(line); ASSERT_TRUE(dc_); const auto& dc = *dc_; @@ -1731,14 +1733,16 @@ TEST(Filetypes, EpwDesignCondition_HoF_2025) { EXPECT_EQ(27.1, dc.extremeN50YearsMaxWetBulb().get()); const std::string epw = "LOCATION,Buffalo,NY,USA,TMYx,725280,42.9406,-78.7322,-5.0,215.4\n" - "DESIGN CONDITIONS,1," + line + "\n" - "TYPICAL/EXTREME PERIODS,0\n" - "GROUND TEMPERATURES,0\n" - "HOLIDAYS/DAYLIGHT SAVINGS,No,0,0,0\n" - "COMMENTS 1,\n" - "COMMENTS 2,\n" - "DATA PERIODS,1,1,Data,Wednesday,1/1,1/1\n" - "2025,1,1,1,60\n"; + "DESIGN CONDITIONS,1," + + line + + "\n" + "TYPICAL/EXTREME PERIODS,0\n" + "GROUND TEMPERATURES,0\n" + "HOLIDAYS/DAYLIGHT SAVINGS,No,0,0,0\n" + "COMMENTS 1,\n" + "COMMENTS 2,\n" + "DATA PERIODS,1,1,Data,Wednesday,1/1,1/1\n" + "2025,1,1,1,60\n"; auto epwFile = EpwFile::loadFromString(epw, false); ASSERT_TRUE(epwFile); ASSERT_EQ(1, epwFile->designConditions().size()); @@ -1748,8 +1752,10 @@ TEST(Filetypes, EpwDesignCondition_HoF_2025) { TEST(Filetypes, EpwDesignCondition_HoF_2025_Heuristics) { const std::string line = "This title does not include a year," "Heating,1,-15.9,-13.5,-20.3,0.6,-15.4,-18.1,0.8,-12.7,14.1,-1.0,12.8,-0.4,4.4,260,0.573," - "Cooling,7,8.8,30.3,21.7,29.0,21.2,27.8,20.6,23.7,27.7,22.9,27.0,22.1,26.0,5.2,240,22.4,17.5,26.0,21.5,16.6,25.3,20.7,15.7,24.7,71.8,27.5,68.9,27.1,65.7,25.8,25.9," - "Extremes,11.7,10.3,9.1,-18.5,32.7,2.8,1.4,-20.6,33.7,-22.2,34.5,-23.8,35.2,-25.9,36.2,-19.0,24.7,2.7,0.9,-20.9,25.3,-22.5,25.9,-24.0,26.4,-26.0,27.1"; + "Cooling,7,8.8,30.3,21.7,29.0,21.2,27.8,20.6,23.7,27.7,22.9,27.0,22.1,26.0,5.2,240,22.4,17.5,26.0,21.5,16.6,25.3,20.7,15." + "7,24.7,71.8,27.5,68.9,27.1,65.7,25.8,25.9," + "Extremes,11.7,10.3,9.1,-18.5,32.7,2.8,1.4,-20.6,33.7,-22.2,34.5,-23.8,35.2,-25.9,36.2,-19.0,24.7,2.7,0.9,-20.9,25.3,-22." + "5,25.9,-24.0,26.4,-26.0,27.1"; auto dc_ = EpwDesignCondition::fromDesignConditionsString(line); ASSERT_TRUE(dc_); const auto& dc = *dc_; @@ -1845,8 +1851,10 @@ TEST(Filetypes, EpwDesignCondition_HoF_2025_Heuristics) { TEST(Filetypes, EpwDesignCondition_HoF_2025_Heuristics_OverrideVersion) { const std::string line = "This title includes the 2009 version when it is not actually it," "Heating,1,-15.9,-13.5,-20.3,0.6,-15.4,-18.1,0.8,-12.7,14.1,-1.0,12.8,-0.4,4.4,260,0.573," - "Cooling,7,8.8,30.3,21.7,29.0,21.2,27.8,20.6,23.7,27.7,22.9,27.0,22.1,26.0,5.2,240,22.4,17.5,26.0,21.5,16.6,25.3,20.7,15.7,24.7,71.8,27.5,68.9,27.1,65.7,25.8,25.9," - "Extremes,11.7,10.3,9.1,-18.5,32.7,2.8,1.4,-20.6,33.7,-22.2,34.5,-23.8,35.2,-25.9,36.2,-19.0,24.7,2.7,0.9,-20.9,25.3,-22.5,25.9,-24.0,26.4,-26.0,27.1"; + "Cooling,7,8.8,30.3,21.7,29.0,21.2,27.8,20.6,23.7,27.7,22.9,27.0,22.1,26.0,5.2,240,22.4,17.5,26.0,21.5,16.6,25.3,20.7,15." + "7,24.7,71.8,27.5,68.9,27.1,65.7,25.8,25.9," + "Extremes,11.7,10.3,9.1,-18.5,32.7,2.8,1.4,-20.6,33.7,-22.2,34.5,-23.8,35.2,-25.9,36.2,-19.0,24.7,2.7,0.9,-20.9,25.3,-22." + "5,25.9,-24.0,26.4,-26.0,27.1"; auto dc_ = EpwDesignCondition::fromDesignConditionsString(line); ASSERT_TRUE(dc_); const auto& dc = *dc_; From 896aabc8a58aee0a2835dc0344fb5f629d7fd9ff Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:43:30 +0100 Subject: [PATCH 17/54] Add clang-format autocorrects to git-blame-ignore-revs --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 302c5ecd2f..d08253d937 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -161,3 +161,6 @@ ae602de89105983bf762cf1e6afd33d63d81b4a6 # [chore] Org and copyright year updates for OS 311 [David Goldwasser, 2026-01-05] 7a409fb41f6b0602ef2a6a018c9b3d33934571af 3c5a13b05d17ad83bca6ee84ca130b5c1c7f1dda + +# [chore] Commit clang-format autocorrects [Julien Marrec, 2026-11-25] +50b8da4eadd3588e3c9bb8a0fdc25f79f0721699 From 43f23eafbad6573e2ecd4216ba81f423d99fde27 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 16:55:00 +0100 Subject: [PATCH 18/54] CI: show/zero ccache stats in dedicated steps around the build on all platforms --- .github/workflows/full-build.yml | 43 +++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 45abcec9a3..7f00182106 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -221,7 +221,6 @@ jobs: git config --global --add safe.directory '*' mkdir -p "$CCACHE_DIR" "$CONAN_HOME" - echo "Configured ccache:"; ccache -s | sed -n '1,10p' - name: Fix CMake Path (CentOS) if: matrix.platform == 'centos-9-x64' @@ -299,6 +298,14 @@ jobs: -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \ -DCMAKE_JOB_POOL_LINK:STRING=console + - name: Show restored ccache stats + shell: bash + run: | + # Stats live in the cache dir, so they come back with the restore: show them, then zero them for this run + ccache --show-stats -vv + ccache --zero-stats + ccache --show-config + - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | @@ -318,6 +325,11 @@ jobs: ninja -d stats || true exit $BUILD_EXIT + - name: Show ccache stats + if: always() + shell: bash + run: ccache --show-stats -vv + - name: Save ccache cache if: always() && steps.ccache-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v6 @@ -817,6 +829,14 @@ jobs: -DCMAKE_JOB_POOL_LINK:STRING=console \ .. + - name: Show restored ccache stats + shell: bash + run: | + # Stats live in the cache dir, so they come back with the restore: show them, then zero them for this run + ccache --show-stats -vv + ccache --zero-stats + ccache --show-config + - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | @@ -834,10 +854,14 @@ jobs: build_exit=${PIPESTATUS[0]} kill $heartbeat_pid || true ninja -d stats || true - ccache -s if [ -f build.log ]; then tail -n 40 build.log; fi exit $build_exit + - name: Show ccache stats + if: always() + shell: bash + run: ccache --show-stats -vv + - name: Save ccache cache if: always() && steps.ccache-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v6 @@ -1359,11 +1383,18 @@ jobs: run: | & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console .." + - name: Show restored ccache stats + shell: bash + run: | + # Stats live in the cache dir, so they come back with the restore: show them, then zero them for this run + ccache --show-stats -vv + ccache --zero-stats + ccache --show-config + - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} shell: pwsh run: | - ccache -s # Use $env:ComSpec to ensure we call the Windows Command Prompt, not the MSYS2 cmd found in PATH & $env:ComSpec /c "call conanbuild.bat && cmake --build . --parallel ${{ matrix.max_jobs }} -- -d stats 2>&1" | Tee-Object -FilePath "build.log" @@ -1372,7 +1403,11 @@ jobs: Write-Error "Build failed with exit code $LASTEXITCODE" exit $LASTEXITCODE } - ccache -s + + - name: Show ccache stats + if: always() + shell: bash + run: ccache --show-stats -vv - name: Save ccache cache if: always() && steps.ccache-restore.outputs.cache-hit != 'true' From 5637825606af0eaa1454c9cdb7fab40ecc40351d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 17:02:17 +0100 Subject: [PATCH 19/54] CI: drop "Wait for network stability" steps + reorder --- .github/workflows/full-build.yml | 34 +++++++++++--------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 7f00182106..21b9feeeb9 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -337,6 +337,17 @@ jobs: path: ${{ env.CCACHE_DIR }} key: ${{ steps.ccache-restore.outputs.cache-primary-key }} + - name: Upload build diagnostics + if: always() + uses: actions/upload-artifact@v7 + with: + name: build-diag-${{ matrix.platform }}-${{ github.sha }} + path: | + ${{ env.OPENSTUDIO_BUILD }}/build.log + ${{ env.OPENSTUDIO_BUILD }}/.ninja_log + ${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake + if-no-files-found: warn + - name: Run CTest suite id: ctest continue-on-error: true @@ -396,21 +407,6 @@ jobs: echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT - - name: Wait for network stability - if: always() - run: sleep 5 - - - name: Upload build diagnostics - if: always() - uses: actions/upload-artifact@v7 - with: - name: build-diag-${{ matrix.platform }}-${{ github.sha }} - path: | - ${{ env.OPENSTUDIO_BUILD }}/build.log - ${{ env.OPENSTUDIO_BUILD }}/.ninja_log - ${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake - if-no-files-found: warn - - name: Copy Testing tree with suffix if: always() working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -869,10 +865,6 @@ jobs: path: ${{ env.CCACHE_DIR }} key: ${{ steps.ccache-restore.outputs.cache-primary-key }} - - name: Wait for network stability - if: always() - run: sleep 5 - - name: Upload build diagnostics if: always() uses: actions/upload-artifact@v7 @@ -1416,10 +1408,6 @@ jobs: path: ${{ env.CCACHE_DIR }} key: ${{ steps.ccache-restore.outputs.cache-primary-key }} - - name: Wait for network stability - if: always() - run: Start-Sleep -Seconds 5 - - name: Upload build diagnostics if: always() uses: actions/upload-artifact@v7 From 05520608dee022ccee72bf92a7d77c32d1689c4b Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 17:03:57 +0100 Subject: [PATCH 20/54] CI: fail on test failures as the last step on Linux and Windows, like macOS (installers still uploaded as artifact) --- .github/workflows/full-build.yml | 45 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 21b9feeeb9..d38dd98424 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -462,17 +462,6 @@ jobs: find . -name "*.o" -type f -delete || true df -h . - - name: Fail job on test failures - if: ${{ steps.ctest.outputs.exit_code != '0' }} - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true - if [ -f Testing/Temporary/LastTestsFailed.log ]; then - echo; echo "Failed tests:"; cat Testing/Temporary/LastTestsFailed.log - fi - echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" - exit 1 - - name: Upload DEB installer if: contains(matrix.cpack_generators, 'DEB') uses: actions/upload-artifact@v7 @@ -504,6 +493,17 @@ jobs: path: ${{ env.OPENSTUDIO_BUILD }}/*.whl if-no-files-found: ignore + - name: Fail job on test failures + if: ${{ steps.ctest.outputs.exit_code != '0' }} + working-directory: ${{ env.OPENSTUDIO_BUILD }} + run: | + cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true + if [ -f Testing/Temporary/LastTestsFailed.log ]; then + echo; echo "Failed tests:"; cat Testing/Temporary/LastTestsFailed.log + fi + echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" + exit 1 + linux-publish: name: Publish Linux Artifacts needs: [linux-build] @@ -1166,6 +1166,7 @@ jobs: fi echo "::error::CTest suite failed with exit code ${{ steps.mac_ctest.outputs.exit_code }}" exit 1 + macos-publish: name: Publish MacOS Artifacts needs: [macos-build] @@ -1674,17 +1675,6 @@ jobs: Get-ChildItem -Path . -Include "*.obj" -Recurse -Force | Remove-Item -Force -ErrorAction SilentlyContinue Get-PSDrive C | Select-Object Used,Free - - name: Fail job on test failures - if: ${{ steps.ctest.outputs.exit_code != '0' }} - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - Get-Content "${{ env.TEST_DASHBOARD_RELATIVE }}" -ErrorAction SilentlyContinue - if (Test-Path Testing/Temporary/LastTestsFailed.log) { - ""; "Failed tests:"; Get-Content Testing/Temporary/LastTestsFailed.log - } - echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" - exit 1 - - name: Upload Signed EXE installer uses: actions/upload-artifact@v7 with: @@ -1708,6 +1698,17 @@ jobs: path: ${{ env.OPENSTUDIO_BUILD }}/_CPack_Packages/win64/TGZ/*.tar.gz if-no-files-found: ignore + - name: Fail job on test failures + if: ${{ steps.ctest.outputs.exit_code != '0' }} + working-directory: ${{ env.OPENSTUDIO_BUILD }} + run: | + Get-Content "${{ env.TEST_DASHBOARD_RELATIVE }}" -ErrorAction SilentlyContinue + if (Test-Path Testing/Temporary/LastTestsFailed.log) { + ""; "Failed tests:"; Get-Content Testing/Temporary/LastTestsFailed.log + } + echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" + exit 1 + windows-publish: name: Publish Windows Artifacts needs: [windows-build] From 12d9f38b879b27531f4a7fa1c61d43cb0e8d0c91 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 17:09:23 +0100 Subject: [PATCH 21/54] macOS CI: use upstream actions/setup-python instead of my fork The fork (tcl-tk fixup) was copied from E+'s release_mac.yml, where the build Python's stdlib gets bundled. OpenStudio bundles E+'s python_lib/libpython instead, so upstream 3.12.2 is fine here; drop the toolcache removal hack too. --- .github/workflows/full-build.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index d38dd98424..bd4c1b0090 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -707,18 +707,10 @@ jobs: restore-keys: | conan-${{ matrix.os }}-${{ matrix.platform }}- - - name: Remove python ${{ env.PYTHON_REQUIRED_VERSION }} from the toolcache - run: | - ls $RUNNER_TOOL_CACHE/Python || true - rm -Rf "$RUNNER_TOOL_CACHE/Python/${{ env.PYTHON_REQUIRED_VERSION }}" - rm -Rf "$RUNNER_TOOL_CACHE/Python/${{ env.PYTHON_REQUIRED_VERSION }}*/" - - name: Set up Python ${{ env.PYTHON_REQUIRED_VERSION }} - id: setup-python - uses: jmarrec/setup-python@v5.4.0 + uses: actions/setup-python@v7 with: python-version: ${{ env.PYTHON_REQUIRED_VERSION }} - # check-latest: true # Force pick up the python I built instead of the (potential) toolcache one. I could also do `rm -Rf $RUNNER_TOOL_CACHE/Python/3.12.2` before this action - name: Install Python dependencies run: | From 28a9813cdd555efc90ff1dec5c5df368ccaabad7 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 17:14:56 +0100 Subject: [PATCH 22/54] Linux CI: stop building the pip package on Ubuntu x64 BUILD_PYTHON_PIP_PACKAGE=ON compiles every SWIG python binding a second time, but nothing ever ran `ninja python_package && cd Products/python_package && python setup.py bdist_wheel` so no wheel was produced or uploaded (python_bindings.yml builds the wheels). Ubuntu x64 built in 104 min vs 63 min on ARM64 / 65 min on CentOS. --- .github/workflows/full-build.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index bd4c1b0090..f08e20de30 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -107,7 +107,6 @@ jobs: container_image: nrel/openstudio-cmake-tools:almalinux9-main container_options: "--privileged -u root" test_suffix: CentOS-9 - pip_package: false docker_trigger: false upload_globs: | *.rpm @@ -121,7 +120,6 @@ jobs: container_image: nrel/openstudio-cmake-tools:noble-main container_options: "--privileged -u root" test_suffix: Ubuntu-2404 - pip_package: true docker_trigger: true upload_globs: | *.deb @@ -135,7 +133,6 @@ jobs: container_image: nrel/openstudio-cmake-tools:noble-main container_options: "--privileged -u root" test_suffix: Ubuntu-2404-ARM64 - pip_package: false docker_trigger: false upload_globs: | *.deb @@ -291,7 +288,6 @@ jobs: -DBUILD_TESTING:BOOL=ON \ -DCPACK_GENERATOR:STRING="${{ matrix.cpack_generators }}" \ -DBUILD_PYTHON_BINDINGS:BOOL=ON \ - -DBUILD_PYTHON_PIP_PACKAGE:BOOL=${{ matrix.pip_package }} \ -DPython_EXECUTABLE:FILEPATH="$SYSTEM_PYTHON_PATH" \ -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} \ -DSYSTEM_RUBY_EXECUTABLE="$SYSTEM_RUBY_PATH" \ @@ -485,14 +481,6 @@ jobs: path: ${{ env.OPENSTUDIO_BUILD }}/OpenStudio-*.tar.gz if-no-files-found: ignore - - name: Upload WHEEL installer - if: matrix.pip_package - uses: actions/upload-artifact@v7 - with: - name: OS-Installers-${{ matrix.platform }}-WHEEL-${{ github.sha }} - path: ${{ env.OPENSTUDIO_BUILD }}/*.whl - if-no-files-found: ignore - - name: Fail job on test failures if: ${{ steps.ctest.outputs.exit_code != '0' }} working-directory: ${{ env.OPENSTUDIO_BUILD }} From a06d194b10ee889b23d9cf565273354b0e0acadf Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 17:27:38 +0100 Subject: [PATCH 23/54] macOS CI: drop os.version and readline option from conan install os.version isn't set when the deps are built and uploaded (jmarrec/conan-recipes upload_deps.yml) nor in python_bindings.yml, so the package IDs never matched nrel-v2 and every compiled dependency was rebuilt from source. MACOSX_DEPLOYMENT_TARGET / CMAKE_OSX_DEPLOYMENT_TARGET still set OpenStudio's own minimum macOS. readline/*:with_library=termcap is the recipe default, so it was a no-op. --- .github/workflows/full-build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index f08e20de30..2972067e2f 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -755,9 +755,7 @@ jobs: --build="$CONAN_BUILD_POLICY" \ -c tools.cmake.cmaketoolchain:generator=Ninja \ -s compiler.cppstd=20 \ - -s build_type=${{ env.BUILD_TYPE }} \ - -s os.version=${{ matrix.macos_dev_target }} \ - -o readline/*:with_library=termcap + -s build_type=${{ env.BUILD_TYPE }} - name: Clean Conan cache before saving if: steps.conan-restore.outputs.cache-hit != 'true' From 82e8143c6b5086911b2568434d6f15b518af21a6 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 17:55:31 +0100 Subject: [PATCH 24/54] CI: add a setup-conan composite action and use it in Full Build; same python requirements on all platforms Restore cache, install Conan, configure it (default profile with cppstd=20 / build_type for both contexts like jmarrec/conan-recipes upload_deps.yml so package IDs match nrel-v2, global.conf, nrel-v2 first), conan install, and save the cache right away on a key miss. Replaces the three diverging copies: remote order (conancenter was first on Linux), -s host-only settings, the Windows lockfile rewrite, and the CentOS glibc step (now config-install / extra-args inputs). macOS passes the same cxxflags conf as upload_deps.yml for deps built from source. Python deps: install only python/requirements.txt on all three platforms (Linux relied on the image, with pytest-xdist unpinned and jinja2 only there as a conan dependency); setuptools/wheel are only needed for the pip package, which Full Build doesn't build. --- .github/actions/setup-conan/action.yml | 119 ++++++++++++++++ .github/workflows/full-build.yml | 183 ++++--------------------- 2 files changed, 148 insertions(+), 154 deletions(-) create mode 100644 .github/actions/setup-conan/action.yml diff --git a/.github/actions/setup-conan/action.yml b/.github/actions/setup-conan/action.yml new file mode 100644 index 0000000000..cdab9da57c --- /dev/null +++ b/.github/actions/setup-conan/action.yml @@ -0,0 +1,119 @@ +name: Setup Conan +description: > + Restore the Conan cache, configure the remotes, run conan install, and save the cache right away when the lockfile changed + (so a later build or test failure doesn't lose it). Installs Conan with pip, so Python must already be set up. + +inputs: + cache-key-prefix: + description: "Cache key prefix, eg conan--. The hash of conan.lock is appended" + required: true + build-folder: + description: "Output folder for conan install" + default: build + build-type: + description: "CMake build type" + default: Release + build-policy: + description: "Value passed to conan install --build to specify what to build from source" + default: missing + config-install: + description: "Optional path passed to 'conan config install' (eg extra profiles)" + default: "" + extra-args: + description: "Extra arguments passed to conan install" + default: "" + +outputs: + cache-hit: + description: "Whether the Conan cache was restored from an exact key match" + value: ${{ steps.restore.outputs.cache-hit }} + +runs: + using: composite + steps: + - name: Restore Conan cache + id: restore + uses: actions/cache/restore@v6 + with: + path: ${{ env.CONAN_HOME || '~/.conan2' }} + key: ${{ inputs.cache-key-prefix }}-${{ hashFiles('conan.lock') }} + restore-keys: | + ${{ inputs.cache-key-prefix }}- + + - name: Install Conan + shell: bash + run: | + begin_group() { echo -e "::group::\033[93m$1\033[0m"; } + + begin_group "Install Conan" + python -m pip install "conan>=2" + conan --version + echo "::endgroup::" + + - name: Configure Conan + shell: bash + run: | + begin_group() { echo -e "::group::\033[93m$1\033[0m"; } + + begin_group "Conan home" + conan config home + echo "::endgroup::" + + begin_group "Default profile" + # Same default profile as jmarrec/conan-recipes upload_deps.yml, so the package IDs match what's on nrel-v2. + # It's used for both the host and build contexts. + conan profile detect --force --name default + CONAN_PROFILE_DEFAULT=$(conan profile path default) + # Mac has the BSD flavor of sed and MUST take a backup suffix + sed -i.bak 's/cppstd=.*$/cppstd=20/g' "$CONAN_PROFILE_DEFAULT" + sed -i.bak 's/build_type=.*$/build_type=${{ inputs.build-type }}/g' "$CONAN_PROFILE_DEFAULT" + # Windows only + sed -i.bak 's/compiler.runtime_type=.*$/compiler.runtime_type=${{ inputs.build-type }}/g' "$CONAN_PROFILE_DEFAULT" + rm -f "$CONAN_PROFILE_DEFAULT.bak" + conan profile show + echo "::endgroup::" + + begin_group "Global.conf" + # Overwrite (not append): global.conf comes back with the restored cache + CONAN_GLOBAL_CONF="$(conan config home)/global.conf" + echo "core:non_interactive = True" > "$CONAN_GLOBAL_CONF" + echo "core.download:parallel = {{os.cpu_count() - 2}}" >> "$CONAN_GLOBAL_CONF" + cat "$CONAN_GLOBAL_CONF" + echo "::endgroup::" + + begin_group "Remotes" + # nrel-v2 first: that's where our prebuilt binaries are + conan remote add --index 0 --force nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2 + conan remote list + echo "::endgroup::" + + if [ -n "${{ inputs.config-install }}" ]; then + begin_group "Config install" + conan config install "${{ inputs.config-install }}" + echo "::endgroup::" + fi + + - name: Conan install + shell: bash + run: | + begin_group() { echo -e "::group::\033[93m$1\033[0m"; } + + begin_group "Conan install" + conan install . \ + --output-folder="${{ inputs.build-folder }}" \ + --build="${{ inputs.build-policy }}" \ + -c tools.cmake.cmaketoolchain:generator=Ninja \ + ${{ inputs.extra-args }} + echo "::endgroup::" + + - name: Clean Conan cache before saving + if: steps.restore.outputs.cache-hit != 'true' + shell: bash + run: conan cache clean "*" --source --build --download --temp + + - name: Save Conan cache + if: steps.restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: ${{ env.CONAN_HOME || '~/.conan2' }} + key: ${{ steps.restore.outputs.cache-primary-key }} diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 2972067e2f..28784706e0 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -203,15 +203,6 @@ jobs: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ env.BASE_SHA }} ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- - - name: Restore Conan cache - id: conan-restore - uses: actions/cache/restore@v6 - with: - path: ${{ env.CONAN_HOME }} - key: conan-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} - restore-keys: | - conan-${{ matrix.os }}-${{ matrix.platform }}- - - name: Prepare workspace run: | @@ -227,49 +218,21 @@ jobs: echo "/usr/local/cmake/bin" >> $GITHUB_PATH fi - - name: Configure Conan remotes - run: | - conan remote remove conancenter || true - conan remote add conancenter https://center2.conan.io - conan remote remove nrel-v2 || true - conan remote add nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2 - if [ ! -f "$CONAN_HOME/profiles/default" ]; then - conan profile detect - fi - - - name: Add libc setting to Conan (CentOS) - # nrel-v2's gcc 14 binaries are built on ubuntu-24.04 with GLIBC 2.39 (AlmaLinux 9 has 2.34). Making the libc version part of the - # package_id means they never match, so we build from source (or pull the glibc 2.34 ones once uploaded to nrel-v2). - # See https://github.com/NatLabRockies/openstudio-cmake-tools/issues/6 - if: matrix.platform == 'centos-9-x64' - run: | - conan config install developer/conan/config - conan profile show -pr:a glibc | grep "os.libc" - echo "CONAN_EXTRA_ARGS=-pr:a glibc" >> $GITHUB_ENV + - name: Install Python dependencies + run: python -m pip install -r python/requirements.txt - - name: Conan install - env: - CONAN_BUILD_POLICY: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} - run: | - conan install . \ - --output-folder="${{ env.OPENSTUDIO_BUILD }}" \ - --build="$CONAN_BUILD_POLICY" \ - -c tools.cmake.cmaketoolchain:generator=Ninja \ - -s compiler.cppstd=20 \ - -s build_type=${{ env.BUILD_TYPE }} \ - ${CONAN_EXTRA_ARGS:-} - - - name: Clean Conan cache before saving - if: steps.conan-restore.outputs.cache-hit != 'true' - run: conan cache clean "*" --source --build --download --temp - - - name: Save Conan cache - # Saved right after install (only when the lockfile changed) so a later build failure doesn't lose it - if: steps.conan-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@v6 + - name: Setup Conan + uses: ./.github/actions/setup-conan with: - path: ${{ env.CONAN_HOME }} - key: ${{ steps.conan-restore.outputs.cache-primary-key }} + cache-key-prefix: conan-${{ matrix.os }}-${{ matrix.platform }} + build-folder: ${{ env.OPENSTUDIO_BUILD }} + build-type: ${{ env.BUILD_TYPE }} + build-policy: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} + # nrel-v2's gcc 14 binaries are built on ubuntu-24.04 with GLIBC 2.39 (AlmaLinux 9 has 2.34). Making the libc version part of the + # package_id means they never match, so we build from source (or pull the glibc 2.34 ones once uploaded to nrel-v2). + # See https://github.com/NatLabRockies/openstudio-cmake-tools/issues/6 + config-install: ${{ matrix.platform == 'centos-9-x64' && 'developer/conan/config' || '' }} + extra-args: ${{ matrix.platform == 'centos-9-x64' && '-pr:a glibc' || '' }} - name: Locate Ruby run: | @@ -686,26 +649,13 @@ jobs: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ env.BASE_SHA }} ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- - - name: Restore Conan cache - id: conan-restore - uses: actions/cache/restore@v6 - with: - path: ~/.conan2 - key: conan-${{ matrix.os }}-${{ matrix.platform }}-${{ hashFiles('conan.lock') }} - restore-keys: | - conan-${{ matrix.os }}-${{ matrix.platform }}- - - name: Set up Python ${{ env.PYTHON_REQUIRED_VERSION }} uses: actions/setup-python@v7 with: python-version: ${{ env.PYTHON_REQUIRED_VERSION }} - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - pip install -r python/requirements.txt - pip install conan + run: python -m pip install -r python/requirements.txt - name: Install Ruby uses: ruby/setup-ruby@v1 @@ -735,39 +685,15 @@ jobs: - name: Create Build Directory run: cmake -E make_directory ${{ env.OPENSTUDIO_BUILD }} - - name: Configure Conan remotes - run: | - conan remote remove nrel-v2 || true - conan remote add --index 0 nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2 - conan remote remove conancenter || true - conan remote add conancenter https://center2.conan.io - if [ ! -f "$HOME/.conan2/profiles/default" ]; then - conan profile detect - fi - conan config home - - - name: Conan install - env: - CONAN_BUILD_POLICY: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} - run: | - conan install . \ - --output-folder=${{ env.OPENSTUDIO_BUILD }} \ - --build="$CONAN_BUILD_POLICY" \ - -c tools.cmake.cmaketoolchain:generator=Ninja \ - -s compiler.cppstd=20 \ - -s build_type=${{ env.BUILD_TYPE }} - - - name: Clean Conan cache before saving - if: steps.conan-restore.outputs.cache-hit != 'true' - run: conan cache clean "*" --source --build --download --temp - - - name: Save Conan cache - # Saved right after install (only when the lockfile changed) so a later build failure doesn't lose it - if: steps.conan-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@v6 + - name: Setup Conan + uses: ./.github/actions/setup-conan with: - path: ~/.conan2 - key: ${{ steps.conan-restore.outputs.cache-primary-key }} + cache-key-prefix: conan-${{ matrix.os }}-${{ matrix.platform }} + build-folder: ${{ env.OPENSTUDIO_BUILD }} + build-type: ${{ env.BUILD_TYPE }} + build-policy: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} + # Same as jmarrec/conan-recipes upload_deps.yml, for the deps that have to be built from source (boost with recent clang) + extra-args: -c tools.build:cxxflags="['-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION', '-Wno-enum-constexpr-conversion']" - name: Locate Ruby run: | @@ -1258,15 +1184,6 @@ jobs: # Not sccache: it refuses to cache MSVC compiles using PCH (/Yc, /Fp), i.e. ~95% of them run: choco install ccache -y --no-progress - - name: Restore Conan cache - id: conan-restore - uses: actions/cache/restore@v6 - with: - path: ~/.conan2 - key: conan-${{ matrix.os }}-windows-${{ hashFiles('conan.lock') }} - restore-keys: | - conan-${{ matrix.os }}-windows- - - name: Set up Python 3.12.2 uses: actions/setup-python@v7 with: @@ -1274,13 +1191,7 @@ jobs: cache: 'pip' - name: Install Python dependencies - run: | - python -m pip install --upgrade pip setuptools wheel - python -m pip install -r python/requirements.txt - - - name: Install Conan - run: | - python -m pip install conan + run: python -m pip install -r python/requirements.txt - name: Install Ruby uses: ruby/setup-ruby@v1 @@ -1295,49 +1206,13 @@ jobs: - name: Create Build Directory run: cmake -E make_directory ${{ env.OPENSTUDIO_BUILD }} - - name: Configure Conan remotes - run: | - conan remote remove nrel-v2 - if ($LASTEXITCODE -ne 0) { $LASTEXITCODE = 0 } - conan remote add nrel-v2 https://conan.openstudio.net/artifactory/api/conan/conan-v2 - if ($LASTEXITCODE -ne 0) { throw "Failed to add nrel-v2 remote" } - conan remote enable nrel-v2 - - conan remote remove conancenter - if ($LASTEXITCODE -ne 0) { $LASTEXITCODE = 0 } - conan remote add conancenter https://center2.conan.io - if ($LASTEXITCODE -ne 0) { throw "Failed to add conancenter remote" } - conan remote enable conancenter - - if (-not (Test-Path "$env:USERPROFILE/.conan2/profiles/default")) { - conan profile detect - } - conan config home - - - name: Conan install - env: - CONAN_BUILD_POLICY: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} - run: | - conan install . ` - --output-folder="${{ env.OPENSTUDIO_BUILD }}" ` - --build="$env:CONAN_BUILD_POLICY" ` - -c tools.cmake.cmaketoolchain:generator=Ninja ` - -s compiler.cppstd=20 ` - -s build_type=${{ env.BUILD_TYPE }} ` - --lockfile-partial --lockfile-out=conan.lock - git diff conan.lock - - - name: Clean Conan cache before saving - if: steps.conan-restore.outputs.cache-hit != 'true' - run: conan cache clean "*" --source --build --download --temp - - - name: Save Conan cache - # Saved right after install (only when the lockfile changed) so a later build failure doesn't lose it - if: steps.conan-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@v6 + - name: Setup Conan + uses: ./.github/actions/setup-conan with: - path: ~/.conan2 - key: ${{ steps.conan-restore.outputs.cache-primary-key }} + cache-key-prefix: conan-${{ matrix.os }}-${{ matrix.platform }} + build-folder: ${{ env.OPENSTUDIO_BUILD }} + build-type: ${{ env.BUILD_TYPE }} + build-policy: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} - name: Locate Ruby run: | From 52346f3a49477c7304a5dfdbb6c9d7e166cf2aaf Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 18:04:02 +0100 Subject: [PATCH 25/54] CI: drop "Cleanup intermediate files" steps Deleting *.o / *.obj right before the job ends frees nothing useful (only artifact uploads follow and the runner is discarded), and the recursive scan of the build tree costs time, especially on Windows --- .github/workflows/full-build.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 28784706e0..4aa250b627 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -414,13 +414,6 @@ jobs: . ./conanbuild.sh cpack -C ${{ env.BUILD_TYPE }} - - name: Cleanup intermediate files - if: always() - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - find . -name "*.o" -type f -delete || true - df -h . - - name: Upload DEB installer if: contains(matrix.cpack_generators, 'DEB') uses: actions/upload-artifact@v7 @@ -899,13 +892,6 @@ jobs: fi cpack -C ${{ env.BUILD_TYPE }} "${SIGNING_ARGS[@]}" - - name: Cleanup intermediate files - if: always() - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - find . -name "*.o" -type f -delete || true - df -h . - - name: Ad-hoc Sign Inner Installer (Fix "Killed" Error) if: ${{ success() && !cancelled() }} working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -1521,13 +1507,6 @@ jobs: Remove-Item $signedInstallerZip -Force Write-Host "Installer signed successfully." - - name: Cleanup intermediate files - if: always() - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - Get-ChildItem -Path . -Include "*.obj" -Recurse -Force | Remove-Item -Force -ErrorAction SilentlyContinue - Get-PSDrive C | Select-Object Used,Free - - name: Upload Signed EXE installer uses: actions/upload-artifact@v7 with: From 0b082c4e59f154e555945ce266622dcaaff3f8ea Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 18:10:38 +0100 Subject: [PATCH 26/54] CI: let the conanfile.py presets pick the CPack generators conanfile.py now picks RPM instead of DEB on Red Hat-like systems, so Linux no longer passes CPACK_GENERATOR, and Windows now configures with `cmake --preset conan-release` (toolchain, Ninja, build type and CPack generators come from the preset). The DEB/RPM uploads now error if the expected installer is missing instead of silently skipping --- .github/workflows/full-build.yml | 17 +++++++---------- conanfile.py | 5 ++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 4aa250b627..dce98d7c23 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -111,7 +111,6 @@ jobs: upload_globs: | *.rpm *OpenStudio*x86_64.tar.gz - cpack_generators: "RPM;TGZ" max_jobs: 4 exclude_regex: "BCLFixture.RemoteBCLMetaSearchTest" - platform: ubuntu-2404-x64 @@ -124,7 +123,6 @@ jobs: upload_globs: | *.deb *OpenStudio*x86_64.tar.gz - cpack_generators: "DEB;TGZ" max_jobs: 4 exclude_regex: "" - platform: ubuntu-2404-arm64 @@ -137,7 +135,6 @@ jobs: upload_globs: | *.deb *OpenStudio*arm64.tar.gz - cpack_generators: "DEB;TGZ" max_jobs: 4 # SqlFileFixture.AnnualTotalCosts needed until E+ itself disables ffp-contract on arm64 GCC exclude_regex: "SqlFileFixture.AnnualTotalCosts|OpenStudioCLI.*test_measure_manager" @@ -249,7 +246,6 @@ jobs: cmake --preset conan-release \ -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} \ -DBUILD_TESTING:BOOL=ON \ - -DCPACK_GENERATOR:STRING="${{ matrix.cpack_generators }}" \ -DBUILD_PYTHON_BINDINGS:BOOL=ON \ -DPython_EXECUTABLE:FILEPATH="$SYSTEM_PYTHON_PATH" \ -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} \ @@ -415,20 +411,21 @@ jobs: cpack -C ${{ env.BUILD_TYPE }} - name: Upload DEB installer - if: contains(matrix.cpack_generators, 'DEB') + # The generators come from the conanfile.py CMakePresets: DEB on Ubuntu, RPM on Red Hat-like + if: startsWith(matrix.platform, 'ubuntu') uses: actions/upload-artifact@v7 with: name: OS-Installers-${{ matrix.platform }}-DEB-${{ github.sha }} path: ${{ env.OPENSTUDIO_BUILD }}/*.deb - if-no-files-found: ignore + if-no-files-found: error - name: Upload RPM installer - if: contains(matrix.cpack_generators, 'RPM') + if: startsWith(matrix.platform, 'centos') uses: actions/upload-artifact@v7 with: name: OS-Installers-${{ matrix.platform }}-RPM-${{ github.sha }} path: ${{ env.OPENSTUDIO_BUILD }}/*.rpm - if-no-files-found: ignore + if-no-files-found: error - name: Upload TGZ installer uses: actions/upload-artifact@v7 @@ -1211,9 +1208,9 @@ jobs: "SYSTEM_PYTHON_PATH=$pythonPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Configure with CMake - working-directory: ${{ env.OPENSTUDIO_BUILD }} + # From the source dir: that's where conan put the CMakeUserPresets.json. The preset brings the toolchain, Ninja, the build type and the CPack generators run: | - & $env:ComSpec /c "call conanbuild.bat && cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} -DBUILD_TESTING:BOOL=ON -DCPACK_GENERATOR:STRING=`"IFW;TGZ`" -DBUILD_PYTHON_BINDINGS:BOOL=ON -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console .." + & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --preset conan-release -DBUILD_TESTING:BOOL=ON -DBUILD_PYTHON_BINDINGS:BOOL=ON -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console" - name: Show restored ccache stats shell: bash diff --git a/conanfile.py b/conanfile.py index 09c9fc6324..fc8599ce9c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -87,13 +87,16 @@ def generate(self): tc.cache_variables["CPACK_BINARY_TGZ"] = True tc.cache_variables["CPACK_BINARY_IFW"] = False tc.cache_variables["CPACK_BINARY_DEB"] = False + tc.cache_variables["CPACK_BINARY_RPM"] = False if self.settings.build_type == "Release": if is_apple_os(self) or self.settings.os == "Windows": tc.cache_variables["CPACK_BINARY_IFW"] = True + elif Path("/etc/redhat-release").exists(): + # Red Hat-like (CentOS, AlmaLinux, ...) + tc.cache_variables["CPACK_BINARY_RPM"] = True else: tc.cache_variables["CPACK_BINARY_DEB"] = True tc.cache_variables["CPACK_BINARY_NSIS"] = False - tc.cache_variables["CPACK_BINARY_RPM"] = False tc.cache_variables["CPACK_BINARY_STGZ"] = False tc.cache_variables["CPACK_BINARY_TBZ2"] = False tc.cache_variables["CPACK_BINARY_TXZ"] = False From 6be4b72cd9180c1eecb7c7b3d0e8c941c716ed90 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 18:17:30 +0100 Subject: [PATCH 27/54] CI: configure all platforms with just the conanfile.py preset Toolchain, Ninja, build type, testing, bindings, Python version/root (from the python running conan) and CPack generators come from the preset; on macOS the libc++ flags come from the tools.build:cxxflags conf and the deployment target from MACOSX_DEPLOYMENT_TARGET. Drop the redundant -D options and the Locate Ruby/Python steps. SYSTEM_RUBY_EXECUTABLE is still passed on macOS/Windows since ruby/test/CMakeLists.txt only searches hardcoded locations (not setup-ruby's toolcache). macOS never passed it before, so the Ruby tests were never created there. --- .github/workflows/full-build.yml | 69 +++++--------------------------- 1 file changed, 11 insertions(+), 58 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index dce98d7c23..c4a418a6d9 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -231,25 +231,10 @@ jobs: config-install: ${{ matrix.platform == 'centos-9-x64' && 'developer/conan/config' || '' }} extra-args: ${{ matrix.platform == 'centos-9-x64' && '-pr:a glibc' || '' }} - - name: Locate Ruby - run: | - ruby_path=$(command -v ruby) - echo "SYSTEM_RUBY_PATH=$ruby_path" >> $GITHUB_ENV - - - name: Locate Python - run: | - python_path=$(command -v python3) - echo "SYSTEM_PYTHON_PATH=$python_path" >> $GITHUB_ENV - - name: Configure with CMake run: | + # Build type, testing, bindings, Python version/root and CPack generators all come from the conanfile.py preset cmake --preset conan-release \ - -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} \ - -DBUILD_TESTING:BOOL=ON \ - -DBUILD_PYTHON_BINDINGS:BOOL=ON \ - -DPython_EXECUTABLE:FILEPATH="$SYSTEM_PYTHON_PATH" \ - -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} \ - -DSYSTEM_RUBY_EXECUTABLE="$SYSTEM_RUBY_PATH" \ -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \ -DCMAKE_JOB_POOL_LINK:STRING=console @@ -685,39 +670,15 @@ jobs: # Same as jmarrec/conan-recipes upload_deps.yml, for the deps that have to be built from source (boost with recent clang) extra-args: -c tools.build:cxxflags="['-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION', '-Wno-enum-constexpr-conversion']" - - name: Locate Ruby - run: | - ruby_path=$(command -v ruby) - echo "SYSTEM_RUBY_PATH=$ruby_path" >> $GITHUB_ENV - - - name: Locate Python - run: | - python_path=$(command -v python3) - echo "SYSTEM_PYTHON_PATH=$python_path" >> $GITHUB_ENV - - name: Configure with CMake - working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | - set -e - chmod +x ./conanbuild.sh - . ./conanbuild.sh - # Signing identity is passed to cpack only when the keychain exists (see Create packages) - cmake -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \ - -DCMAKE_CXX_FLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -Wno-enum-constexpr-conversion" \ - -DENABLE_COVERAGE:BOOL=OFF \ - -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${{ matrix.macos_dev_target }} \ - -DCMAKE_BUILD_TYPE:STRING=${{ env.BUILD_TYPE }} \ - -DBUILD_TESTING:BOOL=ON \ - -DCPACK_BINARY_TGZ:BOOL=ON \ - -DCPACK_BINARY_IFW:BOOL=ON \ - -DBUILD_PYTHON_BINDINGS:BOOL=ON \ - -DBUILD_PYTHON_PIP_PACKAGE:BOOL=OFF \ - -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} \ - -DPython_ROOT_DIR:PATH="$(dirname $(dirname $SYSTEM_PYTHON_PATH))" \ + # Build type, testing, bindings, Python version/root and CPack generators all come from the conanfile.py preset, + # the libc++ CXX flags from the tools.build:cxxflags conf (see Setup Conan), the deployment target from MACOSX_DEPLOYMENT_TARGET. + # ruby/test/CMakeLists.txt only looks in hardcoded locations (NO_DEFAULT_PATH, to avoid the conan ruby), not in setup-ruby's toolcache + cmake --preset conan-release \ + -DSYSTEM_RUBY_EXECUTABLE:FILEPATH="$(command -v ruby)" \ -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \ - -DCMAKE_JOB_POOL_LINK:STRING=console \ - .. + -DCMAKE_JOB_POOL_LINK:STRING=console - name: Show restored ccache stats shell: bash @@ -1197,20 +1158,12 @@ jobs: build-type: ${{ env.BUILD_TYPE }} build-policy: ${{ contains(inputs.conan_build_all, matrix.platform) && '*' || 'missing' }} - - name: Locate Ruby - run: | - $rubyPath = (Get-Command ruby).Source - "SYSTEM_RUBY_PATH=$rubyPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Locate Python - run: | - $pythonPath = (Get-Command python).Source - "SYSTEM_PYTHON_PATH=$pythonPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Configure with CMake - # From the source dir: that's where conan put the CMakeUserPresets.json. The preset brings the toolchain, Ninja, the build type and the CPack generators + # From the source dir: that's where conan put the CMakeUserPresets.json. Toolchain, Ninja, build type, testing, bindings, Python version/root and CPack generators all come from the conanfile.py preset run: | - & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --preset conan-release -DBUILD_TESTING:BOOL=ON -DBUILD_PYTHON_BINDINGS:BOOL=ON -DPython_EXECUTABLE:FILEPATH=`"$env:SYSTEM_PYTHON_PATH`" -DPYTHON_VERSION:STRING=${{ env.PYTHON_REQUIRED_VERSION }} -DSYSTEM_RUBY_EXECUTABLE=`"%SYSTEM_RUBY_PATH%`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console" + # ruby/test/CMakeLists.txt only looks in hardcoded locations (NO_DEFAULT_PATH, to avoid the conan ruby), not in setup-ruby's toolcache + $rubyExe = (Get-Command ruby).Source + & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --preset conan-release -DSYSTEM_RUBY_EXECUTABLE:FILEPATH=`"$rubyExe`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console" - name: Show restored ccache stats shell: bash From 3602d892c823a58aafbe95b36279fd32b436c899 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 18:25:29 +0100 Subject: [PATCH 28/54] CI: only sign and publish on NatLabRockies/OpenStudio On forks, develop pushes ran the code signing, keychain and S3/docker publish steps without the secrets and failed. Add a repository check to each of those conditions. Also limit macOS Setup Keychain to develop/master/v* tags like the apple-signing environment: the Apple secrets only exist there, so publish_to_s3 dispatches from other branches failed instead of publishing an unsigned DMG --- .github/workflows/full-build.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index c4a418a6d9..f5b297e9eb 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -434,7 +434,7 @@ jobs: name: Publish Linux Artifacts needs: [linux-build] runs-on: ubuntu-latest - if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true' + if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') steps: - name: Download all installers uses: actions/download-artifact@v8 @@ -543,7 +543,7 @@ jobs: if: (!inputs.jobs || contains(inputs.jobs, 'macos-build')) # Apple signing secrets live in the apple-signing environment, which only these refs may use. # Other refs (PRs, feature branches) get no environment and fall back to ad-hoc signing. - environment: ${{ (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) && 'apple-signing' || '' }} + environment: ${{ github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) && 'apple-signing' || '' }} runs-on: ${{ matrix.os }} timeout-minutes: 720 continue-on-error: ${{ matrix.allow_failure }} @@ -791,8 +791,9 @@ jobs: echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT - name: Setup Keychain - # Same refs as macos-publish, so everything published to S3 is signed - if: success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') + # Same refs as the job's environment: the Apple secrets are apple-signing environment secrets, which can only deploy to develop/master/v* tags. + # So a publish_to_s3 dispatch from another branch publishes an unsigned DMG instead of failing here. + if: success() && github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) env: APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }} APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }} @@ -1019,7 +1020,7 @@ jobs: name: Publish MacOS Artifacts needs: [macos-build] runs-on: ubuntu-latest - if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true' + if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') steps: - name: Download all installers uses: actions/download-artifact@v8 @@ -1323,21 +1324,21 @@ jobs: # CODE SIGNING SETUP - name: Setup Node.js - if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true' + if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') uses: actions/setup-node@v7 with: node-version: "18" - name: Create .env file for Signing - if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true' + if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | echo "ACCESS_KEY=${{ secrets.AWS_SIGNING_ACCESS_KEY }}" >> .env echo "SECRET_KEY=${{ secrets.AWS_SIGNING_SECRET_KEY }}" >> .env - name: Code sign binaries - if: success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') + if: success() && github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') # Caps a hung signing service; Invoke-SigningWithRetry.ps1 sizes its 3 attempts to fit inside this timeout-minutes: 60 working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -1402,7 +1403,7 @@ jobs: & $env:ComSpec /c "call conanbuild.bat && cpack -C ${{ env.BUILD_TYPE }}" - name: Code sign installer - if: success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') + if: success() && github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') # Caps a hung signing service; Invoke-SigningWithRetry.ps1 sizes its 3 attempts to fit inside this timeout-minutes: 60 working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -1495,7 +1496,7 @@ jobs: name: Publish Windows Artifacts needs: [windows-build] runs-on: ubuntu-latest - if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true' + if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') steps: - name: Download all installers uses: actions/download-artifact@v8 From f23fa7101807165647b38c66fd7d6f3fdbb6e370 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 18:47:30 +0100 Subject: [PATCH 29/54] setup-conan: edit the default profile from its own folder sed -i writes its temp file in the current dir; on Windows the workspace (D:) and the Conan home (C:) are on different drives so the rename failed with "Invalid cross-device link" --- .github/actions/setup-conan/action.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup-conan/action.yml b/.github/actions/setup-conan/action.yml index cdab9da57c..a507e974a6 100644 --- a/.github/actions/setup-conan/action.yml +++ b/.github/actions/setup-conan/action.yml @@ -63,13 +63,18 @@ runs: # Same default profile as jmarrec/conan-recipes upload_deps.yml, so the package IDs match what's on nrel-v2. # It's used for both the host and build contexts. conan profile detect --force --name default - CONAN_PROFILE_DEFAULT=$(conan profile path default) - # Mac has the BSD flavor of sed and MUST take a backup suffix - sed -i.bak 's/cppstd=.*$/cppstd=20/g' "$CONAN_PROFILE_DEFAULT" - sed -i.bak 's/build_type=.*$/build_type=${{ inputs.build-type }}/g' "$CONAN_PROFILE_DEFAULT" - # Windows only - sed -i.bak 's/compiler.runtime_type=.*$/compiler.runtime_type=${{ inputs.build-type }}/g' "$CONAN_PROFILE_DEFAULT" - rm -f "$CONAN_PROFILE_DEFAULT.bak" + CONAN_PROFILES_DIR=$(dirname "$(conan profile path default)") + # On Windows, sed -i creates its temp file in the current directory (D: workspace) and fails to move it to the + # Conan home (C:): "Invalid cross-device link". So run the edits from the profiles directory, in a subshell. + ( + cd "$CONAN_PROFILES_DIR" + # Mac has the BSD flavor of sed and MUST take a backup suffix + sed -i.bak 's/cppstd=.*$/cppstd=20/g' default + sed -i.bak 's/build_type=.*$/build_type=${{ inputs.build-type }}/g' default + # Windows only + sed -i.bak 's/compiler.runtime_type=.*$/compiler.runtime_type=${{ inputs.build-type }}/g' default + rm -f default.bak + ) conan profile show echo "::endgroup::" From fcdb97376c9616ecde5a0ea2ba969de81b60b0cd Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 25 Nov 2026 18:50:53 +0100 Subject: [PATCH 30/54] CI: install ccache before restoring its cache on macOS/Windows --- .github/workflows/full-build.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index f5b297e9eb..8b4cdc2a19 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -607,6 +607,14 @@ jobs: - name: Git safe directory run: git config --global --add safe.directory '*' + - name: Install System dependencies + shell: bash + run: | + # The MACOSX_DEPLOYMENT_TARGET environment variable sets the default value for the CMAKE_OSX_DEPLOYMENT_TARGET variable. + # We use cmake commands to build some subprojects, so setting it globally + echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_dev_target }} >> $GITHUB_ENV + brew install ninja ccache + - name: Get base branch SHA if: github.event_name == 'pull_request' run: | @@ -649,14 +657,6 @@ jobs: ./installerbase --version echo "$(pwd)" >> $GITHUB_PATH - - name: Install System dependencies - shell: bash - run: | - # The MACOSX_DEPLOYMENT_TARGET environment variable sets the default value for the CMAKE_OSX_DEPLOYMENT_TARGET variable. - # We use cmake commands to build some subprojects, so setting it globally - echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_dev_target }} >> $GITHUB_ENV - brew install ninja ccache - - name: Create Build Directory run: cmake -E make_directory ${{ env.OPENSTUDIO_BUILD }} @@ -1103,6 +1103,10 @@ jobs: if ($LASTEXITCODE) { exit 1 } ./.github/signing-client/Test-AssertAuthenticodeSigned.ps1 + - name: Install ccache + # Not sccache: it refuses to cache MSVC compiles using PCH (/Yc, /Fp), i.e. ~95% of them + run: choco install ccache -y --no-progress + - name: Get base branch SHA if: github.event_name == 'pull_request' shell: bash @@ -1125,10 +1129,6 @@ jobs: run: | New-Item -ItemType Directory -Path "${{ env.OPENSTUDIO_BUILD }}" -Force - - name: Install ccache - # Not sccache: it refuses to cache MSVC compiles using PCH (/Yc, /Fp), i.e. ~95% of them - run: choco install ccache -y --no-progress - - name: Set up Python 3.12.2 uses: actions/setup-python@v7 with: From 1b61363986027f0fa6c1ed350e8025a5f9d4f7cc Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 06:24:08 +0100 Subject: [PATCH 31/54] CI: include .ninja_log in the build-diag artifacts, show C: and D: usage in GB on Windows --- .github/workflows/full-build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 8b4cdc2a19..a44e82c7b7 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -287,6 +287,8 @@ jobs: ${{ env.OPENSTUDIO_BUILD }}/.ninja_log ${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake if-no-files-found: warn + # .ninja_log is a hidden file, skipped by default + include-hidden-files: true - name: Run CTest suite id: ctest @@ -730,6 +732,8 @@ jobs: ${{ env.OPENSTUDIO_BUILD }}/.ninja_log ${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake if-no-files-found: warn + # .ninja_log is a hidden file, skipped by default + include-hidden-files: true - name: Run CTest suite id: mac_ctest @@ -1091,7 +1095,8 @@ jobs: - name: Verify space run: | - Get-PSDrive C | Select-Object Used,Free + # Workspace, build and ccache are on D:, the Conan home on C: + Get-PSDrive C, D | Select-Object Name, @{n='UsedGB';e={[math]::Round($_.Used/1GB,1)}}, @{n='FreeGB';e={[math]::Round($_.Free/1GB,1)}} Get-CimInstance Win32_OperatingSystem | Select-Object TotalVisibleMemorySize,FreePhysicalMemory,TotalVirtualMemorySize,FreeVirtualMemory - name: Git safe directory @@ -1209,6 +1214,8 @@ jobs: ${{ env.OPENSTUDIO_BUILD }}/.ninja_log ${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake if-no-files-found: warn + # .ninja_log is a hidden file, skipped by default + include-hidden-files: true - name: Run CTest suite id: ctest From 4bfc70f973f35c1e88d4c4e5503c98412e5c55fb Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 07:46:36 +0100 Subject: [PATCH 32/54] Move the build SHA out of OpenStudio.hxx so a new commit doesn't invalidate ccache for its ~30 includers and every SWIG module --- CMakeLists.txt | 1 + OpenStudio.cxx.in | 14 ++++++++++++++ OpenStudio.hxx.in | 12 ++++++------ src/utilities/CMakeLists.txt | 1 + 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 OpenStudio.cxx.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9080375823..9b8cf6be7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,6 +216,7 @@ set(RADIANCE_VERSION "5.0.a.12") # configure file with version information configure_file(${PROJECT_SOURCE_DIR}/OpenStudio.hxx.in ${PROJECT_BINARY_DIR}/src/OpenStudio.hxx) +configure_file(${PROJECT_SOURCE_DIR}/OpenStudio.cxx.in ${PROJECT_BINARY_DIR}/src/OpenStudio.cxx) # Deployment target if(APPLE) diff --git a/OpenStudio.cxx.in b/OpenStudio.cxx.in new file mode 100644 index 0000000000..51d50c6398 --- /dev/null +++ b/OpenStudio.cxx.in @@ -0,0 +1,14 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. +* See also https://openstudio.net/license +***********************************************************************************************************************/ + +#include + +std::string openStudioLongVersion() { + return "${OPENSTUDIO_LONG_VERSION}"; +} + +std::string openStudioVersionBuildSHA() { + return "${PROJECT_VERSION_BUILD}"; +} diff --git a/OpenStudio.hxx.in b/OpenStudio.hxx.in index 41fbd08289..3b34574a10 100644 --- a/OpenStudio.hxx.in +++ b/OpenStudio.hxx.in @@ -9,6 +9,8 @@ #include #include +#include + // Support for Ninja on Windows (Ninja isn't multi-configuration while MSVC is) #cmakedefine NINJA @@ -18,9 +20,9 @@ inline std::string openStudioVersion() { } // Includes prerelease tag if any, and build sha, eg: '3.0.0-rc1+baflkdhsia' -inline std::string openStudioLongVersion() { - return "${OPENSTUDIO_LONG_VERSION}"; -} +// The functions that return the build sha are defined in OpenStudio.cxx, so a new commit doesn't change this header +// (included by many files and parsed by SWIG for every module) and only that one file needs to be rebuilt +UTILITIES_API std::string openStudioLongVersion(); inline std::string openStudioVersionMajor() { return "${PROJECT_VERSION_MAJOR}"; @@ -38,9 +40,7 @@ inline std::string openStudioVersionPrerelease() { return "${PROJECT_VERSION_PRERELEASE}"; } -inline std::string openStudioVersionBuildSHA() { - return "${PROJECT_VERSION_BUILD}"; -} +UTILITIES_API std::string openStudioVersionBuildSHA(); inline int energyPlusVersionMajor() { return ${ENERGYPLUS_VERSION_MAJOR}; diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt index 7a96c66cea..4c1bf276aa 100644 --- a/src/utilities/CMakeLists.txt +++ b/src/utilities/CMakeLists.txt @@ -11,6 +11,7 @@ include(xml/CMakeLists.txt) CONFIGURE_FILE_WITH_CHECKSUM("core/ApplicationPathHelpers.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/core/ApplicationPathHelpers.cxx") set(core_src + ${PROJECT_BINARY_DIR}/src/OpenStudio.cxx core/ApplicationPathHelpers.hpp ${CMAKE_CURRENT_BINARY_DIR}/core/ApplicationPathHelpers.cxx core/Assert.hpp From 4636082801890d361c7b58998222dd84cf7e8b57 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 08:42:03 +0100 Subject: [PATCH 33/54] CI: skip the CTest steps when the commit message contains [skip tests] --- .github/workflows/full-build.yml | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index a44e82c7b7..37283e80b8 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -87,6 +87,8 @@ env: # mtime-based compiler check is unreliable across fresh runner VMs, where the compiler binary's mtime can differ even though its content doesn't CCACHE_COMPILERCHECK: content ENABLE_PCH: ON + # Put [skip tests] in the commit message to skip the CTest steps (only on push: always false on pull requests) + SKIP_TESTS: ${{ contains(github.event.head_commit.message, '[skip tests]') }} jobs: linux-build: @@ -291,6 +293,7 @@ jobs: include-hidden-files: true - name: Run CTest suite + if: env.SKIP_TESTS != 'true' id: ctest continue-on-error: true working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -350,7 +353,7 @@ jobs: echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT - name: Copy Testing tree with suffix - if: always() + if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | if [ -d "Testing" ]; then @@ -358,7 +361,7 @@ jobs: fi - name: Generate test summary - if: always() + if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | @@ -382,7 +385,7 @@ jobs: continue-on-error: true - name: Upload Testing artifact - if: always() + if: always() && env.SKIP_TESTS != 'true' uses: actions/upload-artifact@v7 with: name: Testing-${{ matrix.platform }}-${{ github.sha }} @@ -422,7 +425,7 @@ jobs: if-no-files-found: ignore - name: Fail job on test failures - if: ${{ steps.ctest.outputs.exit_code != '0' }} + if: env.SKIP_TESTS != 'true' && steps.ctest.outputs.exit_code != '0' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true @@ -736,6 +739,7 @@ jobs: include-hidden-files: true - name: Run CTest suite + if: env.SKIP_TESTS != 'true' id: mac_ctest working-directory: ${{ env.OPENSTUDIO_BUILD }} shell: bash @@ -941,7 +945,7 @@ jobs: fi - name: Copy Testing tree with suffix - if: always() + if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | if [ -d "Testing" ]; then @@ -949,7 +953,7 @@ jobs: fi - name: Generate test summary - if: always() + if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | @@ -973,7 +977,7 @@ jobs: continue-on-error: true - name: Upload Testing artifact - if: always() + if: always() && env.SKIP_TESTS != 'true' uses: actions/upload-artifact@v7 with: name: Testing-${{ matrix.platform }}-${{ github.sha }} @@ -1010,7 +1014,7 @@ jobs: if-no-files-found: ignore - name: Fail job on test failures - if: ${{ steps.mac_ctest.outputs.exit_code != '0' }} + if: env.SKIP_TESTS != 'true' && steps.mac_ctest.outputs.exit_code != '0' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true @@ -1218,6 +1222,7 @@ jobs: include-hidden-files: true - name: Run CTest suite + if: env.SKIP_TESTS != 'true' id: ctest continue-on-error: true working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -1289,7 +1294,7 @@ jobs: "exit_code=$overall_exit_code" | Out-File -FilePath $env:GITHUB_OUTPUT -Append - name: Copy Testing tree with suffix - if: always() + if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | if (Test-Path "Testing") { @@ -1297,7 +1302,7 @@ jobs: } - name: Generate test summary - if: always() + if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | $dashboardPath = "${{ env.TEST_DASHBOARD_RELATIVE }}" @@ -1321,7 +1326,7 @@ jobs: continue-on-error: true - name: Upload Testing artifact - if: always() + if: always() && env.SKIP_TESTS != 'true' uses: actions/upload-artifact@v7 with: name: Testing-${{ matrix.platform }}-${{ github.sha }} @@ -1489,7 +1494,7 @@ jobs: if-no-files-found: ignore - name: Fail job on test failures - if: ${{ steps.ctest.outputs.exit_code != '0' }} + if: env.SKIP_TESTS != 'true' && steps.ctest.outputs.exit_code != '0' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | Get-Content "${{ env.TEST_DASHBOARD_RELATIVE }}" -ErrorAction SilentlyContinue From d3f5c3ebbe8aadd9631f8d2dd6bb0002ebe221ef Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 09:01:44 +0100 Subject: [PATCH 34/54] CI: set NINJA_STATUS once for all platforms (and add percentage), fix 'sort: Broken pipe' in the macOS build heartbeat --- .github/workflows/full-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 37283e80b8..48657d023c 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -87,6 +87,7 @@ env: # mtime-based compiler check is unreliable across fresh runner VMs, where the compiler binary's mtime can differ even though its content doesn't CCACHE_COMPILERCHECK: content ENABLE_PCH: ON + NINJA_STATUS: "[%p][%f/%t | %es elapsed | %o objs/sec] " # Put [skip tests] in the commit message to skip the CTest steps (only on push: always false on pull requests) SKIP_TESTS: ${{ contains(github.event.head_commit.message, '[skip tests]') }} @@ -252,7 +253,6 @@ jobs: working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | . ./conanbuild.sh - export NINJA_STATUS="[%f/%t | %es elapsed | %o objs/sec]" # Start resource monitor (records RSS samples for later summary) echo "timestamp PID RSS_KB COMM" > mem_samples.log ( while true; do @@ -697,13 +697,13 @@ jobs: working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | . ./conanbuild.sh - export NINJA_STATUS="[%f/%t | %es elapsed | %o objs/sec]" while true; do sleep 300 echo "[heartbeat] $(date -u +"%H:%M:%S")" if command -v top >/dev/null 2>&1; then top -l 1 -s 0 | grep PhysMem || true; fi df -h . | tail -1 | awk '{print "[disk] used=" $3 "/" $2 " (" $5 ")"}' - if command -v ps >/dev/null 2>&1; then ps -eo pid,pmem,rss,comm | sort -rn -k2 | head -n 5; fi + # BSD ps -m sorts by memory: no sort, which printed 'Broken pipe' when head closed the pipe + if command -v ps >/dev/null 2>&1; then ps -m -eo pid,pmem,rss,comm | head -n 6; fi done & heartbeat_pid=$! cmake --build . --parallel ${MAX_BUILD_THREADS} 2>&1 | tee build.log From 79b5915068e02558e7e2611958c02d6d1fd43247 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 09:59:11 +0100 Subject: [PATCH 35/54] Add embedded_files targets, to generate just the embedded files (all of them, or one embed_files() call's) CMake Configure: 37.0s time ninja embedded_files: 48s --- CMakeLists.txt | 2 ++ embedded/EmbedFiles.cmake | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b8cf6be7e..5f48af1f54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1069,6 +1069,8 @@ else() endif() include("embedded/EmbedFiles.cmake") +# Each embed_files() call adds its own embedded_files_ target as a dependency of this one +add_custom_target(embedded_files) add_subdirectory("embedded") if(BUILD_PAT) add_subdirectory("pat") diff --git a/embedded/EmbedFiles.cmake b/embedded/EmbedFiles.cmake index 4fed64f5b9..7f41345498 100644 --- a/embedded/EmbedFiles.cmake +++ b/embedded/EmbedFiles.cmake @@ -143,6 +143,12 @@ function(embed_files FILES EMBEDDED_LOCATIONS CXX_OUTPUT_FILES) set_source_files_properties(${EMBED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) + # Named targets to generate just the embedded files: eg 'ninja embedded_files' (all of them), or 'ninja embedded_files_src_utilities' + file(RELATIVE_PATH EMBED_TARGET_DIR "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") + string(MAKE_C_IDENTIFIER "embedded_files_${EMBED_TARGET_DIR}" EMBED_TARGET) + add_custom_target(${EMBED_TARGET} DEPENDS ${EMBED_SOURCE_FILES}) + add_dependencies(embedded_files ${EMBED_TARGET}) + if( NAMESPACE ) set(BEGIN_NAMESPACE "namespace ${NAMESPACE} {") set(END_NAMESPACE "}") From 7cc4c827792229e503d5958727b6bd1d83906410 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 09:37:30 +0100 Subject: [PATCH 36/54] Generate the embedded files with one command (parallel threads) per embed_files() call instead of one per file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CreateEmbeddedSource now takes a list file (one "\t\t\t" line per file) and processes all of them on all cores. embed_files() writes that list (only when its content changes, so re-running CMake doesn't regenerate everything) and adds a single custom command per call. - About 6600 build steps become 6 (a full build goes from ~9600 to ~2900 steps), so ninja's progress percentage and ETA reflect the real work instead of being dominated by thousands of tiny steps - About 13000 process launches fewer (CreateEmbeddedSource plus a cmake -E make_directory per file), which is slow, especially on Windows - The tool creates the output directories itself - Output is byte-identical to the previous per-file generation (checked on all 6597 files) - Changing one embedded file regenerates all the files of its embed_files() call, but they're all included in the same embedded_files.cxx, which had to be recompiled anyway. Also, worse case is a few seconds for the worst (ruby), About 2.2–2.5 s for all 6379 files on 16 cores locally. --- embedded/CreateEmbeddedSource.cpp | 88 +++++++++++++++++++++++++++---- embedded/EmbedFiles.cmake | 33 ++++++++---- 2 files changed, 100 insertions(+), 21 deletions(-) diff --git a/embedded/CreateEmbeddedSource.cpp b/embedded/CreateEmbeddedSource.cpp index 86be69accb..79978b1fd1 100644 --- a/embedded/CreateEmbeddedSource.cpp +++ b/embedded/CreateEmbeddedSource.cpp @@ -3,9 +3,14 @@ * See also https://openstudio.net/license ***********************************************************************************************************************/ -#include +#include +#include +#include #include #include +#include +#include +#include #include #include @@ -21,15 +26,22 @@ #define CHUNK 16384 -int main(int argc, char* argv[]) { - if (argc != 5) { - return 1; - } +struct EmbeddedFile +{ + std::string infile; + std::string outfile; + std::string filenum; + std::string embeddedname; +}; + +static int embedFile(const EmbeddedFile& file) { + const auto* infile = file.infile.c_str(); + const auto* outfile = file.outfile.c_str(); + const auto* filenum = file.filenum.c_str(); + const auto* embeddedname = file.embeddedname.c_str(); - const auto* infile = argv[1]; - auto* outfile = argv[2]; - const auto* filenum = argv[3]; - const auto* embeddedname = argv[4]; + std::error_code ec; + std::filesystem::create_directories(std::filesystem::path(file.outfile).parent_path(), ec); z_stream strm; unsigned char in[CHUNK]; @@ -44,7 +56,7 @@ int main(int argc, char* argv[]) { FILE* source = fopen(infile, "rb"); if (source == NULL) { - fputs("File error", stderr); + std::cerr << "Could not open '" << infile << "' for reading" << std::endl; return EXIT_FAILURE; } @@ -107,3 +119,59 @@ int main(int argc, char* argv[]) { return 0; } + +// Usage: CreateEmbeddedSource +// Each line of the list file is: \t\t\t +// All files are processed in one go (on all cores), rather than one process per file +int main(int argc, char* argv[]) { + if (argc != 2) { + std::cerr << "Usage: " << argv[0] << " " << std::endl; + return EXIT_FAILURE; + } + + std::ifstream list(argv[1]); + if (!list.is_open()) { + std::cerr << "Could not open '" << argv[1] << "' for reading" << std::endl; + return EXIT_FAILURE; + } + + std::vector files; + std::string line; + while (std::getline(list, line)) { + if (line.empty()) { + continue; + } + EmbeddedFile file; + size_t start = 0; + for (auto* field : {&file.infile, &file.outfile, &file.filenum}) { + const size_t tab = line.find('\t', start); + if (tab == std::string::npos) { + std::cerr << "Malformed line in '" << argv[1] << "': " << line << std::endl; + return EXIT_FAILURE; + } + *field = line.substr(start, tab - start); + start = tab + 1; + } + file.embeddedname = line.substr(start); + files.push_back(std::move(file)); + } + + std::atomic next{0}; + std::atomic failed{false}; + const unsigned nThreads = std::max(1U, std::thread::hardware_concurrency()); + std::vector threads; + for (unsigned t = 0; t < nThreads; ++t) { + threads.emplace_back([&]() { + for (size_t i = next++; i < files.size(); i = next++) { + if (embedFile(files[i]) != 0) { + failed = true; + } + } + }); + } + for (auto& thread : threads) { + thread.join(); + } + + return failed ? EXIT_FAILURE : 0; +} diff --git a/embedded/EmbedFiles.cmake b/embedded/EmbedFiles.cmake index 7f41345498..3c72bed6ae 100644 --- a/embedded/EmbedFiles.cmake +++ b/embedded/EmbedFiles.cmake @@ -6,7 +6,7 @@ This module defines functions to embed some files as binary into the executable. .. command:: embed_files - This is the command responsible for calling CreateEmbeddedSource:: + This is the command responsible for calling CreateEmbeddedSource (once, for all the files):: embed_files( ) @@ -86,7 +86,6 @@ function(embed_files FILES EMBEDDED_LOCATIONS CXX_OUTPUT_FILES) # EMBED_SOURCE_FILE is the fully qualified path to a cxx file with the embedded data set(EMBED_SOURCE_FILE "${CMAKE_CURRENT_BINARY_DIR}/embedded_files/${BASE_PATH}/${BASE_FILENAME}${EXTENSION}.cxx") - set(EMBED_SOURCE_PATH "${CMAKE_CURRENT_BINARY_DIR}/embedded_files/${BASE_PATH}") file(RELATIVE_PATH EMBED_SOURCE_FILE_REL_PATH ${PROJECT_BINARY_DIR} ${EMBED_SOURCE_FILE}) list(APPEND EMBED_SOURCE_FILES ${EMBED_SOURCE_FILE}) @@ -101,19 +100,31 @@ function(embed_files FILES EMBEDDED_LOCATIONS CXX_OUTPUT_FILES) set( EMBEDDED_LOCATION ":/${EMBEDDED_LOCATION}" ) endif() - add_custom_command(OUTPUT ${EMBED_SOURCE_FILE} - COMMAND ${CMAKE_COMMAND} -E make_directory ${EMBED_SOURCE_PATH} - COMMAND CreateEmbeddedSource - ${FILE} - ${EMBED_SOURCE_FILE} - ${i} - ${EMBEDDED_LOCATION} - DEPENDS ${FILE} - ) + # One line per file for CreateEmbeddedSource: \t\t\t + string(APPEND EMBED_LIST_CONTENT "${FILE}\t${EMBED_SOURCE_FILE}\t${i}\t${EMBEDDED_LOCATION}\n") set(EMBEDDED_FILE_INCLUDES "${EMBEDDED_FILE_INCLUDES}#include <${EMBED_SOURCE_FILE_REL_PATH}>\n") endforeach() + # A single command generates all the files (CreateEmbeddedSource uses all cores), rather than one command per file: + # thousands fewer build steps and processes. Changing one file regenerates all of them, but they're all included + # in the same embedded_files.cxx, which has to be recompiled anyway. + # Only rewrite the list when it changes, so that re-running CMake doesn't regenerate everything + set(EMBED_LIST_FILE "${CMAKE_CURRENT_BINARY_DIR}/embedded_files.list") + set(EXISTING_EMBED_LIST_CONTENT "") + if(EXISTS "${EMBED_LIST_FILE}") + file(READ "${EMBED_LIST_FILE}" EXISTING_EMBED_LIST_CONTENT) + endif() + if(NOT EMBED_LIST_CONTENT STREQUAL EXISTING_EMBED_LIST_CONTENT) + file(WRITE "${EMBED_LIST_FILE}" "${EMBED_LIST_CONTENT}") + endif() + + add_custom_command(OUTPUT ${EMBED_SOURCE_FILES} + COMMAND CreateEmbeddedSource "${EMBED_LIST_FILE}" + DEPENDS ${FILES} "${EMBED_LIST_FILE}" + COMMENT "Generating ${NUMFILES} embedded files in ${CMAKE_CURRENT_BINARY_DIR}/embedded_files" + ) + # file names foreach (arg RANGE ${END}) set(EMBEDDED_FILE_NAMES "${EMBEDDED_FILE_NAMES} embedded_file_name_${arg}") From b6d6ec3b16f47201280100e75fac9a0b23525e9a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 09:49:02 +0100 Subject: [PATCH 37/54] Speed up cmake configure by 3x: embed_files(): iterate with ZIP_LISTS instead of list(GET) by index list(GET ... ${i}) re-parses the whole list on every iteration, which made embed_files() quadratic in the number of files: ~33 s at every CMake configure for the 6379 ruby engine files (on Linux, worse on Windows). It now takes ~2.8 s, with identical output --- embedded/EmbedFiles.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/embedded/EmbedFiles.cmake b/embedded/EmbedFiles.cmake index 3c72bed6ae..7c415b96f7 100644 --- a/embedded/EmbedFiles.cmake +++ b/embedded/EmbedFiles.cmake @@ -72,9 +72,10 @@ function(embed_files FILES EMBEDDED_LOCATIONS CXX_OUTPUT_FILES) math(EXPR END "${FILES_LENGTH} - 1") set(NUMFILES ${FILES_LENGTH}) - foreach(i RANGE ${END}) - list(GET FILES ${i} FILE) - list(GET EMBEDDED_LOCATIONS ${i} EMBEDDED_LOCATION) + # ZIP_LISTS rather than list(GET ... ${i}), which re-parses the whole list every time: that was taking ~30s for the 6000+ ruby files + set(i -1) + foreach(FILE EMBEDDED_LOCATION IN ZIP_LISTS FILES EMBEDDED_LOCATIONS) + math(EXPR i "${i} + 1") get_filename_component(BASE_PATH ${EMBEDDED_LOCATION} DIRECTORY) get_filename_component(BASE_FILENAME ${EMBEDDED_LOCATION} NAME_WE) @@ -103,7 +104,7 @@ function(embed_files FILES EMBEDDED_LOCATIONS CXX_OUTPUT_FILES) # One line per file for CreateEmbeddedSource: \t\t\t string(APPEND EMBED_LIST_CONTENT "${FILE}\t${EMBED_SOURCE_FILE}\t${i}\t${EMBEDDED_LOCATION}\n") - set(EMBEDDED_FILE_INCLUDES "${EMBEDDED_FILE_INCLUDES}#include <${EMBED_SOURCE_FILE_REL_PATH}>\n") + string(APPEND EMBEDDED_FILE_INCLUDES "#include <${EMBED_SOURCE_FILE_REL_PATH}>\n") endforeach() # A single command generates all the files (CreateEmbeddedSource uses all cores), rather than one command per file: From ce6039ad1993221aaa0c2d58130e00653232caf2 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 09:52:36 +0100 Subject: [PATCH 38/54] embed_files(): drop the file index from the list, CreateEmbeddedSource uses the line number instead Original was 38s for CMake configure, previous commit was 11s, now it's down to 10s CMake Configure: 37.0s -> 10.1s time ninja embedded_files: 48s -> 2.9s --- embedded/CreateEmbeddedSource.cpp | 5 +++-- embedded/EmbedFiles.cmake | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/embedded/CreateEmbeddedSource.cpp b/embedded/CreateEmbeddedSource.cpp index 79978b1fd1..df7beca4d8 100644 --- a/embedded/CreateEmbeddedSource.cpp +++ b/embedded/CreateEmbeddedSource.cpp @@ -121,7 +121,7 @@ static int embedFile(const EmbeddedFile& file) { } // Usage: CreateEmbeddedSource -// Each line of the list file is: \t\t\t +// Each line of the list file is: \t\t, the line index is the file number // All files are processed in one go (on all cores), rather than one process per file int main(int argc, char* argv[]) { if (argc != 2) { @@ -143,7 +143,7 @@ int main(int argc, char* argv[]) { } EmbeddedFile file; size_t start = 0; - for (auto* field : {&file.infile, &file.outfile, &file.filenum}) { + for (auto* field : {&file.infile, &file.outfile}) { const size_t tab = line.find('\t', start); if (tab == std::string::npos) { std::cerr << "Malformed line in '" << argv[1] << "': " << line << std::endl; @@ -153,6 +153,7 @@ int main(int argc, char* argv[]) { start = tab + 1; } file.embeddedname = line.substr(start); + file.filenum = std::to_string(files.size()); files.push_back(std::move(file)); } diff --git a/embedded/EmbedFiles.cmake b/embedded/EmbedFiles.cmake index 7c415b96f7..7ca5be1106 100644 --- a/embedded/EmbedFiles.cmake +++ b/embedded/EmbedFiles.cmake @@ -73,9 +73,7 @@ function(embed_files FILES EMBEDDED_LOCATIONS CXX_OUTPUT_FILES) set(NUMFILES ${FILES_LENGTH}) # ZIP_LISTS rather than list(GET ... ${i}), which re-parses the whole list every time: that was taking ~30s for the 6000+ ruby files - set(i -1) foreach(FILE EMBEDDED_LOCATION IN ZIP_LISTS FILES EMBEDDED_LOCATIONS) - math(EXPR i "${i} + 1") get_filename_component(BASE_PATH ${EMBEDDED_LOCATION} DIRECTORY) get_filename_component(BASE_FILENAME ${EMBEDDED_LOCATION} NAME_WE) @@ -101,8 +99,8 @@ function(embed_files FILES EMBEDDED_LOCATIONS CXX_OUTPUT_FILES) set( EMBEDDED_LOCATION ":/${EMBEDDED_LOCATION}" ) endif() - # One line per file for CreateEmbeddedSource: \t\t\t - string(APPEND EMBED_LIST_CONTENT "${FILE}\t${EMBED_SOURCE_FILE}\t${i}\t${EMBEDDED_LOCATION}\n") + # One line per file for CreateEmbeddedSource: \t\t. The line index is the file number + string(APPEND EMBED_LIST_CONTENT "${FILE}\t${EMBED_SOURCE_FILE}\t${EMBEDDED_LOCATION}\n") string(APPEND EMBEDDED_FILE_INCLUDES "#include <${EMBED_SOURCE_FILE_REL_PATH}>\n") endforeach() From a033033ca8b9557b30aacdaeea87d0f624849725 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 11:48:25 +0100 Subject: [PATCH 39/54] Tests that copy external files: use a directory unique to each test, so they can run in parallel CI: run all tests in parallel, the "sequential" ModelFixture tests no longer clash --- .github/workflows/full-build.yml | 89 ++----------------- .../Test/PythonPluginInstance_GTest.cpp | 3 + .../test/ChillerElectricASHRAE205_GTest.cpp | 11 +-- src/model/test/ModelFixture.cpp | 8 ++ src/model/test/ModelFixture.hpp | 4 + src/model/test/PythonPluginInstance_GTest.cpp | 3 + src/model/test/ScheduleInterval_GTest.cpp | 2 + 7 files changed, 29 insertions(+), 91 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 48657d023c..afe7a35a2c 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -307,38 +307,12 @@ jobs: . ./conanbuild.sh - # Conflicting tests that must run sequentially - resource_locked_tests=( - ModelFixture.ScheduleFile - ModelFixture.ScheduleFileAltCtor - ModelFixture.PythonPluginInstance - ModelFixture.PythonPluginInstance_NotPYFile - ModelFixture.PythonPluginInstance_ClassNameValidation - ModelFixture.ChillerElectricASHRAE205_GettersSetters - ModelFixture.ChillerElectricASHRAE205_Loops - ModelFixture.ChillerElectricASHRAE205_NotCBORFile - ModelFixture.ChillerElectricASHRAE205_Clone - ) - resource_locked_pattern=$(IFS='|'; echo "${resource_locked_tests[*]}") - ctest_command=(ctest -C ${{ env.BUILD_TYPE }} -T test --no-compress-output) - seq_exclude_args=() if [ -n "$exclude_pattern" ]; then - seq_exclude_args=(-E "^($exclude_pattern)$") - final_exclude="$exclude_pattern|$resource_locked_pattern" - else - final_exclude="$resource_locked_pattern" + ctest_command+=(-E "^($exclude_pattern)$") fi - begin_group "Running sequential tests..." - echo "Running: ${ctest_command[@]} ${seq_exclude_args[@]} -R '^($resource_locked_pattern)$' -j 1" - "${ctest_command[@]}" "${seq_exclude_args[@]}" -R "^($resource_locked_pattern)$" -j 1 || overall_exit_code=$? - echo "::endgroup::" - - - ctest_command+=(-E "^($final_exclude)$") - - begin_group "Running all other tests in parallel..." + begin_group "Running tests..." echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }}" "${ctest_command[@]}" -j ${{ matrix.max_jobs }} || overall_exit_code=$? echo "::endgroup::" @@ -754,37 +728,12 @@ jobs: export CTEST_OUTPUT_ON_FAILURE=1 exclude_pattern="${{ matrix.exclude_regex }}" - # Conflicting tests that must run sequentially - resource_locked_tests=( - ModelFixture.ScheduleFile - ModelFixture.ScheduleFileAltCtor - ModelFixture.PythonPluginInstance - ModelFixture.PythonPluginInstance_NotPYFile - ModelFixture.PythonPluginInstance_ClassNameValidation - ModelFixture.ChillerElectricASHRAE205_GettersSetters - ModelFixture.ChillerElectricASHRAE205_Loops - ModelFixture.ChillerElectricASHRAE205_NotCBORFile - ModelFixture.ChillerElectricASHRAE205_Clone - ) - resource_locked_pattern=$(IFS='|'; echo "${resource_locked_tests[*]}") - ctest_command=(ctest -C ${{ env.BUILD_TYPE }} -T test --no-compress-output) - seq_exclude_args=() if [ -n "$exclude_pattern" ]; then - seq_exclude_args=(-E "^($exclude_pattern)$") - final_exclude="$exclude_pattern|$resource_locked_pattern" - else - final_exclude="$resource_locked_pattern" + ctest_command+=(-E "^($exclude_pattern)$") fi - begin_group "Running sequential tests..." - echo "Running: ${ctest_command[@]} ${seq_exclude_args[@]} -R '^($resource_locked_pattern)$' -j 1" - "${ctest_command[@]}" "${seq_exclude_args[@]}" -R "^($resource_locked_pattern)$" -j 1 || overall_exit_code=$? - echo "::endgroup::" - - ctest_command+=(-E "^($final_exclude)$") - - begin_group "Running all other tests in parallel..." + begin_group "Running tests..." echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }}" "${ctest_command[@]}" -j ${{ matrix.max_jobs }} || overall_exit_code=$? echo "::endgroup::" @@ -1239,20 +1188,6 @@ jobs: } } - # Conflicting tests that must run sequentially - $resource_locked_tests = @( - "ModelFixture.ScheduleFile", - "ModelFixture.ScheduleFileAltCtor", - "ModelFixture.PythonPluginInstance", - "ModelFixture.PythonPluginInstance_NotPYFile", - "ModelFixture.PythonPluginInstance_ClassNameValidation", - "ModelFixture.ChillerElectricASHRAE205_GettersSetters", - "ModelFixture.ChillerElectricASHRAE205_Loops", - "ModelFixture.ChillerElectricASHRAE205_NotCBORFile", - "ModelFixture.ChillerElectricASHRAE205_Clone" - ) - $resource_locked_pattern = $resource_locked_tests -join "|" - $overall_exit_code = 0 $exclude_pattern = "${{ matrix.exclude_regex }}" @@ -1262,23 +1197,11 @@ jobs: $ctest_command = @("ctest", "-C", "${{ env.BUILD_TYPE }}", "-T", "test", "--no-compress-output") - $seq_exclude_args = @() if (-not [string]::IsNullOrEmpty($exclude_pattern)) { - $seq_exclude_args = @("-E", "^($exclude_pattern)$") - $final_exclude = "$exclude_pattern|$resource_locked_pattern" - } else { - $final_exclude = $resource_locked_pattern + $ctest_command += @("-E", "^($exclude_pattern)$") } - begin_group "Running sequential tests..." - Write-Host "Running: $($ctest_command -join ' ') $($seq_exclude_args -join ' ') -R '^($resource_locked_pattern)$' -j 1" - & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] @seq_exclude_args -R "^($resource_locked_pattern)$" -j 1 - if ($LASTEXITCODE -ne 0) { $overall_exit_code = $LASTEXITCODE } - Write-Host "::endgroup::" - - $ctest_command += @("-E", "^($final_exclude)$") - - begin_group "Running all other tests in parallel..." + begin_group "Running tests..." Write-Host "Running: $($ctest_command -join ' ') -j ${{ matrix.max_jobs }}" & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] -j ${{ matrix.max_jobs }} if ($LASTEXITCODE -ne 0) { $overall_exit_code = $LASTEXITCODE } diff --git a/src/energyplus/Test/PythonPluginInstance_GTest.cpp b/src/energyplus/Test/PythonPluginInstance_GTest.cpp index 560899ffec..833bbc77c3 100644 --- a/src/energyplus/Test/PythonPluginInstance_GTest.cpp +++ b/src/energyplus/Test/PythonPluginInstance_GTest.cpp @@ -37,6 +37,9 @@ using namespace openstudio; TEST_F(EnergyPlusFixture, ForwardTranslator_PythonPluginInstance) { Model model; + // Use a directory unique to this test: it deletes the destination dir below, which would otherwise be /files, + // shared with other tests that copy external files there (PythonPluginSearchPaths, ScheduleFileRelativePath) and may run in parallel + model.workflowJSON().setOswDir(openstudio::tempDir() / toPath("ForwardTranslator_PythonPluginInstance")); openstudio::path p = resourcesPath() / toPath("model/PythonPluginThermochromicWindow.py"); ASSERT_TRUE(exists(p)); diff --git a/src/model/test/ChillerElectricASHRAE205_GTest.cpp b/src/model/test/ChillerElectricASHRAE205_GTest.cpp index c4b9eb4400..b8a8e9f686 100644 --- a/src/model/test/ChillerElectricASHRAE205_GTest.cpp +++ b/src/model/test/ChillerElectricASHRAE205_GTest.cpp @@ -620,6 +620,7 @@ TEST_F(ModelFixture, ChillerElectricASHRAE205_Loops) { TEST_F(ModelFixture, ChillerElectricASHRAE205_NotCBORFile) { Model model; + setUniqueOswDir(model); openstudio::path p = resourcesPath() / toPath("model/7-7_Windows_Complete.osm"); EXPECT_TRUE(exists(p)); @@ -632,18 +633,11 @@ TEST_F(ModelFixture, ChillerElectricASHRAE205_NotCBORFile) { TEST_F(ModelFixture, ChillerElectricASHRAE205_Clone) { Model m; + setUniqueOswDir(m); openstudio::path p = resourcesPath() / toPath("model/A205ExampleChiller.RS0001.a205.cbor"); EXPECT_TRUE(exists(p)); - // Work in a temp dir so we don't mess everything up when running tests in parallel - // Work in a temp dir so we don't mess everything up when running tests in parallel - openstudio::path expectedDestDir = openstudio::tempDir() / openstudio::toPath("ChillerElectricASHRAE205_Clone"); - if (exists(expectedDestDir)) { - removeDirectory(expectedDestDir); - } - EXPECT_TRUE(m.workflowJSON().addFilePath(expectedDestDir)); - boost::optional representationFile = ExternalFile::getExternalFile(m, openstudio::toString(p)); ASSERT_TRUE(representationFile); @@ -657,6 +651,7 @@ TEST_F(ModelFixture, ChillerElectricASHRAE205_Clone) { { // Another model first, so we don't mess the original one Model m2; + setUniqueOswDir(m2, "_m2"); auto ch2 = ch.clone(m2).cast(); ASSERT_EQ(1, m2.getConcreteModelObjects().size()); diff --git a/src/model/test/ModelFixture.cpp b/src/model/test/ModelFixture.cpp index 9a226b61cc..fe6f7c5532 100644 --- a/src/model/test/ModelFixture.cpp +++ b/src/model/test/ModelFixture.cpp @@ -7,6 +7,7 @@ #include "../../utilities/idd/IddKey.hpp" #include "../../utilities/core/Finder.hpp" +#include "../../utilities/filetypes/WorkflowJSON.hpp" #include @@ -32,6 +33,13 @@ void ModelFixture::TearDownTestSuite() { logFile->disable(); } +openstudio::path ModelFixture::setUniqueOswDir(openstudio::model::Model& model, const std::string& suffix) { + const auto* testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); + openstudio::path dir = openstudio::tempDir() / toPath(std::string(testInfo->name()) + suffix); + model.workflowJSON().setOswDir(dir); + return dir; +} + void ModelFixture::testBooleanIddField(const openstudio::IddField& iddField, const boost::optional& defaultValue) { EXPECT_TRUE(iddField.properties().type == openstudio::IddFieldType::ChoiceType); openstudio::IddKeyVector keys = iddField.keys(); diff --git a/src/model/test/ModelFixture.hpp b/src/model/test/ModelFixture.hpp index 28fd47c1a3..133100b9b5 100644 --- a/src/model/test/ModelFixture.hpp +++ b/src/model/test/ModelFixture.hpp @@ -38,6 +38,10 @@ class ModelFixture : public ::testing::Test bool testFuelTypeEquality(const std::vector& expectedFuelTypes, const std::vector& actualFuelTypes); + // Points the model's workflow to /, so that the files that ExternalFile copies + // (to /files) don't clash with other tests running in parallel: they'd all use /files otherwise + static openstudio::path setUniqueOswDir(openstudio::model::Model& model, const std::string& suffix = ""); + bool testAppGFuelTypeEquality(const std::vector& expectedAppGFuelTypes, const std::vector& actualAppGFuelTypes); diff --git a/src/model/test/PythonPluginInstance_GTest.cpp b/src/model/test/PythonPluginInstance_GTest.cpp index 46b627b8dc..5026abded2 100644 --- a/src/model/test/PythonPluginInstance_GTest.cpp +++ b/src/model/test/PythonPluginInstance_GTest.cpp @@ -18,6 +18,7 @@ using namespace openstudio; TEST_F(ModelFixture, PythonPluginInstance) { Model model; + setUniqueOswDir(model); EXPECT_EQ(0u, model.getConcreteModelObjects().size()); EXPECT_EQ(0u, model.getConcreteModelObjects().size()); @@ -86,6 +87,7 @@ TEST_F(ModelFixture, PythonPluginInstance) { TEST_F(ModelFixture, PythonPluginInstance_NotPYFile) { Model model; + setUniqueOswDir(model); path p = resourcesPath() / toPath("model/7-7_Windows_Complete.osm"); EXPECT_TRUE(exists(p)); @@ -98,6 +100,7 @@ TEST_F(ModelFixture, PythonPluginInstance_NotPYFile) { TEST_F(ModelFixture, PythonPluginInstance_ClassNameValidation) { Model model; + setUniqueOswDir(model); path p = resourcesPath() / toPath("model/PythonPluginThermochromicWindow.py"); EXPECT_TRUE(exists(p)); diff --git a/src/model/test/ScheduleInterval_GTest.cpp b/src/model/test/ScheduleInterval_GTest.cpp index 85514edd01..0ef07f1265 100644 --- a/src/model/test/ScheduleInterval_GTest.cpp +++ b/src/model/test/ScheduleInterval_GTest.cpp @@ -217,6 +217,7 @@ TEST_F(ModelFixture, Schedule_VariableInterval3) { TEST_F(ModelFixture, ScheduleFile) { Model model; + setUniqueOswDir(model); EXPECT_EQ(0u, model.getConcreteModelObjects().size()); EXPECT_EQ(0u, model.getConcreteModelObjects().size()); @@ -372,6 +373,7 @@ TEST_F(ModelFixture, ScheduleFile) { TEST_F(ModelFixture, ScheduleFileAltCtor) { Model model; + setUniqueOswDir(model); EXPECT_EQ(0u, model.getConcreteModelObjects().size()); EXPECT_EQ(0u, model.getConcreteModelObjects().size()); From b80e8418524fce788db446d7c5dda1889b6b494a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 14:14:48 +0100 Subject: [PATCH 40/54] gbXML tests: write each test's output to its own file, so they can run in parallel --- src/gbxml/Test/ForwardTranslator_GTest.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gbxml/Test/ForwardTranslator_GTest.cpp b/src/gbxml/Test/ForwardTranslator_GTest.cpp index 4da7ef89b5..152e613477 100644 --- a/src/gbxml/Test/ForwardTranslator_GTest.cpp +++ b/src/gbxml/Test/ForwardTranslator_GTest.cpp @@ -81,7 +81,7 @@ TEST_F(gbXMLFixture, ForwardTranslator_exampleModel) { path p1 = resourcesPath() / openstudio::toPath("gbxml/exampleModel.osm"); model.save(p1, true); - path p2 = resourcesPath() / openstudio::toPath("gbxml/exampleModel2.osm"); + path p2 = resourcesPath() / openstudio::toPath("gbxml/exampleModel_reverseTranslated.osm"); model2->save(p2, true); } @@ -298,7 +298,7 @@ TEST_F(gbXMLFixture, ForwardTranslator_surfaceType_4001) { Model model = exampleModel(); // Write out the XML - path p = resourcesPath() / openstudio::toPath("gbxml/exampleModel.xml"); + path p = resourcesPath() / openstudio::toPath("gbxml/surfaceType_4001.xml"); ForwardTranslator forwardTranslator; bool test = forwardTranslator.modelToGbXML(model, p); @@ -891,7 +891,7 @@ TEST_F(gbXMLFixture, ForwardTranslator_IDs_Names) { TEST_F(gbXMLFixture, ForwardTranslator_exampleModelValid) { Model model = exampleModel(); - path p = resourcesPath() / openstudio::toPath("gbxml/exampleModel.xml"); + path p = resourcesPath() / openstudio::toPath("gbxml/exampleModelValid.xml"); ForwardTranslator forwardTranslator; bool test = forwardTranslator.modelToGbXML(model, p); @@ -913,7 +913,7 @@ TEST_F(gbXMLFixture, ForwardTranslator_exposedToSun) { Model model = exampleModel(); // Write out the XML - path p = resourcesPath() / openstudio::toPath("gbxml/exampleModel.xml"); + path p = resourcesPath() / openstudio::toPath("gbxml/exposedToSun.xml"); ForwardTranslator forwardTranslator; bool test = forwardTranslator.modelToGbXML(model, p); @@ -963,7 +963,7 @@ TEST_F(gbXMLFixture, ForwardTranslator_spaceVolume) { EXPECT_EQ(300.0, ospace1->volume()); // Write out the XML - path p = resourcesPath() / openstudio::toPath("gbxml/exampleModel.xml"); + path p = resourcesPath() / openstudio::toPath("gbxml/spaceVolume.xml"); ForwardTranslator forwardTranslator; bool test = forwardTranslator.modelToGbXML(model, p); @@ -1013,7 +1013,7 @@ TEST_F(gbXMLFixture, ForwardTranslator_spaceVolume) { EXPECT_EQ(305.0, ospace1->volume()); // Write out the XML - path p = resourcesPath() / openstudio::toPath("gbxml/exampleModel.xml"); + path p = resourcesPath() / openstudio::toPath("gbxml/spaceVolume.xml"); ForwardTranslator forwardTranslator; bool test = forwardTranslator.modelToGbXML(model, p); From 28ac9be28761b48eabc1feca4ad129dce8c9df0b Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 14:25:18 +0100 Subject: [PATCH 41/54] CI: replace ctest -T test with --output-junit (Testing/Results.xml, and Testing/Rerun.xml for the rerun), so the rerun no longer overwrites the full results and LastTest.log/LastTestsFailed.log exist for the summary steps --- .github/workflows/full-build.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index afe7a35a2c..11afd429a4 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -307,20 +307,20 @@ jobs: . ./conanbuild.sh - ctest_command=(ctest -C ${{ env.BUILD_TYPE }} -T test --no-compress-output) + ctest_command=(ctest -C ${{ env.BUILD_TYPE }}) if [ -n "$exclude_pattern" ]; then ctest_command+=(-E "^($exclude_pattern)$") fi begin_group "Running tests..." - echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }}" - "${ctest_command[@]}" -j ${{ matrix.max_jobs }} || overall_exit_code=$? + echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml" + "${ctest_command[@]}" -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml || overall_exit_code=$? echo "::endgroup::" if [ $overall_exit_code -ne 0 ]; then begin_group "Rerunning failing tests..." - echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure" - "${ctest_command[@]}" --rerun-failed --output-on-failure && overall_exit_code=0 || overall_exit_code=$? + echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" + "${ctest_command[@]}" --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml && overall_exit_code=0 || overall_exit_code=$? echo "::endgroup::" fi @@ -728,20 +728,20 @@ jobs: export CTEST_OUTPUT_ON_FAILURE=1 exclude_pattern="${{ matrix.exclude_regex }}" - ctest_command=(ctest -C ${{ env.BUILD_TYPE }} -T test --no-compress-output) + ctest_command=(ctest -C ${{ env.BUILD_TYPE }}) if [ -n "$exclude_pattern" ]; then ctest_command+=(-E "^($exclude_pattern)$") fi begin_group "Running tests..." - echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }}" - "${ctest_command[@]}" -j ${{ matrix.max_jobs }} || overall_exit_code=$? + echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml" + "${ctest_command[@]}" -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml || overall_exit_code=$? echo "::endgroup::" if [ $overall_exit_code -ne 0 ]; then begin_group "Rerunning failing tests..." - echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure" - "${ctest_command[@]}" --rerun-failed --output-on-failure && overall_exit_code=0 || overall_exit_code=$? + echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" + "${ctest_command[@]}" --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml && overall_exit_code=0 || overall_exit_code=$? echo "::endgroup::" fi @@ -1195,22 +1195,22 @@ jobs: function begin_group($msg) { Write-Host "::group::$([char]27)[93m$msg$([char]27)[0m" } - $ctest_command = @("ctest", "-C", "${{ env.BUILD_TYPE }}", "-T", "test", "--no-compress-output") + $ctest_command = @("ctest", "-C", "${{ env.BUILD_TYPE }}") if (-not [string]::IsNullOrEmpty($exclude_pattern)) { $ctest_command += @("-E", "^($exclude_pattern)$") } begin_group "Running tests..." - Write-Host "Running: $($ctest_command -join ' ') -j ${{ matrix.max_jobs }}" - & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] -j ${{ matrix.max_jobs }} + Write-Host "Running: $($ctest_command -join ' ') -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml" + & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml if ($LASTEXITCODE -ne 0) { $overall_exit_code = $LASTEXITCODE } Write-Host "::endgroup::" if ($overall_exit_code -ne 0) { begin_group "Rerunning failing tests..." - Write-Host "Running: $($ctest_command -join ' ') --rerun-failed --output-on-failure" - & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] --rerun-failed --output-on-failure + Write-Host "Running: $($ctest_command -join ' ') --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" + & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml if ($LASTEXITCODE -eq 0) { $overall_exit_code = 0 } else { $overall_exit_code = $LASTEXITCODE } Write-Host "::endgroup::" } From c7696403a12b2c32b8e5cb67ebda23f40c4336fd Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 15:28:14 +0100 Subject: [PATCH 42/54] MeasureFixture: don't wipe the shared scratch dir in SetUpTestSuite, it runs for every test (one process each) and deleted the files of tests running in parallel --- src/measure/test/MeasureFixture.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/measure/test/MeasureFixture.cpp b/src/measure/test/MeasureFixture.cpp index 69faa007d6..581d2ff209 100644 --- a/src/measure/test/MeasureFixture.cpp +++ b/src/measure/test/MeasureFixture.cpp @@ -87,9 +87,8 @@ void MeasureFixture::SetUpTestSuite() { logFile->setLogLevel(Info); openstudio::Logger::instance().standardOutLogger().disable(); - // clear scratch + // Don't clear it: CTest runs each test in its own process, so this runs for every test, and would delete the files of tests running in parallel scratchDir = openstudio::getApplicationBuildDirectory() / openstudio::toPath("Testing/Temporary/measure"); - openstudio::filesystem::remove_all(scratchDir); openstudio::filesystem::create_directories(scratchDir); } From caf827d5a306c20f5255df75c361c9906b78a531 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 15:39:15 +0100 Subject: [PATCH 43/54] CI: add a "Flaky tests" warning annotation when tests fail the first pass but pass on rerun --- .github/workflows/full-build.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 11afd429a4..79f0fa79f9 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -318,10 +318,16 @@ jobs: echo "::endgroup::" if [ $overall_exit_code -ne 0 ]; then + first_failed=$(cut -d: -f2 Testing/Temporary/LastTestsFailed.log | tr '\n' ' ') + begin_group "Rerunning failing tests..." echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" "${ctest_command[@]}" --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml && overall_exit_code=0 || overall_exit_code=$? echo "::endgroup::" + + if [ $overall_exit_code -eq 0 ]; then + echo "::warning title=Flaky tests::Failed, then passed on rerun (probably not safe to run in parallel): $first_failed" + fi fi echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT @@ -739,10 +745,16 @@ jobs: echo "::endgroup::" if [ $overall_exit_code -ne 0 ]; then + first_failed=$(cut -d: -f2 Testing/Temporary/LastTestsFailed.log | tr '\n' ' ') + begin_group "Rerunning failing tests..." echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" "${ctest_command[@]}" --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml && overall_exit_code=0 || overall_exit_code=$? echo "::endgroup::" + + if [ $overall_exit_code -eq 0 ]; then + echo "::warning title=Flaky tests::Failed, then passed on rerun (probably not safe to run in parallel): $first_failed" + fi fi echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT @@ -1208,11 +1220,17 @@ jobs: Write-Host "::endgroup::" if ($overall_exit_code -ne 0) { + $first_failed = (Get-Content Testing/Temporary/LastTestsFailed.log | ForEach-Object { ($_ -split ':', 2)[1] }) -join ' ' + begin_group "Rerunning failing tests..." Write-Host "Running: $($ctest_command -join ' ') --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml if ($LASTEXITCODE -eq 0) { $overall_exit_code = 0 } else { $overall_exit_code = $LASTEXITCODE } Write-Host "::endgroup::" + + if ($overall_exit_code -eq 0) { + Write-Host "::warning title=Flaky tests::Failed, then passed on rerun (probably not safe to run in parallel): $first_failed" + } } "exit_code=$overall_exit_code" | Out-File -FilePath $env:GITHUB_OUTPUT -Append From 452aeb31d624f0fde7ca00163e0003af8b2e2105 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 15:42:47 +0100 Subject: [PATCH 44/54] CI: don't load the Conan build environment in the CTest steps, it only sets up compilers/SWIG (macOS never did) --- .github/workflows/full-build.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 79f0fa79f9..e1d56dcda2 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -305,8 +305,6 @@ jobs: export CTEST_OUTPUT_ON_FAILURE=1 exclude_pattern="${{ matrix.exclude_regex }}" - . ./conanbuild.sh - ctest_command=(ctest -C ${{ env.BUILD_TYPE }}) if [ -n "$exclude_pattern" ]; then ctest_command+=(-E "^($exclude_pattern)$") @@ -1189,17 +1187,6 @@ jobs: working-directory: ${{ env.OPENSTUDIO_BUILD }} shell: pwsh run: | - $env_vars = & $env:ComSpec /c "call conanbuild.bat && set" - foreach ($line in $env_vars) { - if ($line -match '^(.*?)=(.*)$') { - $name = $matches[1] - $value = $matches[2] - if ($name -ne "" -and $name -notmatch "^=") { - [Environment]::SetEnvironmentVariable($name, $value, "Process") - } - } - } - $overall_exit_code = 0 $exclude_pattern = "${{ matrix.exclude_regex }}" From 9783ddd6b94d0b4541a4c7a639494a9bf0858802 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 15:52:45 +0100 Subject: [PATCH 45/54] CI: write the steps shared by the Linux, macOS and Windows jobs once (YAML anchors in the Linux job), and reuse them in the other two --- .github/workflows/full-build.yml | 164 +++++++------------------------ 1 file changed, 38 insertions(+), 126 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index e1d56dcda2..f0d6aa4feb 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -181,19 +181,23 @@ jobs: df -h || true echo - - name: Checkout repository + - &checkout + name: Checkout repository uses: actions/checkout@v7 with: fetch-depth: 1 - - name: Get base branch SHA + - &get_base_sha + name: Get base branch SHA if: github.event_name == 'pull_request' + shell: bash run: | # github.event.pull_request.base.sha is the base at PR creation, not the current tip BASE_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/${{ github.base_ref }}" | cut -f1) echo "BASE_SHA=$BASE_SHA" >> "$GITHUB_ENV" - - name: Restore ccache cache + - &restore_ccache + name: Restore ccache cache id: ccache-restore uses: actions/cache/restore@v6 with: @@ -218,7 +222,9 @@ jobs: echo "/usr/local/cmake/bin" >> $GITHUB_PATH fi - - name: Install Python dependencies + - &install_python_deps + name: Install Python dependencies + shell: bash run: python -m pip install -r python/requirements.txt - name: Setup Conan @@ -241,7 +247,8 @@ jobs: -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \ -DCMAKE_JOB_POOL_LINK:STRING=console - - name: Show restored ccache stats + - &show_restored_ccache_stats + name: Show restored ccache stats shell: bash run: | # Stats live in the cache dir, so they come back with the restore: show them, then zero them for this run @@ -267,19 +274,22 @@ jobs: ninja -d stats || true exit $BUILD_EXIT - - name: Show ccache stats + - &show_ccache_stats + name: Show ccache stats if: always() shell: bash run: ccache --show-stats -vv - - name: Save ccache cache + - &save_ccache + name: Save ccache cache if: always() && steps.ccache-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v6 with: path: ${{ env.CCACHE_DIR }} key: ${{ steps.ccache-restore.outputs.cache-primary-key }} - - name: Upload build diagnostics + - &upload_build_diagnostics + name: Upload build diagnostics if: always() uses: actions/upload-artifact@v7 with: @@ -362,7 +372,8 @@ jobs: fi continue-on-error: true - - name: Upload Testing artifact + - &upload_testing_artifact + name: Upload Testing artifact if: always() && env.SKIP_TESTS != 'true' uses: actions/upload-artifact@v7 with: @@ -568,10 +579,7 @@ jobs: contents: write steps: - - name: Checkout repository - uses: actions/checkout@v7 - with: - fetch-depth: 1 + - *checkout - name: Verify space shell: bash @@ -598,30 +606,16 @@ jobs: echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_dev_target }} >> $GITHUB_ENV brew install ninja ccache - - name: Get base branch SHA - if: github.event_name == 'pull_request' - run: | - # github.event.pull_request.base.sha is the base at PR creation, not the current tip - BASE_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/${{ github.base_ref }}" | cut -f1) - echo "BASE_SHA=$BASE_SHA" >> "$GITHUB_ENV" + - *get_base_sha - - name: Restore ccache cache - id: ccache-restore - uses: actions/cache/restore@v6 - with: - path: ${{ env.CCACHE_DIR }} - key: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - restore-keys: | - ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ env.BASE_SHA }} - ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- + - *restore_ccache - name: Set up Python ${{ env.PYTHON_REQUIRED_VERSION }} uses: actions/setup-python@v7 with: python-version: ${{ env.PYTHON_REQUIRED_VERSION }} - - name: Install Python dependencies - run: python -m pip install -r python/requirements.txt + - *install_python_deps - name: Install Ruby uses: ruby/setup-ruby@v1 @@ -663,13 +657,7 @@ jobs: -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} \ -DCMAKE_JOB_POOL_LINK:STRING=console - - name: Show restored ccache stats - shell: bash - run: | - # Stats live in the cache dir, so they come back with the restore: show them, then zero them for this run - ccache --show-stats -vv - ccache --zero-stats - ccache --show-config + - *show_restored_ccache_stats - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -691,30 +679,11 @@ jobs: if [ -f build.log ]; then tail -n 40 build.log; fi exit $build_exit - - name: Show ccache stats - if: always() - shell: bash - run: ccache --show-stats -vv + - *show_ccache_stats - - name: Save ccache cache - if: always() && steps.ccache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@v6 - with: - path: ${{ env.CCACHE_DIR }} - key: ${{ steps.ccache-restore.outputs.cache-primary-key }} + - *save_ccache - - name: Upload build diagnostics - if: always() - uses: actions/upload-artifact@v7 - with: - name: build-diag-${{ matrix.platform }}-${{ github.sha }} - path: | - ${{ env.OPENSTUDIO_BUILD }}/build.log - ${{ env.OPENSTUDIO_BUILD }}/.ninja_log - ${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake - if-no-files-found: warn - # .ninja_log is a hidden file, skipped by default - include-hidden-files: true + - *upload_build_diagnostics - name: Run CTest suite if: env.SKIP_TESTS != 'true' @@ -935,14 +904,7 @@ jobs: fi continue-on-error: true - - name: Upload Testing artifact - if: always() && env.SKIP_TESTS != 'true' - uses: actions/upload-artifact@v7 - with: - name: Testing-${{ matrix.platform }}-${{ github.sha }} - path: | - ${{ env.OPENSTUDIO_BUILD }}/Testing-${{ matrix.test_suffix }}/ - ${{ env.OPENSTUDIO_BUILD }}/${{ env.TEST_DASHBOARD_RELATIVE }} + - *upload_testing_artifact - name: Determine installer path id: installer_path @@ -1051,10 +1013,7 @@ jobs: contents: write steps: - - name: Checkout repository - uses: actions/checkout@v7 - with: - fetch-depth: 1 + - *checkout - name: Verify space run: | @@ -1075,23 +1034,9 @@ jobs: # Not sccache: it refuses to cache MSVC compiles using PCH (/Yc, /Fp), i.e. ~95% of them run: choco install ccache -y --no-progress - - name: Get base branch SHA - if: github.event_name == 'pull_request' - shell: bash - run: | - # github.event.pull_request.base.sha is the base at PR creation, not the current tip - BASE_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY.git" "refs/heads/${{ github.base_ref }}" | cut -f1) - echo "BASE_SHA=$BASE_SHA" >> "$GITHUB_ENV" + - *get_base_sha - - name: Restore ccache cache - id: ccache-restore - uses: actions/cache/restore@v6 - with: - path: ${{ env.CCACHE_DIR }} - key: ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - restore-keys: | - ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}-${{ env.BASE_SHA }} - ccache-${{ matrix.os }}-${{ matrix.platform }}-pch=${{ env.ENABLE_PCH }}- + - *restore_ccache - name: Prepare workspace run: | @@ -1103,8 +1048,7 @@ jobs: python-version: '3.12.2' cache: 'pip' - - name: Install Python dependencies - run: python -m pip install -r python/requirements.txt + - *install_python_deps - name: Install Ruby uses: ruby/setup-ruby@v1 @@ -1134,13 +1078,7 @@ jobs: $rubyExe = (Get-Command ruby).Source & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --preset conan-release -DSYSTEM_RUBY_EXECUTABLE:FILEPATH=`"$rubyExe`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console" - - name: Show restored ccache stats - shell: bash - run: | - # Stats live in the cache dir, so they come back with the restore: show them, then zero them for this run - ccache --show-stats -vv - ccache --zero-stats - ccache --show-config + - *show_restored_ccache_stats - name: Build with Ninja working-directory: ${{ env.OPENSTUDIO_BUILD }} @@ -1155,30 +1093,11 @@ jobs: exit $LASTEXITCODE } - - name: Show ccache stats - if: always() - shell: bash - run: ccache --show-stats -vv + - *show_ccache_stats - - name: Save ccache cache - if: always() && steps.ccache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@v6 - with: - path: ${{ env.CCACHE_DIR }} - key: ${{ steps.ccache-restore.outputs.cache-primary-key }} + - *save_ccache - - name: Upload build diagnostics - if: always() - uses: actions/upload-artifact@v7 - with: - name: build-diag-${{ matrix.platform }}-${{ github.sha }} - path: | - ${{ env.OPENSTUDIO_BUILD }}/build.log - ${{ env.OPENSTUDIO_BUILD }}/.ninja_log - ${{ env.OPENSTUDIO_BUILD }}/CTestTestfile.cmake - if-no-files-found: warn - # .ninja_log is a hidden file, skipped by default - include-hidden-files: true + - *upload_build_diagnostics - name: Run CTest suite if: env.SKIP_TESTS != 'true' @@ -1253,14 +1172,7 @@ jobs: } continue-on-error: true - - name: Upload Testing artifact - if: always() && env.SKIP_TESTS != 'true' - uses: actions/upload-artifact@v7 - with: - name: Testing-${{ matrix.platform }}-${{ github.sha }} - path: | - ${{ env.OPENSTUDIO_BUILD }}/Testing-${{ matrix.test_suffix }}/ - ${{ env.OPENSTUDIO_BUILD }}/${{ env.TEST_DASHBOARD_RELATIVE }} + - *upload_testing_artifact # CODE SIGNING SETUP - name: Setup Node.js From 37e403cb6efe64255ed46e39982f4b4e7088ce8a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 15:55:13 +0100 Subject: [PATCH 46/54] CI: write the CTest step once (YAML anchor in the Linux job) and reuse it for macOS and Windows; Windows now runs it in bash, and macOS installs bundler in a separate step --- .github/workflows/full-build.yml | 89 ++++---------------------------- 1 file changed, 9 insertions(+), 80 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index f0d6aa4feb..cdd876e3ae 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -302,11 +302,13 @@ jobs: # .ninja_log is a hidden file, skipped by default include-hidden-files: true - - name: Run CTest suite + - &run_ctest + name: Run CTest suite if: env.SKIP_TESTS != 'true' id: ctest continue-on-error: true working-directory: ${{ env.OPENSTUDIO_BUILD }} + shell: bash run: | overall_exit_code=0 @@ -685,46 +687,12 @@ jobs: - *upload_build_diagnostics - - name: Run CTest suite + - name: Install bundler if: env.SKIP_TESTS != 'true' - id: mac_ctest - working-directory: ${{ env.OPENSTUDIO_BUILD }} shell: bash - continue-on-error: true - run: | - gem install bundler -v 2.4.10 --conservative --no-document - - overall_exit_code=0 - - begin_group() { echo -e "::group::\033[93m$1\033[0m"; } - - export CTEST_OUTPUT_ON_FAILURE=1 - exclude_pattern="${{ matrix.exclude_regex }}" - - ctest_command=(ctest -C ${{ env.BUILD_TYPE }}) - if [ -n "$exclude_pattern" ]; then - ctest_command+=(-E "^($exclude_pattern)$") - fi + run: gem install bundler -v 2.4.10 --conservative --no-document - begin_group "Running tests..." - echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml" - "${ctest_command[@]}" -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml || overall_exit_code=$? - echo "::endgroup::" - - if [ $overall_exit_code -ne 0 ]; then - first_failed=$(cut -d: -f2 Testing/Temporary/LastTestsFailed.log | tr '\n' ' ') - - begin_group "Rerunning failing tests..." - echo "Running: ${ctest_command[@]} --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" - "${ctest_command[@]}" --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml && overall_exit_code=0 || overall_exit_code=$? - echo "::endgroup::" - - if [ $overall_exit_code -eq 0 ]; then - echo "::warning title=Flaky tests::Failed, then passed on rerun (probably not safe to run in parallel): $first_failed" - fi - fi - - echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT + - *run_ctest - name: Setup Keychain # Same refs as the job's environment: the Apple secrets are apple-signing environment secrets, which can only deploy to develop/master/v* tags. @@ -935,14 +903,14 @@ jobs: if-no-files-found: ignore - name: Fail job on test failures - if: env.SKIP_TESTS != 'true' && steps.mac_ctest.outputs.exit_code != '0' + if: env.SKIP_TESTS != 'true' && steps.ctest.outputs.exit_code != '0' working-directory: ${{ env.OPENSTUDIO_BUILD }} run: | cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true if [ -f Testing/Temporary/LastTestsFailed.log ]; then echo; echo "Failed tests:"; cat Testing/Temporary/LastTestsFailed.log fi - echo "::error::CTest suite failed with exit code ${{ steps.mac_ctest.outputs.exit_code }}" + echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" exit 1 macos-publish: @@ -1099,46 +1067,7 @@ jobs: - *upload_build_diagnostics - - name: Run CTest suite - if: env.SKIP_TESTS != 'true' - id: ctest - continue-on-error: true - working-directory: ${{ env.OPENSTUDIO_BUILD }} - shell: pwsh - run: | - $overall_exit_code = 0 - $exclude_pattern = "${{ matrix.exclude_regex }}" - - $env:CTEST_OUTPUT_ON_FAILURE = "1" - - function begin_group($msg) { Write-Host "::group::$([char]27)[93m$msg$([char]27)[0m" } - - $ctest_command = @("ctest", "-C", "${{ env.BUILD_TYPE }}") - - if (-not [string]::IsNullOrEmpty($exclude_pattern)) { - $ctest_command += @("-E", "^($exclude_pattern)$") - } - - begin_group "Running tests..." - Write-Host "Running: $($ctest_command -join ' ') -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml" - & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml - if ($LASTEXITCODE -ne 0) { $overall_exit_code = $LASTEXITCODE } - Write-Host "::endgroup::" - - if ($overall_exit_code -ne 0) { - $first_failed = (Get-Content Testing/Temporary/LastTestsFailed.log | ForEach-Object { ($_ -split ':', 2)[1] }) -join ' ' - - begin_group "Rerunning failing tests..." - Write-Host "Running: $($ctest_command -join ' ') --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml" - & $ctest_command[0] $ctest_command[1..($ctest_command.Length-1)] --rerun-failed --output-on-failure --output-junit Testing/Rerun.xml - if ($LASTEXITCODE -eq 0) { $overall_exit_code = 0 } else { $overall_exit_code = $LASTEXITCODE } - Write-Host "::endgroup::" - - if ($overall_exit_code -eq 0) { - Write-Host "::warning title=Flaky tests::Failed, then passed on rerun (probably not safe to run in parallel): $first_failed" - } - } - "exit_code=$overall_exit_code" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + - *run_ctest - name: Copy Testing tree with suffix if: always() && env.SKIP_TESTS != 'true' From 4113d4394b9baf6f935d0dda585e73e2e48ab0e1 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 15:57:05 +0100 Subject: [PATCH 47/54] CI: share the Copy Testing tree, Generate test summary and Fail job on test failures steps across platforms (YAML anchors), Windows now runs them in bash --- .github/workflows/full-build.yml | 98 +++++--------------------------- 1 file changed, 15 insertions(+), 83 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index cdd876e3ae..2394eb9cf8 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -342,17 +342,21 @@ jobs: echo "exit_code=${overall_exit_code}" >> $GITHUB_OUTPUT - - name: Copy Testing tree with suffix + - ©_testing_tree + name: Copy Testing tree with suffix if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} + shell: bash run: | if [ -d "Testing" ]; then cp -r Testing "Testing-${{ matrix.test_suffix }}" fi - - name: Generate test summary + - &generate_test_summary + name: Generate test summary if: always() && env.SKIP_TESTS != 'true' working-directory: ${{ env.OPENSTUDIO_BUILD }} + shell: bash run: | # Generate a simple markdown summary from CTest results @@ -415,9 +419,11 @@ jobs: path: ${{ env.OPENSTUDIO_BUILD }}/OpenStudio-*.tar.gz if-no-files-found: ignore - - name: Fail job on test failures + - &fail_on_test_failures + name: Fail job on test failures if: env.SKIP_TESTS != 'true' && steps.ctest.outputs.exit_code != '0' working-directory: ${{ env.OPENSTUDIO_BUILD }} + shell: bash run: | cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true if [ -f Testing/Temporary/LastTestsFailed.log ]; then @@ -840,37 +846,9 @@ jobs: security delete-keychain "$KEYCHAIN_PATH" || true fi - - name: Copy Testing tree with suffix - if: always() && env.SKIP_TESTS != 'true' - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - if [ -d "Testing" ]; then - cp -r Testing "Testing-${{ matrix.test_suffix }}" - fi - - - name: Generate test summary - if: always() && env.SKIP_TESTS != 'true' - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | + - *copy_testing_tree - # Generate a simple markdown summary from CTest results - mkdir -p "$(dirname '${{ env.TEST_DASHBOARD_RELATIVE }}')" - - echo "# OpenStudio Test Results - ${{ matrix.test_suffix }}" > "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo "" >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo "**Build:** \`${{ github.sha }}\`" >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo "**Branch:** \`${{ github.ref_name }}\`" >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo "**Platform:** ${{ matrix.pretty }}" >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo "**Date:** $(date -u)" >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo "" >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - - if [ -f Testing/Temporary/LastTest.log ]; then - echo "## Test Log (Last 50 lines)" >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo '```' >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - tail -50 Testing/Temporary/LastTest.log >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - echo '```' >> "${{ env.TEST_DASHBOARD_RELATIVE }}" - fi - continue-on-error: true + - *generate_test_summary - *upload_testing_artifact @@ -902,16 +880,7 @@ jobs: path: ${{ env.OPENSTUDIO_BUILD }}/OpenStudio-*.tar.gz if-no-files-found: ignore - - name: Fail job on test failures - if: env.SKIP_TESTS != 'true' && steps.ctest.outputs.exit_code != '0' - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - cat "${{ env.TEST_DASHBOARD_RELATIVE }}" || true - if [ -f Testing/Temporary/LastTestsFailed.log ]; then - echo; echo "Failed tests:"; cat Testing/Temporary/LastTestsFailed.log - fi - echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" - exit 1 + - *fail_on_test_failures macos-publish: name: Publish MacOS Artifacts @@ -1069,37 +1038,9 @@ jobs: - *run_ctest - - name: Copy Testing tree with suffix - if: always() && env.SKIP_TESTS != 'true' - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - if (Test-Path "Testing") { - Copy-Item -Path "Testing" -Destination "Testing-${{ matrix.test_suffix }}" -Recurse -Force - } + - *copy_testing_tree - - name: Generate test summary - if: always() && env.SKIP_TESTS != 'true' - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - $dashboardPath = "${{ env.TEST_DASHBOARD_RELATIVE }}" - $dashboardDir = Split-Path -Parent $dashboardPath - if (-not (Test-Path $dashboardDir)) { New-Item -ItemType Directory -Path $dashboardDir -Force } - - "# OpenStudio Test Results - ${{ matrix.test_suffix }}" | Out-File -FilePath $dashboardPath -Encoding utf8 - "" | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - "**Build:** ``${{ github.sha }}``" | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - "**Branch:** ``${{ github.ref_name }}``" | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - "**Platform:** ${{ matrix.pretty }}" | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - "**Date:** $(Get-Date -Format u)" | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - "" | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - - if (Test-Path "Testing/Temporary/LastTest.log") { - "## Test Log (Last 50 lines)" | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - '```' | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - Get-Content "Testing/Temporary/LastTest.log" -Tail 50 | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - '```' | Out-File -FilePath $dashboardPath -Encoding utf8 -Append - } - continue-on-error: true + - *generate_test_summary - *upload_testing_artifact @@ -1262,16 +1203,7 @@ jobs: path: ${{ env.OPENSTUDIO_BUILD }}/_CPack_Packages/win64/TGZ/*.tar.gz if-no-files-found: ignore - - name: Fail job on test failures - if: env.SKIP_TESTS != 'true' && steps.ctest.outputs.exit_code != '0' - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - Get-Content "${{ env.TEST_DASHBOARD_RELATIVE }}" -ErrorAction SilentlyContinue - if (Test-Path Testing/Temporary/LastTestsFailed.log) { - ""; "Failed tests:"; Get-Content Testing/Temporary/LastTestsFailed.log - } - echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" - exit 1 + - *fail_on_test_failures windows-publish: name: Publish Windows Artifacts From f908f4a2aabf98d758083c1f97622a0ce6635cd0 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 16:00:53 +0100 Subject: [PATCH 48/54] CI: name the macOS installer artifacts OS-Installers-- like the others, and only download each platform's installers in its publish job (Linux was also picking up the Windows ones) In practice Linux didn't pick the windows up, because it runs while windows is still building since it's slower --- .github/workflows/full-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 2394eb9cf8..6d1ee0c496 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -441,7 +441,7 @@ jobs: - name: Download all installers uses: actions/download-artifact@v8 with: - pattern: OS-Installers-* + pattern: OS-Installers-{ubuntu,centos}-* merge-multiple: true path: installers @@ -868,7 +868,7 @@ jobs: if: always() uses: actions/upload-artifact@v7 with: - name: OS-IFW-${{ matrix.platform }}-${{ github.sha }} + name: OS-Installers-${{ matrix.platform }}-IFW-${{ github.sha }} path: ${{ steps.installer_path.outputs.path }} if-no-files-found: ignore @@ -876,7 +876,7 @@ jobs: if: always() uses: actions/upload-artifact@v7 with: - name: OS-TGZ-${{ matrix.platform }}-${{ github.sha }} + name: OS-Installers-${{ matrix.platform }}-TGZ-${{ github.sha }} path: ${{ env.OPENSTUDIO_BUILD }}/OpenStudio-*.tar.gz if-no-files-found: ignore @@ -891,7 +891,7 @@ jobs: - name: Download all installers uses: actions/download-artifact@v8 with: - pattern: OS-*-macos* + pattern: OS-Installers-macos-* merge-multiple: true path: installers @@ -1214,7 +1214,7 @@ jobs: - name: Download all installers uses: actions/download-artifact@v8 with: - pattern: OS-Installers-windows-2022-x64-* + pattern: OS-Installers-windows-* path: installers - name: Configure AWS credentials From 3b27717170c59bd052c2f7d14b209097e6e49df7 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 16:09:12 +0100 Subject: [PATCH 49/54] CI: publish jobs: share the S3 upload script (YAML anchor); Windows downloads with merge-multiple like the others, and the redundant AWS_S3_BUCKET env is gone --- .github/workflows/full-build.yml | 55 +++++++------------------------- 1 file changed, 11 insertions(+), 44 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 6d1ee0c496..525478db67 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -436,7 +436,7 @@ jobs: name: Publish Linux Artifacts needs: [linux-build] runs-on: ubuntu-latest - if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') + if: &publish_if github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') steps: - name: Download all installers uses: actions/download-artifact@v8 @@ -445,7 +445,8 @@ jobs: merge-multiple: true path: installers - - name: Configure AWS credentials + - &configure_aws_credentials + name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v6 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -456,7 +457,7 @@ jobs: working-directory: installers env: S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}', github.ref_name) || format('{0}', github.ref_name) }} - run: | + run: &s3_upload | echo "Uploading artifacts to s3://${AWS_S3_BUCKET}/${S3_PREFIX}" for file in *; do [ -e "$file" ] || continue @@ -886,7 +887,7 @@ jobs: name: Publish MacOS Artifacts needs: [macos-build] runs-on: ubuntu-latest - if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') + if: *publish_if steps: - name: Download all installers uses: actions/download-artifact@v8 @@ -895,28 +896,13 @@ jobs: merge-multiple: true path: installers - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v6 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION || 'us-west-2' }} + - *configure_aws_credentials - name: Publish to S3 working-directory: installers env: S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}/signed', github.ref_name) || format('{0}/signed', github.ref_name) }} - AWS_S3_BUCKET: openstudio-ci-builds - run: | - echo "Uploading artifacts to s3://${AWS_S3_BUCKET}/${S3_PREFIX}" - for file in *; do - [ -e "$file" ] || continue - [ -f "$file" ] || continue - filename=$(basename "$file") - key="${S3_PREFIX}/${filename}" - aws s3 cp "$file" "s3://${AWS_S3_BUCKET}/${key}" --acl public-read - if command -v md5sum >/dev/null 2>&1; then md5sum "$file"; else md5 "$file"; fi - done + run: *s3_upload windows-build: name: Build ${{ matrix.pretty }} @@ -1209,38 +1195,19 @@ jobs: name: Publish Windows Artifacts needs: [windows-build] runs-on: ubuntu-latest - if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') + if: *publish_if steps: - name: Download all installers uses: actions/download-artifact@v8 with: pattern: OS-Installers-windows-* + merge-multiple: true path: installers - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v6 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION || 'us-west-2' }} + - *configure_aws_credentials - name: Publish to S3 working-directory: installers env: S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}/signed', github.ref_name) || format('{0}/signed', github.ref_name) }} - AWS_S3_BUCKET: openstudio-ci-builds - run: | - echo "Uploading artifacts to s3://${AWS_S3_BUCKET}/${S3_PREFIX}" - - # windows-build only uploads the EXE after signing and verifying it - find . -name "*.exe" | while read -r file; do - echo "Uploading signed installer: $file" - aws s3 cp "$file" "s3://${AWS_S3_BUCKET}/${S3_PREFIX}/$(basename "$file")" --acl public-read - done - - # Upload tarballs - for file in $(find . -name "*.tar.gz"); do - filename=$(basename "$file") - aws s3 cp "$file" "s3://${AWS_S3_BUCKET}/${S3_PREFIX}/${filename}" --acl public-read - done - + run: *s3_upload From 67f30c89e7d3d9df2600d5f2bbeb3d77b7584de8 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 16:10:11 +0100 Subject: [PATCH 50/54] Put 3 build jobs first, then 3 publish jobs --- .github/workflows/full-build.yml | 260 +++++++++++++++---------------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 525478db67..a9f71eff84 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -432,115 +432,6 @@ jobs: echo "::error::CTest suite failed with exit code ${{ steps.ctest.outputs.exit_code }}" exit 1 - linux-publish: - name: Publish Linux Artifacts - needs: [linux-build] - runs-on: ubuntu-latest - if: &publish_if github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') - steps: - - name: Download all installers - uses: actions/download-artifact@v8 - with: - pattern: OS-Installers-{ubuntu,centos}-* - merge-multiple: true - path: installers - - - &configure_aws_credentials - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v6 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION || 'us-west-2' }} - - - name: Publish to S3 - working-directory: installers - env: - S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}', github.ref_name) || format('{0}', github.ref_name) }} - run: &s3_upload | - echo "Uploading artifacts to s3://${AWS_S3_BUCKET}/${S3_PREFIX}" - for file in *; do - [ -e "$file" ] || continue - [ -f "$file" ] || continue - filename=$(basename "$file") - key="${S3_PREFIX}/${filename}" - aws s3 cp "$file" "s3://${AWS_S3_BUCKET}/${key}" --acl public-read - if command -v md5sum >/dev/null 2>&1; then md5sum "$file"; else md5 "$file"; fi - done - - - name: Trigger Docker Build - if: inputs.skip_docker_trigger != true && github.event.inputs.skip_docker_trigger != 'true' - working-directory: installers - env: - GH_TOKEN: ${{ secrets.DOCKER_OPENSTUDIO_PAT }} - BRANCH_NAME: ${{ github.ref_name }} - S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}', github.ref_name) || format('{0}', github.ref_name) }} - run: | - - # Find the 24.04 deb file locally - DEB_FILE=$(find . -name "*24.04*.deb" | head -n 1) - if [ -z "$DEB_FILE" ]; then - echo "::error::Could not find Ubuntu 24.04 deb file in installers directory" - ls -la - exit 1 - fi - - FILENAME=$(basename "$DEB_FILE") - echo "Found file: $FILENAME" - - # Construct S3 URL - # Replace + with %2B - ENCODED_FILENAME=${FILENAME//+/%2B} - BINARY_URL="https://${AWS_S3_BUCKET}.s3.amazonaws.com/${S3_PREFIX}/${ENCODED_FILENAME}" - echo "Binary URL: $BINARY_URL" - - # Parse version from filename - # Expected format: OpenStudio--.deb - if [[ "$FILENAME" =~ OpenStudio-(.+)-Ubuntu-24\.04.*\.deb ]]; then - OS_VERSION_FULL=${BASH_REMATCH[1]} - elif [[ "$FILENAME" =~ OpenStudio-(.+)-Linux.*\.deb ]]; then - OS_VERSION_FULL=${BASH_REMATCH[1]} - else - echo "::error::Could not parse version from filename: $FILENAME" - exit 1 - fi - - echo "Full Version: $OS_VERSION_FULL" - - # Logic from Jenkins: - # Split by + - IFS='+' read -r VER_PART SHA_PART <<< "$OS_VERSION_FULL" - - if [[ "$VER_PART" == *"-"* ]]; then - # 3.3.0-rc1 -> Ver: 3.3.0, Ext: rc1 - IFS='-' read -r OS_VERSION OS_VERSION_EXT <<< "$VER_PART" - else - # 3.3.0+sha -> Ver: 3.3.0, Ext: sha - OS_VERSION="$VER_PART" - OS_VERSION_EXT="$SHA_PART" - fi - - echo "OS Version: $OS_VERSION" - echo "OS Version Ext: $OS_VERSION_EXT" - - # Docker Tag Logic - if [[ "$BRANCH_NAME" == "develop" ]]; then - DOCKER_IMAGE_TAG="develop" - else - DOCKER_IMAGE_TAG="${OS_VERSION}-${OS_VERSION_EXT}" - fi - echo "Docker Image Tag: $DOCKER_IMAGE_TAG" - - # Trigger Workflow - echo "Triggering manual_update_develop workflow in NatLabRockies/docker-openstudio..." - gh workflow run 'manual_update_develop' \ - --repo NatLabRockies/docker-openstudio \ - --ref develop \ - -f docker_image_tag="$DOCKER_IMAGE_TAG" \ - -f os_installer_link="$BINARY_URL" \ - -f os_version="$OS_VERSION" \ - -f os_version_ext="$OS_VERSION_EXT" - macos-build: name: Build Packages for ${{ matrix.pretty }} if: (!inputs.jobs || contains(inputs.jobs, 'macos-build')) @@ -883,27 +774,6 @@ jobs: - *fail_on_test_failures - macos-publish: - name: Publish MacOS Artifacts - needs: [macos-build] - runs-on: ubuntu-latest - if: *publish_if - steps: - - name: Download all installers - uses: actions/download-artifact@v8 - with: - pattern: OS-Installers-macos-* - merge-multiple: true - path: installers - - - *configure_aws_credentials - - - name: Publish to S3 - working-directory: installers - env: - S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}/signed', github.ref_name) || format('{0}/signed', github.ref_name) }} - run: *s3_upload - windows-build: name: Build ${{ matrix.pretty }} if: (!inputs.jobs || contains(inputs.jobs, 'windows-build')) @@ -1191,6 +1061,136 @@ jobs: - *fail_on_test_failures + linux-publish: + name: Publish Linux Artifacts + needs: [linux-build] + runs-on: ubuntu-latest + if: &publish_if github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') + steps: + - name: Download all installers + uses: actions/download-artifact@v8 + with: + pattern: OS-Installers-{ubuntu,centos}-* + merge-multiple: true + path: installers + + - &configure_aws_credentials + name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v6 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION || 'us-west-2' }} + + - name: Publish to S3 + working-directory: installers + env: + S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}', github.ref_name) || format('{0}', github.ref_name) }} + run: &s3_upload | + echo "Uploading artifacts to s3://${AWS_S3_BUCKET}/${S3_PREFIX}" + for file in *; do + [ -e "$file" ] || continue + [ -f "$file" ] || continue + filename=$(basename "$file") + key="${S3_PREFIX}/${filename}" + aws s3 cp "$file" "s3://${AWS_S3_BUCKET}/${key}" --acl public-read + if command -v md5sum >/dev/null 2>&1; then md5sum "$file"; else md5 "$file"; fi + done + + - name: Trigger Docker Build + if: inputs.skip_docker_trigger != true && github.event.inputs.skip_docker_trigger != 'true' + working-directory: installers + env: + GH_TOKEN: ${{ secrets.DOCKER_OPENSTUDIO_PAT }} + BRANCH_NAME: ${{ github.ref_name }} + S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}', github.ref_name) || format('{0}', github.ref_name) }} + run: | + + # Find the 24.04 deb file locally + DEB_FILE=$(find . -name "*24.04*.deb" | head -n 1) + if [ -z "$DEB_FILE" ]; then + echo "::error::Could not find Ubuntu 24.04 deb file in installers directory" + ls -la + exit 1 + fi + + FILENAME=$(basename "$DEB_FILE") + echo "Found file: $FILENAME" + + # Construct S3 URL + # Replace + with %2B + ENCODED_FILENAME=${FILENAME//+/%2B} + BINARY_URL="https://${AWS_S3_BUCKET}.s3.amazonaws.com/${S3_PREFIX}/${ENCODED_FILENAME}" + echo "Binary URL: $BINARY_URL" + + # Parse version from filename + # Expected format: OpenStudio--.deb + if [[ "$FILENAME" =~ OpenStudio-(.+)-Ubuntu-24\.04.*\.deb ]]; then + OS_VERSION_FULL=${BASH_REMATCH[1]} + elif [[ "$FILENAME" =~ OpenStudio-(.+)-Linux.*\.deb ]]; then + OS_VERSION_FULL=${BASH_REMATCH[1]} + else + echo "::error::Could not parse version from filename: $FILENAME" + exit 1 + fi + + echo "Full Version: $OS_VERSION_FULL" + + # Logic from Jenkins: + # Split by + + IFS='+' read -r VER_PART SHA_PART <<< "$OS_VERSION_FULL" + + if [[ "$VER_PART" == *"-"* ]]; then + # 3.3.0-rc1 -> Ver: 3.3.0, Ext: rc1 + IFS='-' read -r OS_VERSION OS_VERSION_EXT <<< "$VER_PART" + else + # 3.3.0+sha -> Ver: 3.3.0, Ext: sha + OS_VERSION="$VER_PART" + OS_VERSION_EXT="$SHA_PART" + fi + + echo "OS Version: $OS_VERSION" + echo "OS Version Ext: $OS_VERSION_EXT" + + # Docker Tag Logic + if [[ "$BRANCH_NAME" == "develop" ]]; then + DOCKER_IMAGE_TAG="develop" + else + DOCKER_IMAGE_TAG="${OS_VERSION}-${OS_VERSION_EXT}" + fi + echo "Docker Image Tag: $DOCKER_IMAGE_TAG" + + # Trigger Workflow + echo "Triggering manual_update_develop workflow in NatLabRockies/docker-openstudio..." + gh workflow run 'manual_update_develop' \ + --repo NatLabRockies/docker-openstudio \ + --ref develop \ + -f docker_image_tag="$DOCKER_IMAGE_TAG" \ + -f os_installer_link="$BINARY_URL" \ + -f os_version="$OS_VERSION" \ + -f os_version_ext="$OS_VERSION_EXT" + + macos-publish: + name: Publish MacOS Artifacts + needs: [macos-build] + runs-on: ubuntu-latest + if: *publish_if + steps: + - name: Download all installers + uses: actions/download-artifact@v8 + with: + pattern: OS-Installers-macos-* + merge-multiple: true + path: installers + + - *configure_aws_credentials + + - name: Publish to S3 + working-directory: installers + env: + S3_PREFIX: ${{ github.ref_type == 'tag' && format('releases/{0}/signed', github.ref_name) || format('{0}/signed', github.ref_name) }} + run: *s3_upload + windows-publish: name: Publish Windows Artifacts needs: [windows-build] From 5972220b9aafac99b2e66c089f7a75ede1fcb523 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 16:38:36 +0100 Subject: [PATCH 51/54] CI: Linux and macOS share one build step, "cmake --build --preset conan-release" as in BUILDING.md (drops the unused resource monitor and the heartbeat) --- .github/workflows/full-build.yml | 47 ++++++-------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index a9f71eff84..e98df98584 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -145,7 +145,6 @@ jobs: run: shell: bash env: - MAX_BUILD_THREADS: ${{ matrix.max_jobs }} # $HOME in GHA containers. Explicit so the tools and actions/cache agree on the paths (#5711) CCACHE_DIR: /github/home/.ccache CONAN_HOME: /github/home/.conan2 @@ -256,23 +255,15 @@ jobs: ccache --zero-stats ccache --show-config - - name: Build with Ninja - working-directory: ${{ env.OPENSTUDIO_BUILD }} + - &build_with_ninja + name: Build with Ninja + shell: bash run: | - . ./conanbuild.sh - # Start resource monitor (records RSS samples for later summary) - echo "timestamp PID RSS_KB COMM" > mem_samples.log - ( while true; do - sleep 60; - stamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); - if command -v ps >/dev/null 2>&1; then ps -eo pid,rsz,comm --sort=-rsz | head -n 5 | awk -v s="$stamp" '{print s" "$1" "$2" "$3}' >> mem_samples.log; fi; - done ) & - HB_PID=$! - cmake --build . --parallel ${{ matrix.max_jobs }} 2>&1 | tee build.log - BUILD_EXIT=${PIPESTATUS[0]} - kill $HB_PID || true - ninja -d stats || true - exit $BUILD_EXIT + # Run from the source dir, where CMakeUserPresets.json is. The preset carries the Conan build environment (SWIG_LIB, ...) + cmake --build --preset conan-release --parallel ${{ matrix.max_jobs }} 2>&1 | tee ${{ env.OPENSTUDIO_BUILD }}/build.log + build_exit=${PIPESTATUS[0]} + ninja -C ${{ env.OPENSTUDIO_BUILD }} -d stats || true + exit $build_exit - &show_ccache_stats name: Show ccache stats @@ -471,7 +462,6 @@ jobs: exclude_regex: "" max_jobs: 3 env: - MAX_BUILD_THREADS: ${{ matrix.max_jobs }} CCACHE_DIR: ${{ github.workspace }}/.ccache permissions: @@ -559,25 +549,7 @@ jobs: - *show_restored_ccache_stats - - name: Build with Ninja - working-directory: ${{ env.OPENSTUDIO_BUILD }} - run: | - . ./conanbuild.sh - while true; do - sleep 300 - echo "[heartbeat] $(date -u +"%H:%M:%S")" - if command -v top >/dev/null 2>&1; then top -l 1 -s 0 | grep PhysMem || true; fi - df -h . | tail -1 | awk '{print "[disk] used=" $3 "/" $2 " (" $5 ")"}' - # BSD ps -m sorts by memory: no sort, which printed 'Broken pipe' when head closed the pipe - if command -v ps >/dev/null 2>&1; then ps -m -eo pid,pmem,rss,comm | head -n 6; fi - done & - heartbeat_pid=$! - cmake --build . --parallel ${MAX_BUILD_THREADS} 2>&1 | tee build.log - build_exit=${PIPESTATUS[0]} - kill $heartbeat_pid || true - ninja -d stats || true - if [ -f build.log ]; then tail -n 40 build.log; fi - exit $build_exit + - *build_with_ninja - *show_ccache_stats @@ -798,7 +770,6 @@ jobs: run: shell: pwsh env: - MAX_BUILD_THREADS: ${{ matrix.max_jobs }} CCACHE_DIR: ${{ github.workspace }}\.ccache RUBYOPT: "-Eutf-8:utf-8" PYTHONUTF8: "1" From eaa21383935a80cd2ee5246346e96b98628b8edc Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 16:43:30 +0100 Subject: [PATCH 52/54] CI: Windows: configure and build with the conan-release presets (cmake --preset / cmake --build --preset), still through cmd /c "call conanbuild.bat && ..." via $env:ComSpec (conan's conanbuild.ps1 calls a bare 'cmd', which resolves to the MSYS2 cmd script setup-ruby puts on the PATH) --- .github/workflows/full-build.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index e98df98584..c5ed01de0c 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -840,22 +840,17 @@ jobs: run: | # ruby/test/CMakeLists.txt only looks in hardcoded locations (NO_DEFAULT_PATH, to avoid the conan ruby), not in setup-ruby's toolcache $rubyExe = (Get-Command ruby).Source + # $env:ComSpec, not cmd: setup-ruby puts its MSYS2 usr/bin, which has a 'cmd' script, ahead in the PATH (that's also why we can't use conan's conanbuild.ps1) & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --preset conan-release -DSYSTEM_RUBY_EXECUTABLE:FILEPATH=`"$rubyExe`" -DENABLE_PCH:BOOL=${{ env.ENABLE_PCH }} -DCMAKE_JOB_POOL_LINK:STRING=console" - *show_restored_ccache_stats - name: Build with Ninja - working-directory: ${{ env.OPENSTUDIO_BUILD }} - shell: pwsh run: | - # Use $env:ComSpec to ensure we call the Windows Command Prompt, not the MSYS2 cmd found in PATH - & $env:ComSpec /c "call conanbuild.bat && cmake --build . --parallel ${{ matrix.max_jobs }} -- -d stats 2>&1" | Tee-Object -FilePath "build.log" - - # Check the exit code of the cmd process, not Tee-Object - if ($LASTEXITCODE -ne 0) { - Write-Error "Build failed with exit code $LASTEXITCODE" - exit $LASTEXITCODE - } + # $env:ComSpec, not cmd: see Configure with CMake + & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --build --preset conan-release --parallel ${{ matrix.max_jobs }} -- -d stats 2>&1" | Tee-Object -FilePath "${{ env.OPENSTUDIO_BUILD }}\build.log" + # The exit code of the cmd process, not Tee-Object's + exit $LASTEXITCODE - *show_ccache_stats @@ -878,7 +873,6 @@ jobs: with: node-version: "18" - - name: Create .env file for Signing if: github.repository == 'NatLabRockies/OpenStudio' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_s3 == true || github.event.inputs.publish_to_s3 == 'true') working-directory: ${{ env.OPENSTUDIO_BUILD }} From 3a30fb6403e6ff86861148b738b90a0b887b3f5c Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 16:51:44 +0100 Subject: [PATCH 53/54] CI: build and test with as many jobs as the runner has cores instead of a hard-coded max_jobs per platform (macOS x64 was using 3 of its 4); max_jobs can still be set on a matrix entry to limit it, eg after an OOM --- .github/workflows/full-build.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index c5ed01de0c..36d11a9ac5 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -103,6 +103,7 @@ jobs: fail-fast: false matrix: platform: [centos-9-x64, ubuntu-2404-x64, ubuntu-2404-arm64] + # Optional per entry: max_jobs: N to limit the build and CTest parallelism (eg if a build runs out of memory). Default: the runner's cores include: - platform: centos-9-x64 pretty: CentOS 9 (AlmaLinux) x64 @@ -114,7 +115,6 @@ jobs: upload_globs: | *.rpm *OpenStudio*x86_64.tar.gz - max_jobs: 4 exclude_regex: "BCLFixture.RemoteBCLMetaSearchTest" - platform: ubuntu-2404-x64 pretty: Ubuntu 24.04 x64 @@ -126,7 +126,6 @@ jobs: upload_globs: | *.deb *OpenStudio*x86_64.tar.gz - max_jobs: 4 exclude_regex: "" - platform: ubuntu-2404-arm64 pretty: Ubuntu 24.04 ARM64 @@ -138,7 +137,6 @@ jobs: upload_globs: | *.deb *OpenStudio*arm64.tar.gz - max_jobs: 4 # SqlFileFixture.AnnualTotalCosts needed until E+ itself disables ffp-contract on arm64 GCC exclude_regex: "SqlFileFixture.AnnualTotalCosts|OpenStudioCLI.*test_measure_manager" defaults: @@ -260,7 +258,8 @@ jobs: shell: bash run: | # Run from the source dir, where CMakeUserPresets.json is. The preset carries the Conan build environment (SWIG_LIB, ...) - cmake --build --preset conan-release --parallel ${{ matrix.max_jobs }} 2>&1 | tee ${{ env.OPENSTUDIO_BUILD }}/build.log + # Number of jobs: from the preset (the runner's cores), unless matrix.max_jobs is set + cmake --build --preset conan-release ${{ matrix.max_jobs && format('--parallel {0}', matrix.max_jobs) || '' }} 2>&1 | tee ${{ env.OPENSTUDIO_BUILD }}/build.log build_exit=${PIPESTATUS[0]} ninja -C ${{ env.OPENSTUDIO_BUILD }} -d stats || true exit $build_exit @@ -313,9 +312,15 @@ jobs: ctest_command+=(-E "^($exclude_pattern)$") fi + # Number of jobs: the runner's cores, unless matrix.max_jobs is set + jobs="${{ matrix.max_jobs }}" + if [ -z "$jobs" ]; then + jobs=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu) + fi + begin_group "Running tests..." - echo "Running: ${ctest_command[@]} -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml" - "${ctest_command[@]}" -j ${{ matrix.max_jobs }} --output-junit Testing/Results.xml || overall_exit_code=$? + echo "Running: ${ctest_command[@]} -j $jobs --output-junit Testing/Results.xml" + "${ctest_command[@]}" -j $jobs --output-junit Testing/Results.xml || overall_exit_code=$? echo "::endgroup::" if [ $overall_exit_code -ne 0 ]; then @@ -436,6 +441,7 @@ jobs: fail-fast: false matrix: platform: [macos-x64, macos-arm64] + # Optional per entry: max_jobs: N to limit the build and CTest parallelism (eg if a build runs out of memory). Default: the runner's cores include: - macos_dev_target: "12.1" platform: macos-x64 @@ -448,7 +454,6 @@ jobs: dmg_glob: "*.dmg" tar_glob: "*OpenStudio*x86_64.tar.gz" exclude_regex: "" - max_jobs: 3 - macos_dev_target: "13.0" platform: macos-arm64 pretty: "macOS ARM64" @@ -460,7 +465,6 @@ jobs: dmg_glob: "*.dmg" tar_glob: "*OpenStudio*arm64.tar.gz" exclude_regex: "" - max_jobs: 3 env: CCACHE_DIR: ${{ github.workspace }}/.ccache @@ -755,6 +759,7 @@ jobs: fail-fast: false matrix: platform: [windows-2022-x64] + # Optional per entry: max_jobs: N to limit the build and CTest parallelism (eg if a build runs out of memory). Default: the runner's cores include: - platform: windows-2022-x64 pretty: Windows 2022 x64 @@ -764,7 +769,6 @@ jobs: arch: x86_64 python-arch: x64 allow_failure: false - max_jobs: 4 exclude_regex: "" defaults: run: @@ -848,7 +852,8 @@ jobs: - name: Build with Ninja run: | # $env:ComSpec, not cmd: see Configure with CMake - & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --build --preset conan-release --parallel ${{ matrix.max_jobs }} -- -d stats 2>&1" | Tee-Object -FilePath "${{ env.OPENSTUDIO_BUILD }}\build.log" + # Number of jobs: from the preset (the runner's cores), unless matrix.max_jobs is set + & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --build --preset conan-release ${{ matrix.max_jobs && format('--parallel {0}', matrix.max_jobs) || '' }} -- -d stats 2>&1" | Tee-Object -FilePath "${{ env.OPENSTUDIO_BUILD }}\build.log" # The exit code of the cmd process, not Tee-Object's exit $LASTEXITCODE From 0390427b8a077d2f5d39fc4549cb01ce81eefe64 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 26 Nov 2026 16:52:54 +0100 Subject: [PATCH 54/54] CI: drop the max_jobs option: builds use the preset's jobs (no fallback needed for now... can readd if really needed) --- .github/workflows/full-build.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/full-build.yml b/.github/workflows/full-build.yml index 36d11a9ac5..75faa371ce 100644 --- a/.github/workflows/full-build.yml +++ b/.github/workflows/full-build.yml @@ -103,7 +103,6 @@ jobs: fail-fast: false matrix: platform: [centos-9-x64, ubuntu-2404-x64, ubuntu-2404-arm64] - # Optional per entry: max_jobs: N to limit the build and CTest parallelism (eg if a build runs out of memory). Default: the runner's cores include: - platform: centos-9-x64 pretty: CentOS 9 (AlmaLinux) x64 @@ -258,8 +257,7 @@ jobs: shell: bash run: | # Run from the source dir, where CMakeUserPresets.json is. The preset carries the Conan build environment (SWIG_LIB, ...) - # Number of jobs: from the preset (the runner's cores), unless matrix.max_jobs is set - cmake --build --preset conan-release ${{ matrix.max_jobs && format('--parallel {0}', matrix.max_jobs) || '' }} 2>&1 | tee ${{ env.OPENSTUDIO_BUILD }}/build.log + cmake --build --preset conan-release 2>&1 | tee ${{ env.OPENSTUDIO_BUILD }}/build.log build_exit=${PIPESTATUS[0]} ninja -C ${{ env.OPENSTUDIO_BUILD }} -d stats || true exit $build_exit @@ -312,11 +310,7 @@ jobs: ctest_command+=(-E "^($exclude_pattern)$") fi - # Number of jobs: the runner's cores, unless matrix.max_jobs is set - jobs="${{ matrix.max_jobs }}" - if [ -z "$jobs" ]; then - jobs=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu) - fi + jobs=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu) begin_group "Running tests..." echo "Running: ${ctest_command[@]} -j $jobs --output-junit Testing/Results.xml" @@ -441,7 +435,6 @@ jobs: fail-fast: false matrix: platform: [macos-x64, macos-arm64] - # Optional per entry: max_jobs: N to limit the build and CTest parallelism (eg if a build runs out of memory). Default: the runner's cores include: - macos_dev_target: "12.1" platform: macos-x64 @@ -759,7 +752,6 @@ jobs: fail-fast: false matrix: platform: [windows-2022-x64] - # Optional per entry: max_jobs: N to limit the build and CTest parallelism (eg if a build runs out of memory). Default: the runner's cores include: - platform: windows-2022-x64 pretty: Windows 2022 x64 @@ -852,8 +844,7 @@ jobs: - name: Build with Ninja run: | # $env:ComSpec, not cmd: see Configure with CMake - # Number of jobs: from the preset (the runner's cores), unless matrix.max_jobs is set - & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --build --preset conan-release ${{ matrix.max_jobs && format('--parallel {0}', matrix.max_jobs) || '' }} -- -d stats 2>&1" | Tee-Object -FilePath "${{ env.OPENSTUDIO_BUILD }}\build.log" + & $env:ComSpec /c "call ${{ env.OPENSTUDIO_BUILD }}\conanbuild.bat && cmake --build --preset conan-release -- -d stats 2>&1" | Tee-Object -FilePath "${{ env.OPENSTUDIO_BUILD }}\build.log" # The exit code of the cmd process, not Tee-Object's exit $LASTEXITCODE