From 827b9d5b8ad40241474a2405e4fc24c705a18a28 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Tue, 1 Dec 2026 15:07:01 +0000 Subject: [PATCH 01/18] Add a continuous integration workflow for the Chrono-free build on Linux. The workflow builds with scripts/unix/build.sh --no-chrono --external on ubuntu-24.04, runs the chrono-free CTest label and the downstream-consumer check, and uploads the JUnit report and logs. scripts/ci/check_ctest_junit.py fails a run in which a test was skipped or not run. CTest exits with 0 in that case, for example when a Python test returns its SKIP_RETURN_CODE because a package is missing. --- .github/workflows/ci.yml | 119 ++++++++++++++++++++++++++++ scripts/README.md | 1 + scripts/ci/check_ctest_junit.py | 136 ++++++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 scripts/ci/check_ctest_junit.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..50c870b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,119 @@ +# Continuous integration for SEA-Stack. +# +# Test suites and CTest labels are described in tests/README.md and +# tests/TEST_SUITES_REFERENCE.md. Each job uses the documented build and test +# entry points under scripts/, so a failure here can be reproduced locally with +# the same commands. +name: CI + +on: + push: + branches: + - dev + - main + - 'release/**' + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +env: + # Thread counts are fixed so that results and timings are comparable between + # runs. The standard runners have 4 virtual CPUs: 2 concurrent tests, each + # with 2 OpenMP threads. + OMP_NUM_THREADS: '2' + OPENBLAS_NUM_THREADS: '1' + CTEST_JOBS: '2' + MPLBACKEND: Agg + +jobs: + chrono-free-linux: + name: Chrono-free build and tests (Linux) + runs-on: ubuntu-24.04 + timeout-minutes: 30 + steps: + - name: Check out the source + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.12' + + - name: Install system packages + run: | + sudo apt-get update + sudo apt-get install --yes --no-install-recommends \ + ninja-build libeigen3-dev libhdf5-dev + + - name: Install Python packages + run: python3 -m pip install --requirement tests/regression/run_seastack/requirements.txt + + - name: Record the environment + run: | + echo "Runner: ${RUNNER_OS} ${RUNNER_ARCH}, image ${ImageOS:-unknown} ${ImageVersion:-unknown}" + echo "CPUs: $(nproc)" + grep -m1 'model name' /proc/cpuinfo || true + free -g | sed -n '1,2p' + df -h . + cmake --version | head -n 1 + echo "ninja $(ninja --version)" + c++ --version | head -n 1 + python3 --version + python3 -m pip list --format=freeze | grep -i -E '^(numpy|h5py|pyyaml|matplotlib)==' + echo "OMP_NUM_THREADS=${OMP_NUM_THREADS} CTEST_JOBS=${CTEST_JOBS}" + + # build.sh passes PythonRoot to CMake, so the tests use the interpreter + # that has the packages installed above. + - name: Write build-config.json + run: | + printf '{"ChronoDir": "", "PythonRoot": "%s", "HDF5Dir": "", "Generator": ""}\n' \ + "${pythonLocation}" > build-config.json + cat build-config.json + + - name: Build + id: build + run: ./scripts/unix/build.sh --no-chrono --external --verbose + + - name: Run the chrono-free tests + id: ctest + run: > + ctest --test-dir build -C Release -L chrono-free --no-tests=error + --output-on-failure -j "${CTEST_JOBS}" + --output-junit test-results/chrono-free.xml + + # CTest exits with 0 when a test is skipped. Fail unless every test ran. + - name: Check that every test ran and passed + if: ${{ !cancelled() && steps.ctest.conclusion != 'skipped' }} + run: > + python3 scripts/ci/check_ctest_junit.py build/test-results/chrono-free.xml + --summary "${GITHUB_STEP_SUMMARY}" + + - name: Downstream-consumer check + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: ./scripts/unix/run_consumer_check.sh --work-dir "${RUNNER_TEMP}/consumer-check" + + - name: Record disk use + if: ${{ !cancelled() }} + run: | + df -h . + du -sh build || true + + - name: Upload test results + if: ${{ !cancelled() }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: chrono-free-linux-results + path: | + build/test-results/ + build/Testing/Temporary/LastTest.log + build/build-diagnostics.log + if-no-files-found: warn + retention-days: 14 diff --git a/scripts/README.md b/scripts/README.md index dbedeb1..fbe8bf9 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -4,6 +4,7 @@ |----------|-----| | [`unix/`](unix/) | Bash drivers for **macOS and Linux** (build, CTest wrappers, demo smoke). | | [`windows/`](windows/) | **PowerShell** equivalents for Windows. | +| [`ci/`](ci/) | Helpers for the continuous integration workflows in `.github/workflows/`. | | Repo root of `scripts/` | Cross-platform **Python** helpers (`seastack_build_prepare.py`, `validate_campaign_schema.py`). | From the **sea-stack** repository root: diff --git a/scripts/ci/check_ctest_junit.py b/scripts/ci/check_ctest_junit.py new file mode 100644 index 0000000..73a65a0 --- /dev/null +++ b/scripts/ci/check_ctest_junit.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +"""Check a CTest JUnit report: every registered test must have run and passed. + +Usage: + python3 scripts/ci/check_ctest_junit.py [--summary FILE] [--slowest N] + +Write the report with `ctest --output-junit `. + +CTest exits with 0 when a test is skipped, for example when a Python test +returns its SKIP_RETURN_CODE because a package is missing. On a continuous +integration runner every dependency is expected to be installed, so a skipped +test means that the run did not check what it claims to check. This script +fails when: + - the report contains no tests; + - a test failed; + - a test was skipped, disabled or not run. + +--summary appends a Markdown summary to FILE (for example the file named by +GITHUB_STEP_SUMMARY). --slowest sets how many of the slowest tests are listed +(default 10). + +Exit code 0 = pass, 1 = fail, 2 = usage error or unreadable report. +Standard library only. +""" +from __future__ import annotations + +import argparse +import sys +import xml.etree.ElementTree as ET +from pathlib import Path +from typing import NamedTuple + + +class TestResult(NamedTuple): + name: str + outcome: str # "passed", "failed" or "not run" + detail: str + seconds: float + + +def classify(case: ET.Element) -> TestResult: + """Map one element to passed / failed / not run.""" + name = case.get("name", "") + status = case.get("status", "") + try: + seconds = float(case.get("time", "0") or 0.0) + except ValueError: + seconds = 0.0 + + failure = case.find("failure") + if failure is None: + failure = case.find("error") + skipped = case.find("skipped") + + if status == "run" and failure is None and skipped is None: + return TestResult(name, "passed", "", seconds) + if status == "fail" or failure is not None: + message = failure.get("message", "") if failure is not None else "" + return TestResult(name, "failed", message, seconds) + message = skipped.get("message", "") if skipped is not None else "" + return TestResult(name, "not run", message or f"status={status or 'missing'}", seconds) + + +def read_results(report: Path) -> list[TestResult]: + root = ET.parse(report).getroot() + return [classify(case) for case in root.iter("testcase")] + + +def markdown_summary(title: str, results: list[TestResult], slowest: int) -> str: + passed = sum(r.outcome == "passed" for r in results) + failed = [r for r in results if r.outcome == "failed"] + not_run = [r for r in results if r.outcome == "not run"] + total_seconds = sum(r.seconds for r in results) + + lines = [ + f"### {title}", + "", + "| Tests | Passed | Failed | Skipped or not run | Summed test time |", + "|------:|-------:|-------:|-------------------:|-----------------:|", + f"| {len(results)} | {passed} | {len(failed)} | {len(not_run)} | {total_seconds:.1f} s |", + "", + ] + problems = failed + not_run + if problems: + lines += ["| Test | Outcome | Detail |", "|------|---------|--------|"] + lines += [f"| `{r.name}` | {r.outcome} | {r.detail} |" for r in problems] + lines.append("") + if slowest > 0 and results: + ranked = sorted(results, key=lambda r: r.seconds, reverse=True)[:slowest] + lines += ["| Slowest tests | Time |", "|---------------|-----:|"] + lines += [f"| `{r.name}` | {r.seconds:.1f} s |" for r in ranked] + lines.append("") + return "\n".join(lines) + "\n" + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("report", type=Path, help="JUnit XML written by ctest --output-junit") + parser.add_argument("--summary", type=Path, help="append a Markdown summary to this file") + parser.add_argument("--slowest", type=int, default=10, help="number of slowest tests to list") + args = parser.parse_args() + + if not args.report.is_file(): + print(f"[FAIL] JUnit report not found: {args.report}", file=sys.stderr) + return 2 + try: + results = read_results(args.report) + except ET.ParseError as error: + print(f"[FAIL] cannot parse {args.report}: {error}", file=sys.stderr) + return 2 + + summary = markdown_summary(f"CTest results: {args.report.stem}", results, args.slowest) + if args.summary is not None: + with args.summary.open("a", encoding="utf-8") as handle: + handle.write(summary) + + failed = [r for r in results if r.outcome == "failed"] + not_run = [r for r in results if r.outcome == "not run"] + passed = len(results) - len(failed) - len(not_run) + print(f"{args.report}: {len(results)} tests, {passed} passed, " + f"{len(failed)} failed, {len(not_run)} skipped or not run") + for result in failed + not_run: + print(f" [{result.outcome}] {result.name}: {result.detail}") + + if not results: + print("[FAIL] the report contains no tests", file=sys.stderr) + return 1 + if failed or not_run: + print("[FAIL] every registered test must run and pass", file=sys.stderr) + return 1 + print("[OK] every registered test ran and passed") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From 4ae733584b6a35693302d521521f14bfb611da78 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Tue, 1 Dec 2026 15:36:20 +0000 Subject: [PATCH 02/18] Build Chrono in continuous integration and run the unit and regression tests on Linux. scripts/unix/build_chrono.sh builds and installs the pinned Chrono 10.0.0 tag with the portable recipe in docs/build/BUILD_CHRONO.md (Parsers, HDF5, OpenMP, CH_USE_SIMD=OFF, 16-byte Eigen alignment, no Python link) and fails if the installed package exports -march=native. The new workflow job restores that installation from the Actions cache or builds it, builds SEA-Stack with MoorDyn, external modules and demos, and runs the unit, regression and external CTest labels with 2 concurrent tests and 2 OpenMP threads each. scripts/unix/ctest_suite.sh gains --junit FILE, which passes --output-junit to ctest; behaviour without the option is unchanged. --- .github/workflows/ci.yml | 138 +++++++++++++++++++++++++++++++++++ docs/build/BUILD_CHRONO.md | 12 +++ scripts/unix/build_chrono.sh | 128 ++++++++++++++++++++++++++++++++ scripts/unix/ctest_suite.sh | 11 ++- 4 files changed, 286 insertions(+), 3 deletions(-) create mode 100755 scripts/unix/build_chrono.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50c870b..191a834 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,3 +117,141 @@ jobs: build/build-diagnostics.log if-no-files-found: warn retention-days: 14 + + chrono-linux: + name: Chrono build, unit and regression tests (Linux) + runs-on: ubuntu-24.04 + timeout-minutes: 120 + steps: + - name: Check out the source + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + submodules: recursive + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.12' + + - name: Install system packages + run: | + sudo apt-get update + sudo apt-get install --yes --no-install-recommends \ + ninja-build libeigen3-dev libhdf5-dev + + # pytest runs tests/unit/python/test_demo_features.py, which is skipped without it. + - name: Install Python packages + run: | + python3 -m pip install --requirement tests/regression/run_seastack/requirements.txt + python3 -m pip install pytest + + - name: Record the environment + run: | + echo "Runner: ${RUNNER_OS} ${RUNNER_ARCH}, image ${ImageOS:-unknown} ${ImageVersion:-unknown}" + echo "CPUs: $(nproc)" + grep -m1 'model name' /proc/cpuinfo || true + free -g | sed -n '1,2p' + df -h . + cmake --version | head -n 1 + echo "ninja $(ninja --version)" + c++ --version | head -n 1 + python3 --version + python3 -m pip list --format=freeze | grep -i -E '^(numpy|h5py|pyyaml|matplotlib|pytest)==' + echo "OMP_NUM_THREADS=${OMP_NUM_THREADS} CTEST_JOBS=${CTEST_JOBS}" + + # Chrono is built by scripts/unix/build_chrono.sh and reused until that + # script, the runner image or the compiler version changes. + - name: Locate the Chrono installation + id: chrono + run: | + echo "prefix=${HOME}/seastack-deps/chrono-10.0.0" >> "${GITHUB_OUTPUT}" + echo "compiler=gcc-$(c++ -dumpfullversion)" >> "${GITHUB_OUTPUT}" + + - name: Restore the Chrono installation + id: chrono-cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.chrono.outputs.prefix }} + key: chrono-ubuntu-24.04-${{ steps.chrono.outputs.compiler }}-${{ hashFiles('scripts/unix/build_chrono.sh') }} + + - name: Build Chrono + if: ${{ steps.chrono-cache.outputs.cache-hit != 'true' }} + env: + CHRONO_PREFIX: ${{ steps.chrono.outputs.prefix }} + run: | + ./scripts/unix/build_chrono.sh --prefix "${CHRONO_PREFIX}" --work-dir "${RUNNER_TEMP}/chrono-work" + rm -rf "${RUNNER_TEMP}/chrono-work" + du -sh "${CHRONO_PREFIX}" + + # Saved here, not at the end of the job, so that a test failure does not + # discard the Chrono build. + - name: Save the Chrono installation + if: ${{ steps.chrono-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.chrono.outputs.prefix }} + key: ${{ steps.chrono-cache.outputs.cache-primary-key }} + + # The Chrono libraries are outside the system library path, so the test + # executables need LD_LIBRARY_PATH (docs/build/RELEASE_CHECKLIST.md). + - name: Write build-config.json + env: + CHRONO_PREFIX: ${{ steps.chrono.outputs.prefix }} + run: | + config_file="$(find "${CHRONO_PREFIX}" -name ChronoConfig.cmake -print | head -n 1)" + test -n "${config_file}" + printf '{"ChronoDir": "%s", "PythonRoot": "%s", "HDF5Dir": "", "Generator": ""}\n' \ + "$(dirname "${config_file}")" "${pythonLocation}" > build-config.json + cat build-config.json + echo "LD_LIBRARY_PATH=${CHRONO_PREFIX}/lib" >> "${GITHUB_ENV}" + + - name: Build + id: build + run: ./scripts/unix/build.sh --moordyn --external --demos --verbose + + - name: Run the unit tests + run: ./scripts/unix/ctest_suite.sh unit -j "${CTEST_JOBS}" --junit test-results/unit.xml + + - name: Run the regression tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: > + ./scripts/unix/ctest_suite.sh regression -j "${CTEST_JOBS}" --no-pdf + --junit test-results/regression.xml + + - name: Run the external-module tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: > + ctest --test-dir build -C Release -L '^external$' --no-tests=error + --output-on-failure -j "${CTEST_JOBS}" + --output-junit test-results/external.xml + + # CTest exits with 0 when a test is skipped. Fail unless every test ran. + - name: Check that every test ran and passed + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: | + status=0 + for suite in unit regression external; do + python3 scripts/ci/check_ctest_junit.py "build/test-results/${suite}.xml" \ + --summary "${GITHUB_STEP_SUMMARY}" || status=1 + done + exit "${status}" + + - name: Record disk use + if: ${{ !cancelled() }} + run: | + df -h . + du -sh build || true + + - name: Upload test results + if: ${{ !cancelled() }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: chrono-linux-results + path: | + build/test-results/ + build/Testing/Temporary/LastTest.log + build/build-diagnostics.log + build/bin/Release/results/tests/regression/report/ + if-no-files-found: warn + retention-days: 14 diff --git a/docs/build/BUILD_CHRONO.md b/docs/build/BUILD_CHRONO.md index a8837f7..bc041fa 100644 --- a/docs/build/BUILD_CHRONO.md +++ b/docs/build/BUILD_CHRONO.md @@ -134,6 +134,18 @@ cmake --build /path/to/chrono-build --parallel cmake --install /path/to/chrono-build ``` +[`scripts/unix/build_chrono.sh`](../../scripts/unix/build_chrono.sh) runs this +recipe for the pinned `10.0.0` tag and checks the result: + +```bash +./scripts/unix/build_chrono.sh --prefix /path/to/chrono-install # headless +./scripts/unix/build_chrono.sh --prefix /path/to/chrono-install --vsg --prefix-path /path/to/vsg-install +``` + +It also turns off the optional Python parser +(`CMAKE_DISABLE_FIND_PACKAGE_Python3=ON`), so no Chrono library links Python. +The continuous integration workflow builds Chrono with the same script. + Notes: - **`CH_USE_SIMD=OFF`** is what keeps `-march=native` out of Chrono objects and diff --git a/scripts/unix/build_chrono.sh b/scripts/unix/build_chrono.sh new file mode 100755 index 0000000..55e5a1b --- /dev/null +++ b/scripts/unix/build_chrono.sh @@ -0,0 +1,128 @@ +#!/usr/bin/env bash +# Build and install Project Chrono for SEA-Stack on macOS/Linux. +# +# Implements the portable recipe in docs/build/BUILD_CHRONO.md: release tag +# 10.0.0, Parsers + HDF5 + OpenMP, CH_USE_SIMD=OFF and a 16-byte Eigen +# alignment (the Eigen ABI contract of SEAStack::Core), no Python link. +# +# Usage: scripts/unix/build_chrono.sh --prefix DIR [options] +# --prefix DIR Install prefix (required), e.g. /opt/chrono-10.0.0 +# --work-dir DIR Source and build directory +# (default: ${TMPDIR:-/tmp}/seastack-chrono-10.0.0) +# --vsg Enable the Chrono VSG module (needs VSG, vsgXchange and +# vsgImGui; pass their install prefix with --prefix-path) +# --prefix-path PATH Extra CMAKE_PREFIX_PATH (e.g. the VSG install prefix) +# --jobs N Parallel build jobs (default: CMake/Ninja default) +# -h, --help This help +# +# Prerequisites: git, cmake, a C++17 compiler, Eigen3, HDF5 and OpenMP (see +# docs/build/BUILD_MACOS.md). Ninja is used when it is on PATH. +# +# After a successful run, set "ChronoDir" in build-config.json to the directory +# printed at the end (the one that contains ChronoConfig.cmake). +set -euo pipefail + +CHRONO_REPOSITORY="https://github.com/projectchrono/chrono.git" +CHRONO_TAG="10.0.0" +# Commit of the 10.0.0 tag. The checkout is verified against it because a +# Chrono main build can also report version 10.0.0. +CHRONO_COMMIT="9faf13dd8f1128dd75ed233a9627027b0422c3f7" + +PREFIX="" +WORK_DIR="${TMPDIR:-/tmp}/seastack-chrono-${CHRONO_TAG}" +ENABLE_VSG=OFF +PREFIX_PATH="" +JOBS="" + +usage() { sed -n '2,22p' "$0" | sed 's/^# \{0,1\}//'; } +fail() { echo "[FAIL] $*" >&2; exit 1; } + +while [[ $# -gt 0 ]]; do + case "$1" in + --prefix) PREFIX="$2"; shift 2 ;; + --work-dir) WORK_DIR="$2"; shift 2 ;; + --vsg) ENABLE_VSG=ON; shift ;; + --prefix-path) PREFIX_PATH="$2"; shift 2 ;; + --jobs) JOBS="$2"; shift 2 ;; + -h|--help) usage; exit 0 ;; + *) echo "[FAIL] unknown argument: $1" >&2; usage >&2; exit 2 ;; + esac +done + +[[ -n "${PREFIX}" ]] || { echo "[FAIL] --prefix is required" >&2; usage >&2; exit 2; } +command -v git >/dev/null || fail "git not on PATH" +command -v cmake >/dev/null || fail "cmake not on PATH" + +SOURCE_DIR="${WORK_DIR}/chrono" +BUILD_DIR="${WORK_DIR}/build" + +echo "Chrono tag: ${CHRONO_TAG} (${CHRONO_COMMIT})" +echo "Install prefix: ${PREFIX}" +echo "Work dir: ${WORK_DIR}" +echo "VSG module: ${ENABLE_VSG}" + +echo "" +echo ">> Source" +if [[ ! -d "${SOURCE_DIR}/.git" ]]; then + mkdir -p "${WORK_DIR}" + git clone --depth 1 --branch "${CHRONO_TAG}" "${CHRONO_REPOSITORY}" "${SOURCE_DIR}" +fi +actual_commit="$(git -C "${SOURCE_DIR}" rev-parse HEAD)" +if [[ "${actual_commit}" != "${CHRONO_COMMIT}" ]]; then + fail "${SOURCE_DIR} is at ${actual_commit}, expected ${CHRONO_COMMIT} (tag ${CHRONO_TAG})" +fi +echo " [OK] ${SOURCE_DIR} at ${actual_commit}" + +echo "" +echo ">> Configure" +cmake_args=( + -S "${SOURCE_DIR}" + -B "${BUILD_DIR}" + -DCMAKE_BUILD_TYPE=Release + "-DCMAKE_INSTALL_PREFIX=${PREFIX}" + "-DCMAKE_CXX_FLAGS=-DEIGEN_MAX_ALIGN_BYTES=16 -DEIGEN_MAX_STATIC_ALIGN_BYTES=16" + -DBUILD_SHARED_LIBS=ON + -DBUILD_TESTING=OFF + -DBUILD_DEMOS=OFF + -DBUILD_BENCHMARKING=OFF + -DCH_ENABLE_MODULE_PARSERS=ON + -DCH_ENABLE_HDF5=ON + -DCH_ENABLE_OPENMP=ON + "-DCH_ENABLE_MODULE_VSG=${ENABLE_VSG}" + -DCH_USE_SIMD=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON +) +if command -v ninja >/dev/null; then + cmake_args+=(-G Ninja) +fi +if [[ -n "${PREFIX_PATH}" ]]; then + cmake_args+=("-DCMAKE_PREFIX_PATH=${PREFIX_PATH}") +fi +cmake "${cmake_args[@]}" + +echo "" +echo ">> Build" +if [[ -n "${JOBS}" ]]; then + cmake --build "${BUILD_DIR}" --parallel "${JOBS}" +else + cmake --build "${BUILD_DIR}" --parallel +fi + +echo "" +echo ">> Install" +cmake --install "${BUILD_DIR}" + +echo "" +echo ">> Verify" +config_file="$(find "${PREFIX}" \( -name ChronoConfig.cmake -o -name chrono-config.cmake \) -print | head -n 1)" +[[ -n "${config_file}" ]] || fail "no Chrono package config found under ${PREFIX}" +chrono_dir="$(dirname "${config_file}")" +# The installed targets must not export native-architecture flags: they would +# raise Eigen's default alignment in every target that links Chrono. +if grep -R -l -E -e '-m(arch|tune)=native' "${chrono_dir}" >/dev/null 2>&1; then + fail "the installed Chrono package exports -march=native / -mtune=native (${chrono_dir})" +fi +echo " [OK] no -march=native / -mtune=native in the exported targets" +echo "" +echo "Chrono ${CHRONO_TAG} installed." +echo "ChronoDir: ${chrono_dir}" diff --git a/scripts/unix/ctest_suite.sh b/scripts/unix/ctest_suite.sh index d43b759..b3cffa3 100755 --- a/scripts/unix/ctest_suite.sh +++ b/scripts/unix/ctest_suite.sh @@ -18,6 +18,7 @@ RECOMPARE=0 LONG=0 BASELINE="" NO_PYTHON=0 +JUNIT="" usage() { cat <&2; usage >&2; exit 1 ;; esac @@ -101,16 +105,17 @@ fi # Bash 3.2 (macOS default) with set -u: expanding "${arr[@]}" on an empty array # triggers "unbound variable" and aborts before ctest runs. Branch on flags instead. +# ${JUNIT:+...} expands to nothing when --junit was not given. inv_ctest() { if [[ "${QUIET}" -eq 1 ]]; then (cd "${REPO_ROOT}" && ctest -C "${BUILD_TYPE}" --test-dir "${BUILD_PATH}" \ - --output-on-failure -Q "$@") + --output-on-failure -Q ${JUNIT:+--output-junit "${JUNIT}"} "$@") elif [[ "${VERBOSE}" -eq 1 ]]; then (cd "${REPO_ROOT}" && ctest -C "${BUILD_TYPE}" --test-dir "${BUILD_PATH}" \ - --output-on-failure -V "$@") + --output-on-failure -V ${JUNIT:+--output-junit "${JUNIT}"} "$@") else (cd "${REPO_ROOT}" && ctest -C "${BUILD_TYPE}" --test-dir "${BUILD_PATH}" \ - --output-on-failure "$@") + --output-on-failure ${JUNIT:+--output-junit "${JUNIT}"} "$@") fi } From 548b1aa62ce5e9735b75eddcd14809bf61d852c0 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Tue, 1 Dec 2026 16:08:43 +0000 Subject: [PATCH 03/18] Run the full test suites nightly and on request in continuous integration. The Linux job gains the verification, comparison and long regression suites, the demo cases against their baselines (run_tests.py --all), and the benchmarks. They run on the nightly schedule (testing dev), on a manual run, and on a pull request labelled full-tests; other runs stop after the unit, regression and external tests. The full run installs pandoc and LaTeX so that the suite scripts write PDF reports, and fails if a PDF is missing, because the report generators continue when the conversion fails. Benchmarks do not fail the job: timings on shared runners are for information only. Reports and their figures are uploaded as an artifact. --- .github/workflows/ci.yml | 102 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 191a834..8f61c45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,17 @@ on: - main - 'release/**' pull_request: + types: [opened, synchronize, reopened, labeled] + # Nightly run of the full test suites on dev. Scheduled runs use the workflow + # file on the default branch. + schedule: + - cron: '17 2 * * *' workflow_dispatch: + inputs: + full: + description: Run the full test suites (verification, comparison, long regression, demo cases, benchmarks) + type: boolean + default: true permissions: contents: read @@ -30,6 +40,12 @@ env: OPENBLAS_NUM_THREADS: '1' CTEST_JOBS: '2' MPLBACKEND: Agg + # The full suites run nightly, on a manual run, and on a pull request that + # carries the label "full-tests". Other runs stop after the unit, regression + # and external tests. + FULL_SUITES: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.full) || contains(github.event.pull_request.labels.*.name, 'full-tests') }} + # Scheduled runs test dev; every other run tests the commit that triggered it. + CHECKOUT_REF: ${{ github.event_name == 'schedule' && 'dev' || '' }} jobs: chrono-free-linux: @@ -40,6 +56,7 @@ jobs: - name: Check out the source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ env.CHECKOUT_REF }} persist-credentials: false - name: Set up Python @@ -119,13 +136,14 @@ jobs: retention-days: 14 chrono-linux: - name: Chrono build, unit and regression tests (Linux) + name: Chrono build and tests (Linux) runs-on: ubuntu-24.04 - timeout-minutes: 120 + timeout-minutes: 180 steps: - name: Check out the source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ env.CHECKOUT_REF }} submodules: recursive persist-credentials: false @@ -158,7 +176,8 @@ jobs: c++ --version | head -n 1 python3 --version python3 -m pip list --format=freeze | grep -i -E '^(numpy|h5py|pyyaml|matplotlib|pytest)==' - echo "OMP_NUM_THREADS=${OMP_NUM_THREADS} CTEST_JOBS=${CTEST_JOBS}" + echo "OMP_NUM_THREADS=${OMP_NUM_THREADS} CTEST_JOBS=${CTEST_JOBS} FULL_SUITES=${FULL_SUITES}" + git log -1 --format='Source: %H %s' # Chrono is built by scripts/unix/build_chrono.sh and reused until that # script, the runner image or the compiler version changes. @@ -226,12 +245,74 @@ jobs: --output-on-failure -j "${CTEST_JOBS}" --output-junit test-results/external.xml + # ---- Full suites (see FULL_SUITES above) ---- + # With pandoc on PATH, ctest_suite.sh also writes each report as a PDF. + - name: Install pandoc and LaTeX + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: | + sudo apt-get install --yes --no-install-recommends \ + pandoc texlive-xetex texlive-latex-recommended texlive-fonts-recommended lmodern + + - name: Run the verification tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: > + ./scripts/unix/ctest_suite.sh verification -j "${CTEST_JOBS}" + --junit test-results/verification.xml + + - name: Run the comparison tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: > + ./scripts/unix/ctest_suite.sh comparison -j "${CTEST_JOBS}" + --junit test-results/comparison.xml + + # Runs last of the CTest suites, so the regression report describes the long run. + - name: Run the long regression tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: > + ./scripts/unix/ctest_suite.sh regression --long -j "${CTEST_JOBS}" + --junit test-results/regression-long.xml + + - name: Run the demo cases against their baselines + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: > + python3 tests/regression/run_seastack/run_tests.py --all --quiet + --exe build/bin/Release/run_seastack + + # Wall-clock timings on shared runners are for information only, so this + # step does not fail the job. + - name: Run the benchmarks + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + continue-on-error: true + run: ./scripts/unix/ctest_suite.sh benchmark --junit test-results/benchmark.xml + + # The report generators keep going when the PDF conversion fails. + - name: Check that the PDF reports were written + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: | + status=0 + for report in \ + regression/report/regression_test_report.pdf \ + verification/report/verification_report.pdf \ + comparison/report/comparison_test_report.pdf; do + if [[ -s "build/bin/Release/results/tests/${report}" ]]; then + echo "[OK] ${report}" + else + echo "::error::PDF report missing or empty: ${report}" + status=1 + fi + done + exit "${status}" + # CTest exits with 0 when a test is skipped. Fail unless every test ran. - name: Check that every test ran and passed if: ${{ !cancelled() && steps.build.conclusion == 'success' }} run: | + suites="unit regression external" + if [[ "${FULL_SUITES}" == "true" ]]; then + suites="${suites} verification comparison regression-long" + fi status=0 - for suite in unit regression external; do + for suite in ${suites}; do python3 scripts/ci/check_ctest_junit.py "build/test-results/${suite}.xml" \ --summary "${GITHUB_STEP_SUMMARY}" || status=1 done @@ -252,6 +333,17 @@ jobs: build/test-results/ build/Testing/Temporary/LastTest.log build/build-diagnostics.log - build/bin/Release/results/tests/regression/report/ if-no-files-found: warn retention-days: 14 + + # Markdown and PDF reports with the figures they refer to. + - name: Upload test reports + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: chrono-linux-reports + path: | + build/bin/Release/results/tests/*/report/ + build/bin/Release/results/tests/**/plots/ + if-no-files-found: warn + retention-days: 30 From 3b0727a331e11ab3ea80636d77ccf2ad3a33cd06 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Tue, 1 Dec 2026 19:34:56 +0000 Subject: [PATCH 04/18] Add macOS jobs to continuous integration. Both workflow jobs now run on ubuntu-24.04 and macos-15 (Apple silicon). The macOS jobs install eigen@3, hdf5 and libomp from Homebrew and pass their keg-only prefixes to CMake through CMAKE_PREFIX_PATH. PDF reports are written on Linux only. scripts/unix/build_chrono.sh sets CH_USE_EIGEN_OPENMP=OFF on macOS, as in the released macOS packages, and accepts extra CMake configure arguments after --. The Chrono cache key now includes the compiler version and, on macOS, the versions of the Homebrew libraries that Chrono links. --- .github/workflows/ci.yml | 157 +++++++++++++++++++++++++++-------- scripts/unix/build_chrono.sh | 20 ++++- 2 files changed, 137 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f61c45..cd40ffa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,8 +34,8 @@ concurrency: env: # Thread counts are fixed so that results and timings are comparable between - # runs. The standard runners have 4 virtual CPUs: 2 concurrent tests, each - # with 2 OpenMP threads. + # runs: 2 concurrent tests, each with 2 OpenMP threads. The standard Linux + # runners have 4 virtual CPUs and the macOS runners 3. OMP_NUM_THREADS: '2' OPENBLAS_NUM_THREADS: '1' CTEST_JOBS: '2' @@ -48,10 +48,20 @@ env: CHECKOUT_REF: ${{ github.event_name == 'schedule' && 'dev' || '' }} jobs: - chrono-free-linux: - name: Chrono-free build and tests (Linux) - runs-on: ubuntu-24.04 + chrono-free: + name: Chrono-free build and tests (${{ matrix.name }}) + runs-on: ${{ matrix.os }} timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + include: + - name: Linux + id: linux + os: ubuntu-24.04 + - name: macOS + id: macos + os: macos-15 steps: - name: Check out the source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -64,21 +74,40 @@ jobs: with: python-version: '3.12' - - name: Install system packages + - name: Install system packages (Linux) + if: ${{ runner.os == 'Linux' }} run: | sudo apt-get update sudo apt-get install --yes --no-install-recommends \ ninja-build libeigen3-dev libhdf5-dev + # eigen@3 and libomp are keg-only, so CMake needs their prefixes. The + # macOS runner has 7 GB of memory: limit the build to 3 jobs. + - name: Install system packages (macOS) + if: ${{ runner.os == 'macOS' }} + run: | + brew install ninja eigen@3 hdf5 libomp + { + echo "CMAKE_PREFIX_PATH=$(brew --prefix eigen@3):$(brew --prefix hdf5):$(brew --prefix libomp)" + echo "CI_HDF5_DIR=$(brew --prefix hdf5)/lib/cmake/hdf5" + echo "CMAKE_BUILD_PARALLEL_LEVEL=3" + } >> "${GITHUB_ENV}" + - name: Install Python packages run: python3 -m pip install --requirement tests/regression/run_seastack/requirements.txt - name: Record the environment run: | echo "Runner: ${RUNNER_OS} ${RUNNER_ARCH}, image ${ImageOS:-unknown} ${ImageVersion:-unknown}" - echo "CPUs: $(nproc)" - grep -m1 'model name' /proc/cpuinfo || true - free -g | sed -n '1,2p' + echo "CPUs: $(getconf _NPROCESSORS_ONLN)" + if [[ "${RUNNER_OS}" == "macOS" ]]; then + sw_vers + sysctl -n machdep.cpu.brand_string hw.memsize + brew list --versions eigen@3 hdf5 libomp ninja + else + grep -m1 'model name' /proc/cpuinfo || true + free -g | sed -n '1,2p' + fi df -h . cmake --version | head -n 1 echo "ninja $(ninja --version)" @@ -86,13 +115,14 @@ jobs: python3 --version python3 -m pip list --format=freeze | grep -i -E '^(numpy|h5py|pyyaml|matplotlib)==' echo "OMP_NUM_THREADS=${OMP_NUM_THREADS} CTEST_JOBS=${CTEST_JOBS}" + echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:-}" # build.sh passes PythonRoot to CMake, so the tests use the interpreter # that has the packages installed above. - name: Write build-config.json run: | - printf '{"ChronoDir": "", "PythonRoot": "%s", "HDF5Dir": "", "Generator": ""}\n' \ - "${pythonLocation}" > build-config.json + printf '{"ChronoDir": "", "PythonRoot": "%s", "HDF5Dir": "%s", "Generator": ""}\n' \ + "${pythonLocation}" "${CI_HDF5_DIR:-}" > build-config.json cat build-config.json - name: Build @@ -127,7 +157,7 @@ jobs: if: ${{ !cancelled() }} uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: chrono-free-linux-results + name: chrono-free-${{ matrix.id }}-results path: | build/test-results/ build/Testing/Temporary/LastTest.log @@ -135,10 +165,25 @@ jobs: if-no-files-found: warn retention-days: 14 - chrono-linux: - name: Chrono build and tests (Linux) - runs-on: ubuntu-24.04 - timeout-minutes: 180 + chrono: + name: Chrono build and tests (${{ matrix.name }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 240 + strategy: + fail-fast: false + matrix: + include: + - name: Linux + id: linux + os: ubuntu-24.04 + pdf: true + - name: macOS + id: macos + os: macos-15 + pdf: false + env: + # PDF reports are written on Linux only; the other platforms write Markdown. + PDF_OPTION: ${{ !matrix.pdf && '--no-pdf' || '' }} steps: - name: Check out the source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -152,12 +197,25 @@ jobs: with: python-version: '3.12' - - name: Install system packages + - name: Install system packages (Linux) + if: ${{ runner.os == 'Linux' }} run: | sudo apt-get update sudo apt-get install --yes --no-install-recommends \ ninja-build libeigen3-dev libhdf5-dev + # eigen@3 and libomp are keg-only, so CMake needs their prefixes. The + # macOS runner has 7 GB of memory: limit the build to 3 jobs. + - name: Install system packages (macOS) + if: ${{ runner.os == 'macOS' }} + run: | + brew install ninja eigen@3 hdf5 libomp + { + echo "CMAKE_PREFIX_PATH=$(brew --prefix eigen@3):$(brew --prefix hdf5):$(brew --prefix libomp)" + echo "CI_HDF5_DIR=$(brew --prefix hdf5)/lib/cmake/hdf5" + echo "CMAKE_BUILD_PARALLEL_LEVEL=3" + } >> "${GITHUB_ENV}" + # pytest runs tests/unit/python/test_demo_features.py, which is skipped without it. - name: Install Python packages run: | @@ -167,9 +225,15 @@ jobs: - name: Record the environment run: | echo "Runner: ${RUNNER_OS} ${RUNNER_ARCH}, image ${ImageOS:-unknown} ${ImageVersion:-unknown}" - echo "CPUs: $(nproc)" - grep -m1 'model name' /proc/cpuinfo || true - free -g | sed -n '1,2p' + echo "CPUs: $(getconf _NPROCESSORS_ONLN)" + if [[ "${RUNNER_OS}" == "macOS" ]]; then + sw_vers + sysctl -n machdep.cpu.brand_string hw.memsize + brew list --versions eigen@3 hdf5 libomp ninja + else + grep -m1 'model name' /proc/cpuinfo || true + free -g | sed -n '1,2p' + fi df -h . cmake --version | head -n 1 echo "ninja $(ninja --version)" @@ -177,29 +241,48 @@ jobs: python3 --version python3 -m pip list --format=freeze | grep -i -E '^(numpy|h5py|pyyaml|matplotlib|pytest)==' echo "OMP_NUM_THREADS=${OMP_NUM_THREADS} CTEST_JOBS=${CTEST_JOBS} FULL_SUITES=${FULL_SUITES}" + echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:-}" git log -1 --format='Source: %H %s' # Chrono is built by scripts/unix/build_chrono.sh and reused until that - # script, the runner image or the compiler version changes. + # script, the runner image, the compiler or (on macOS) the Homebrew + # libraries it links change. - name: Locate the Chrono installation id: chrono run: | + toolchain="$( + { + c++ --version | head -n 1 + if [[ "${RUNNER_OS}" == "macOS" ]]; then + brew list --versions eigen@3 hdf5 libomp + fi + } | git hash-object --stdin | cut -c1-16 + )" echo "prefix=${HOME}/seastack-deps/chrono-10.0.0" >> "${GITHUB_OUTPUT}" - echo "compiler=gcc-$(c++ -dumpfullversion)" >> "${GITHUB_OUTPUT}" + echo "toolchain=${toolchain}" >> "${GITHUB_OUTPUT}" - name: Restore the Chrono installation id: chrono-cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ${{ steps.chrono.outputs.prefix }} - key: chrono-ubuntu-24.04-${{ steps.chrono.outputs.compiler }}-${{ hashFiles('scripts/unix/build_chrono.sh') }} + key: chrono-10.0.0-${{ matrix.os }}-${{ steps.chrono.outputs.toolchain }}-${{ hashFiles('scripts/unix/build_chrono.sh') }} - name: Build Chrono if: ${{ steps.chrono-cache.outputs.cache-hit != 'true' }} env: CHRONO_PREFIX: ${{ steps.chrono.outputs.prefix }} run: | - ./scripts/unix/build_chrono.sh --prefix "${CHRONO_PREFIX}" --work-dir "${RUNNER_TEMP}/chrono-work" + # Bash 3.2 (macOS): empty arrays are expanded with the ${a[@]+...} form. + options=() + if [[ "${RUNNER_OS}" == "macOS" ]]; then + options=(--jobs 3 -- + "-DEIGEN3_INCLUDE_DIR=$(brew --prefix eigen@3)/include/eigen3" + "-DHDF5_DIR=$(brew --prefix hdf5)/lib/cmake/hdf5" + "-DOpenMP_ROOT=$(brew --prefix libomp)") + fi + ./scripts/unix/build_chrono.sh --prefix "${CHRONO_PREFIX}" \ + --work-dir "${RUNNER_TEMP}/chrono-work" ${options[@]+"${options[@]}"} rm -rf "${RUNNER_TEMP}/chrono-work" du -sh "${CHRONO_PREFIX}" @@ -212,18 +295,20 @@ jobs: path: ${{ steps.chrono.outputs.prefix }} key: ${{ steps.chrono-cache.outputs.cache-primary-key }} - # The Chrono libraries are outside the system library path, so the test - # executables need LD_LIBRARY_PATH (docs/build/RELEASE_CHECKLIST.md). + # On Linux the Chrono libraries are outside the system library path, so + # the test executables need LD_LIBRARY_PATH (docs/build/RELEASE_CHECKLIST.md). - name: Write build-config.json env: CHRONO_PREFIX: ${{ steps.chrono.outputs.prefix }} run: | config_file="$(find "${CHRONO_PREFIX}" -name ChronoConfig.cmake -print | head -n 1)" test -n "${config_file}" - printf '{"ChronoDir": "%s", "PythonRoot": "%s", "HDF5Dir": "", "Generator": ""}\n' \ - "$(dirname "${config_file}")" "${pythonLocation}" > build-config.json + printf '{"ChronoDir": "%s", "PythonRoot": "%s", "HDF5Dir": "%s", "Generator": ""}\n' \ + "$(dirname "${config_file}")" "${pythonLocation}" "${CI_HDF5_DIR:-}" > build-config.json cat build-config.json - echo "LD_LIBRARY_PATH=${CHRONO_PREFIX}/lib" >> "${GITHUB_ENV}" + if [[ "${RUNNER_OS}" == "Linux" ]]; then + echo "LD_LIBRARY_PATH=${CHRONO_PREFIX}/lib" >> "${GITHUB_ENV}" + fi - name: Build id: build @@ -248,7 +333,7 @@ jobs: # ---- Full suites (see FULL_SUITES above) ---- # With pandoc on PATH, ctest_suite.sh also writes each report as a PDF. - name: Install pandoc and LaTeX - if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' && matrix.pdf }} run: | sudo apt-get install --yes --no-install-recommends \ pandoc texlive-xetex texlive-latex-recommended texlive-fonts-recommended lmodern @@ -256,20 +341,20 @@ jobs: - name: Run the verification tests if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} run: > - ./scripts/unix/ctest_suite.sh verification -j "${CTEST_JOBS}" + ./scripts/unix/ctest_suite.sh verification -j "${CTEST_JOBS}" ${PDF_OPTION} --junit test-results/verification.xml - name: Run the comparison tests if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} run: > - ./scripts/unix/ctest_suite.sh comparison -j "${CTEST_JOBS}" + ./scripts/unix/ctest_suite.sh comparison -j "${CTEST_JOBS}" ${PDF_OPTION} --junit test-results/comparison.xml # Runs last of the CTest suites, so the regression report describes the long run. - name: Run the long regression tests if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} run: > - ./scripts/unix/ctest_suite.sh regression --long -j "${CTEST_JOBS}" + ./scripts/unix/ctest_suite.sh regression --long -j "${CTEST_JOBS}" ${PDF_OPTION} --junit test-results/regression-long.xml - name: Run the demo cases against their baselines @@ -287,7 +372,7 @@ jobs: # The report generators keep going when the PDF conversion fails. - name: Check that the PDF reports were written - if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' && matrix.pdf }} run: | status=0 for report in \ @@ -328,7 +413,7 @@ jobs: if: ${{ !cancelled() }} uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: chrono-linux-results + name: chrono-${{ matrix.id }}-results path: | build/test-results/ build/Testing/Temporary/LastTest.log @@ -341,7 +426,7 @@ jobs: if: ${{ !cancelled() && steps.build.conclusion == 'success' }} uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: chrono-linux-reports + name: chrono-${{ matrix.id }}-reports path: | build/bin/Release/results/tests/*/report/ build/bin/Release/results/tests/**/plots/ diff --git a/scripts/unix/build_chrono.sh b/scripts/unix/build_chrono.sh index 55e5a1b..2b80e7e 100755 --- a/scripts/unix/build_chrono.sh +++ b/scripts/unix/build_chrono.sh @@ -3,9 +3,11 @@ # # Implements the portable recipe in docs/build/BUILD_CHRONO.md: release tag # 10.0.0, Parsers + HDF5 + OpenMP, CH_USE_SIMD=OFF and a 16-byte Eigen -# alignment (the Eigen ABI contract of SEAStack::Core), no Python link. +# alignment (the Eigen ABI contract of SEAStack::Core), no Python link. On +# macOS, Eigen's internal OpenMP parallelism is off (CH_USE_EIGEN_OPENMP=OFF), +# as in the released macOS packages. # -# Usage: scripts/unix/build_chrono.sh --prefix DIR [options] +# Usage: scripts/unix/build_chrono.sh --prefix DIR [options] [-- CMAKE_ARG...] # --prefix DIR Install prefix (required), e.g. /opt/chrono-10.0.0 # --work-dir DIR Source and build directory # (default: ${TMPDIR:-/tmp}/seastack-chrono-10.0.0) @@ -14,6 +16,10 @@ # --prefix-path PATH Extra CMAKE_PREFIX_PATH (e.g. the VSG install prefix) # --jobs N Parallel build jobs (default: CMake/Ninja default) # -h, --help This help +# -- CMAKE_ARG... Extra arguments for the Chrono CMake configure, e.g. on +# macOS with Homebrew: +# -- "-DEIGEN3_INCLUDE_DIR=$(brew --prefix eigen@3)/include/eigen3" +# "-DOpenMP_ROOT=$(brew --prefix libomp)" # # Prerequisites: git, cmake, a C++17 compiler, Eigen3, HDF5 and OpenMP (see # docs/build/BUILD_MACOS.md). Ninja is used when it is on PATH. @@ -33,8 +39,9 @@ WORK_DIR="${TMPDIR:-/tmp}/seastack-chrono-${CHRONO_TAG}" ENABLE_VSG=OFF PREFIX_PATH="" JOBS="" +EXTRA_CMAKE_ARGS=() -usage() { sed -n '2,22p' "$0" | sed 's/^# \{0,1\}//'; } +usage() { sed -n '2,28p' "$0" | sed 's/^# \{0,1\}//'; } fail() { echo "[FAIL] $*" >&2; exit 1; } while [[ $# -gt 0 ]]; do @@ -44,6 +51,7 @@ while [[ $# -gt 0 ]]; do --vsg) ENABLE_VSG=ON; shift ;; --prefix-path) PREFIX_PATH="$2"; shift 2 ;; --jobs) JOBS="$2"; shift 2 ;; + --) shift; EXTRA_CMAKE_ARGS=("$@"); break ;; -h|--help) usage; exit 0 ;; *) echo "[FAIL] unknown argument: $1" >&2; usage >&2; exit 2 ;; esac @@ -92,13 +100,17 @@ cmake_args=( -DCH_USE_SIMD=OFF -DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON ) +if [[ "$(uname -s)" == "Darwin" ]]; then + cmake_args+=(-DCH_USE_EIGEN_OPENMP=OFF) +fi if command -v ninja >/dev/null; then cmake_args+=(-G Ninja) fi if [[ -n "${PREFIX_PATH}" ]]; then cmake_args+=("-DCMAKE_PREFIX_PATH=${PREFIX_PATH}") fi -cmake "${cmake_args[@]}" +# Bash 3.2 (macOS) with set -u: an empty array must not be expanded directly. +cmake "${cmake_args[@]}" ${EXTRA_CMAKE_ARGS[@]+"${EXTRA_CMAKE_ARGS[@]}"} echo "" echo ">> Build" From 5b2aa4c7ace5447c2189569ea678a16af7d3cf43 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 00:27:36 +0000 Subject: [PATCH 05/18] Install Chrono with absolute library install names on macOS. Chrono 10.0.0 sets CMAKE_MACOSX_RPATH OFF and no install-name directory, so its installed libraries carry a bare file name as install name (libChrono_core.dylib). Programs linked against the installation then fail to start with 'dyld: Library not loaded'; every Chrono-linked test in the macOS continuous integration job stopped this way. scripts/unix/build_chrono.sh now passes CMAKE_INSTALL_NAME_DIR=/lib on macOS and checks after installing that no library is recorded without a path. --- scripts/unix/build_chrono.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/unix/build_chrono.sh b/scripts/unix/build_chrono.sh index 2b80e7e..769071d 100755 --- a/scripts/unix/build_chrono.sh +++ b/scripts/unix/build_chrono.sh @@ -61,6 +61,10 @@ done command -v git >/dev/null || fail "git not on PATH" command -v cmake >/dev/null || fail "cmake not on PATH" +# Absolute prefix: it is written into the installed libraries on macOS. +mkdir -p "${PREFIX}" +PREFIX="$(cd "${PREFIX}" && pwd)" + SOURCE_DIR="${WORK_DIR}/chrono" BUILD_DIR="${WORK_DIR}/build" @@ -102,6 +106,10 @@ cmake_args=( ) if [[ "$(uname -s)" == "Darwin" ]]; then cmake_args+=(-DCH_USE_EIGEN_OPENMP=OFF) + # Chrono 10.0.0 installs its libraries with a bare file name as install name + # (libChrono_core.dylib), so programs linked against the installation fail to + # start with "dyld: Library not loaded". Record the absolute path instead. + cmake_args+=("-DCMAKE_INSTALL_NAME_DIR=${PREFIX}/lib") fi if command -v ninja >/dev/null; then cmake_args+=(-G Ninja) @@ -135,6 +143,19 @@ if grep -R -l -E -e '-m(arch|tune)=native' "${chrono_dir}" >/dev/null 2>&1; then fail "the installed Chrono package exports -march=native / -mtune=native (${chrono_dir})" fi echo " [OK] no -march=native / -mtune=native in the exported targets" +if [[ "$(uname -s)" == "Darwin" ]]; then + # Every installed library, and every library it depends on, must be recorded + # by an absolute or @-relative path (see CMAKE_INSTALL_NAME_DIR above). + for dylib in "${PREFIX}"/lib/*.dylib; do + [[ -e "${dylib}" ]] || fail "no libraries found under ${PREFIX}/lib" + [[ -L "${dylib}" ]] && continue + bare_names="$(otool -L "${dylib}" | tail -n +2 | awk '{print $1}' | grep -v -E '^(/|@)' || true)" + if [[ -n "${bare_names}" ]]; then + fail "${dylib} records a library without a path: ${bare_names}" + fi + done + echo " [OK] installed libraries are recorded by path" +fi echo "" echo "Chrono ${CHRONO_TAG} installed." echo "ChronoDir: ${chrono_dir}" From 5ce448d6d5cb19b96a32083e22602187fe904bca Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 01:30:26 +0000 Subject: [PATCH 06/18] Give the external-PTO RM3 regression test the regression time limit. test_external_pto_rm3_regression runs four irregular-wave simulations through run_seastack but is registered in tests/unit, so it inherited the 300 s limit of the unit tests. On the macOS continuous integration runner it was stopped at 300 s, and on the Linux runner the external label takes about 210 s. The test now sets TIMEOUT 1800, the limit of the regression suite. The limit of every other test is unchanged. --- tests/unit/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 8c79edc..82a4904 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -370,8 +370,10 @@ if(TARGET seastack_external) --exe $ ) # Four ~600 s irregular-wave Chrono runs (3 demos + native twin). + # Same time limit as the regression suite: the 300 s limit of the + # unit tests is too short for these runs on a slow machine. set_tests_properties(test_external_pto_rm3_regression PROPERTIES - LABELS "external;chrono" COST 120 SKIP_RETURN_CODE 77) + LABELS "external;chrono" COST 120 SKIP_RETURN_CODE 77 TIMEOUT 1800) # On Windows, run_seastack needs Chrono/HDF5/VSG DLLs (VSG is loaded # even with --nogui) plus a `python` interpreter (the demos spawn # `python .py`). We pass these directories to the test script From ab0bd78cb0edee971def988525810d5da0f3da1f Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 02:39:34 +0000 Subject: [PATCH 07/18] Fix build.ps1 failing after a clean Chrono-free build. The output summary read .Count on the result of Get-ChildItem. Under strict mode that is an error when there is no match, so build.ps1 -NoChrono exited with 1 after a successful build into a clean tree, where the output folder holds no DLLs. The results are now wrapped in @(...). --- scripts/windows/build.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/windows/build.ps1 b/scripts/windows/build.ps1 index f46460c..54045fc 100644 --- a/scripts/windows/build.ps1 +++ b/scripts/windows/build.ps1 @@ -1003,8 +1003,10 @@ Write-SeaStackStep "Verifying outputs" $binDir = Join-Path $buildDir "bin\$BuildType" if (Test-Path -LiteralPath $binDir) { - $exes = Get-ChildItem -Path $binDir -Filter "*.exe" -ErrorAction SilentlyContinue - $dlls = Get-ChildItem -Path $binDir -Filter "*.dll" -ErrorAction SilentlyContinue + # @(...) keeps .Count valid under strict mode when there are no (or one) matches, + # e.g. no DLLs after a clean Chrono-free build. + $exes = @(Get-ChildItem -Path $binDir -Filter "*.exe" -ErrorAction SilentlyContinue) + $dlls = @(Get-ChildItem -Path $binDir -Filter "*.dll" -ErrorAction SilentlyContinue) Write-Detail ('Output: ' + $binDir) Write-Detail "Executables: $($exes.Count) DLLs: $($dlls.Count)" From cfb97512816943a79deff7a744af2bf796142189 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 02:39:34 +0000 Subject: [PATCH 08/18] Add a -Junit option to the Windows test runner scripts. run_unit_tests.ps1, run_chrono_free_tests.ps1, run_regression_tests.ps1, run_verification_tests.ps1 and run_comparison_tests.ps1 pass --output-junit to ctest when -Junit is given, as scripts/unix/ctest_suite.sh does with --junit. Behaviour without the option is unchanged. --- scripts/windows/run_chrono_free_tests.ps1 | 5 +++++ scripts/windows/run_comparison_tests.ps1 | 5 +++++ scripts/windows/run_regression_tests.ps1 | 5 +++++ scripts/windows/run_unit_tests.ps1 | 5 +++++ scripts/windows/run_verification_tests.ps1 | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/scripts/windows/run_chrono_free_tests.ps1 b/scripts/windows/run_chrono_free_tests.ps1 index 5363dfb..6ca54c1 100644 --- a/scripts/windows/run_chrono_free_tests.ps1 +++ b/scripts/windows/run_chrono_free_tests.ps1 @@ -16,6 +16,7 @@ param( [ValidateSet("Release", "Debug", "RelWithDebInfo", "MinSizeRel")] [string]$BuildType = "Release", [int]$j = 0, + [string]$Junit = "", [switch]$Quiet, [switch]$Verbose, [switch]$Help @@ -36,6 +37,7 @@ if ($Help) { Write-Host " -BuildDir Build directory (default: build)" Write-Host " -BuildType Release|Debug|RelWithDebInfo|MinSizeRel (default: Release)" Write-Host " -j Parallel workers (0 = all processors)" + Write-Host " -Junit Also write a JUnit XML report (ctest --output-junit); a relative path is taken from the build directory" Write-Host " -Quiet Minimal ctest output (-Q)" Write-Host " -Verbose Extra ctest detail (-V)" Write-Host " (default) Live ctest lines; parallel 'Start N:' lines are hidden" @@ -71,6 +73,9 @@ $ctestArgs = @( "-j", $workers, "--output-on-failure" ) +if ($Junit) { + $ctestArgs += @("--output-junit", $Junit) +} Push-Location $repoRoot try { diff --git a/scripts/windows/run_comparison_tests.ps1 b/scripts/windows/run_comparison_tests.ps1 index f4e6754..05f9caa 100644 --- a/scripts/windows/run_comparison_tests.ps1 +++ b/scripts/windows/run_comparison_tests.ps1 @@ -24,6 +24,7 @@ param( [ValidateSet("Release", "Debug", "RelWithDebInfo", "MinSizeRel")] [string]$BuildType = "Release", [int]$j = 0, + [string]$Junit = "", [switch]$NoPdf, [switch]$Quiet, [switch]$Verbose, @@ -47,6 +48,7 @@ if ($Help) { Write-Host " -BuildDir Build directory (default: build)" Write-Host " -BuildType Release|Debug|RelWithDebInfo|MinSizeRel (default: Release)" Write-Host " -j Parallel workers (0 = all processors)" + Write-Host " -Junit Also write a JUnit XML report (ctest --output-junit); a relative path is taken from the build directory" Write-Host " -NoPdf Do not pass --pdf (default: --pdf if pandoc is on PATH)" Write-Host " -Quiet Minimal ctest output (-Q)" Write-Host " -Verbose Extra ctest detail (-V) and full Python report output" @@ -85,6 +87,9 @@ $ctestArgs = @( "-j", $workers, "--output-on-failure" ) +if ($Junit) { + $ctestArgs += @("--output-junit", $Junit) +} Write-Step "Running comparison tests ($workers workers; report via Python after ctest)" diff --git a/scripts/windows/run_regression_tests.ps1 b/scripts/windows/run_regression_tests.ps1 index a3b551b..3145070 100644 --- a/scripts/windows/run_regression_tests.ps1 +++ b/scripts/windows/run_regression_tests.ps1 @@ -21,6 +21,7 @@ param( [ValidateSet("Release", "Debug", "RelWithDebInfo", "MinSizeRel")] [string]$BuildType = "Release", [int]$j = 0, # 0 = auto-detect (all processors), otherwise use specified count + [string]$Junit = "", # Also write a JUnit XML report (ctest --output-junit) [string]$Filter, # Filter by model (sphere, oswec, f3of, rm3) [switch]$Recompare, # Re-run comparison tests to regenerate plots [switch]$Long, # Set SEASTACK_LONG_TESTS=1 for this run only @@ -46,6 +47,7 @@ if ($Help) { Write-Host " -BuildDir Build directory (default: build)" Write-Host " -BuildType Release|Debug|RelWithDebInfo|MinSizeRel (default: Release)" Write-Host " -j Number of parallel workers (default: all available processors)" + Write-Host " -Junit Also write a JUnit XML report (ctest --output-junit); a relative path is taken from the build directory" Write-Host " -Filter Filter by family (CTest prefix test_regression__)" Write-Host " -Recompare Re-run comparison tests to regenerate plots" Write-Host " -Long Enable long regression tests (SEASTACK_LONG_TESTS=1 for this run)" @@ -92,6 +94,9 @@ $ctestArgs = @( "-j", $workers, "--output-on-failure" ) +if ($Junit) { + $ctestArgs += @("--output-junit", $Junit) +} if ($Filter) { $ctestArgs += @("-R", "^test_regression_${Filter}_") diff --git a/scripts/windows/run_unit_tests.ps1 b/scripts/windows/run_unit_tests.ps1 index fe7b6ba..128e7c2 100644 --- a/scripts/windows/run_unit_tests.ps1 +++ b/scripts/windows/run_unit_tests.ps1 @@ -16,6 +16,7 @@ param( [ValidateSet("Release", "Debug", "RelWithDebInfo", "MinSizeRel")] [string]$BuildType = "Release", [int]$j = 0, + [string]$Junit = "", [switch]$Quiet, [switch]$Verbose, [switch]$Help @@ -36,6 +37,7 @@ if ($Help) { Write-Host " -BuildDir Build directory (default: build)" Write-Host " -BuildType Release|Debug|RelWithDebInfo|MinSizeRel (default: Release)" Write-Host " -j Parallel workers (0 = all processors)" + Write-Host " -Junit Also write a JUnit XML report (ctest --output-junit); a relative path is taken from the build directory" Write-Host " -Quiet Minimal ctest output (-Q)" Write-Host " -Verbose Extra ctest detail (-V)" Write-Host " (default) Live ctest lines; parallel 'Start N:' lines are hidden" @@ -71,6 +73,9 @@ $ctestArgs = @( "-j", $workers, "--output-on-failure" ) +if ($Junit) { + $ctestArgs += @("--output-junit", $Junit) +} Push-Location $repoRoot try { diff --git a/scripts/windows/run_verification_tests.ps1 b/scripts/windows/run_verification_tests.ps1 index 5f18c0a..71b22fe 100644 --- a/scripts/windows/run_verification_tests.ps1 +++ b/scripts/windows/run_verification_tests.ps1 @@ -24,6 +24,7 @@ param( [ValidateSet("Release", "Debug", "RelWithDebInfo", "MinSizeRel")] [string]$BuildType = "Release", [int]$j = 0, + [string]$Junit = "", [switch]$NoPdf, [switch]$Quiet, [switch]$Verbose, @@ -47,6 +48,7 @@ if ($Help) { Write-Host " -BuildDir Build directory (default: build)" Write-Host " -BuildType Release|Debug|RelWithDebInfo|MinSizeRel (default: Release)" Write-Host " -j Parallel workers (0 = all processors)" + Write-Host " -Junit Also write a JUnit XML report (ctest --output-junit); a relative path is taken from the build directory" Write-Host " -NoPdf Do not pass --pdf (default: --pdf if pandoc is on PATH)" Write-Host " -Quiet Minimal ctest output (-Q)" Write-Host " -Verbose Extra ctest detail (-V) and full Python report output" @@ -85,6 +87,9 @@ $ctestArgs = @( "-j", $workers, "--output-on-failure" ) +if ($Junit) { + $ctestArgs += @("--output-junit", $Junit) +} Write-Step "Running verification tests ($workers workers; report via Python after ctest)" From 1a9d275f5b3c85c1bb6a206c32dc382e6955ba92 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 02:39:34 +0000 Subject: [PATCH 09/18] Add a Chrono build script for Windows and an HDF5 target shim. scripts/windows/build_chrono.ps1 builds and installs the pinned Chrono 10.0.0 tag with Parsers, HDF5 and OpenMP and no Python link, taking Eigen and HDF5 from vcpkg. Chrono 10.0.0 links hdf5::hdf5_tools-shared whenever the HDF5 package config provides hdf5::hdf5-shared. vcpkg's HDF5 does not export that target, so the documented Windows configure stopped with 'target was not found'. cmake/ChronoHdf5ToolsShim.cmake defines the missing target and is passed to the Chrono configure through CMAKE_PROJECT_INCLUDE. docs/build/BUILD_CHRONO.md describes both scripts, the shim, the hl feature of vcpkg's HDF5 that Chrono needs, and the macOS install-name setting. --- cmake/ChronoHdf5ToolsShim.cmake | 25 ++++++ docs/build/BUILD_CHRONO.md | 27 +++++- scripts/windows/build_chrono.ps1 | 150 +++++++++++++++++++++++++++++++ 3 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 cmake/ChronoHdf5ToolsShim.cmake create mode 100644 scripts/windows/build_chrono.ps1 diff --git a/cmake/ChronoHdf5ToolsShim.cmake b/cmake/ChronoHdf5ToolsShim.cmake new file mode 100644 index 0000000..536f61f --- /dev/null +++ b/cmake/ChronoHdf5ToolsShim.cmake @@ -0,0 +1,25 @@ +# HDF5 "tools" target shim for building Project Chrono 10.0.0 (not used by the +# SEA-Stack build itself). +# +# Chrono links hdf5::hdf5_tools-shared (or -static) whenever the HDF5 package +# config provides hdf5::hdf5-shared (or -static). Some HDF5 packages, vcpkg's +# among them, do not export the tools target, and the Chrono configure then +# stops with "target hdf5::hdf5_tools-shared was not found". +# +# Pass this file to the Chrono configure so that it runs right after project(): +# -DCMAKE_PROJECT_INCLUDE=/cmake/ChronoHdf5ToolsShim.cmake +# scripts/windows/build_chrono.ps1 does this. It defines the missing target as +# an interface to the main HDF5 library; targets that exist are left untouched. + +find_package(hdf5 CONFIG QUIET) + +foreach(_seastack_hdf5_kind shared static) + if(TARGET hdf5::hdf5-${_seastack_hdf5_kind} + AND NOT TARGET hdf5::hdf5_tools-${_seastack_hdf5_kind}) + add_library(hdf5::hdf5_tools-${_seastack_hdf5_kind} INTERFACE IMPORTED GLOBAL) + set_target_properties(hdf5::hdf5_tools-${_seastack_hdf5_kind} PROPERTIES + INTERFACE_LINK_LIBRARIES hdf5::hdf5-${_seastack_hdf5_kind}) + message(STATUS "ChronoHdf5ToolsShim: defined hdf5::hdf5_tools-${_seastack_hdf5_kind}") + endif() +endforeach() +unset(_seastack_hdf5_kind) diff --git a/docs/build/BUILD_CHRONO.md b/docs/build/BUILD_CHRONO.md index bc041fa..16df259 100644 --- a/docs/build/BUILD_CHRONO.md +++ b/docs/build/BUILD_CHRONO.md @@ -57,15 +57,24 @@ SEA-Stack’s `build-config.example.json` uses an **install** prefix path such a ## Windows example (Visual Studio + vcpkg HDF5 / Eigen) -Prerequisites (see [BUILD_WINDOWS.md](BUILD_WINDOWS.md)): Visual Studio C++ workload, CMake, and vcpkg packages such as `hdf5[cpp]:x64-windows` and Eigen if not supplied elsewhere. +Prerequisites (see [BUILD_WINDOWS.md](BUILD_WINDOWS.md)): Visual Studio C++ workload, CMake, and vcpkg packages such as `hdf5[cpp,hl]:x64-windows` and `eigen3:x64-windows` if not supplied elsewhere. Chrono links the HDF5 high-level libraries, so the `hl` feature is needed as well as `cpp`. -Configure Chrono (adjust paths): +[`scripts/windows/build_chrono.ps1`](../../scripts/windows/build_chrono.ps1) runs the recipe below for the pinned `10.0.0` tag from a Visual Studio x64 developer shell: + +```powershell +.\scripts\windows\build_chrono.ps1 -Prefix C:/path/to/chrono-install -VcpkgRoot C:/path/to/vcpkg +``` + +It also turns off the optional Python parser (`CMAKE_DISABLE_FIND_PACKAGE_Python3=ON`), so no Chrono library links Python. The continuous integration workflow builds Chrono with the same script. + +To configure Chrono by hand (adjust paths): ```powershell cmake -S C:/path/to/chrono-src -B C:/path/to/chrono-build ` -G "Visual Studio 17 2022" -A x64 ` -DCMAKE_INSTALL_PREFIX=C:/path/to/chrono-install ` -DCMAKE_TOOLCHAIN_FILE=C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake ` + -DCMAKE_PROJECT_INCLUDE=C:/path/to/sea-stack/cmake/ChronoHdf5ToolsShim.cmake ` -DBUILD_SHARED_LIBS=ON ` -DCH_ENABLE_MODULE_PARSERS=ON ` -DCH_ENABLE_HDF5=ON ` @@ -88,6 +97,8 @@ Then in `build-config.json`: "ChronoDir": "C:/path/to/chrono-install/cmake" ``` +**`CMAKE_PROJECT_INCLUDE`** is needed with vcpkg's HDF5: Chrono 10.0.0 links a target named `hdf5::hdf5_tools-shared`, which that package does not export, and the configure otherwise stops with *"target was not found"*. [`cmake/ChronoHdf5ToolsShim.cmake`](../../cmake/ChronoHdf5ToolsShim.cmake) defines the missing target and leaves existing targets untouched. + If you do **not** use the vcpkg toolchain when configuring Chrono, you must still ensure **HDF5**, **ZLIB**, and other transitive dependencies are discoverable (e.g. `CMAKE_PREFIX_PATH` pointing at `vcpkg/installed/x64-windows`). Using **`CMAKE_TOOLCHAIN_FILE`** is the most reproducible approach on Windows. --- @@ -197,6 +208,18 @@ If you will build a redistributable macOS ZIP (`--package`), add these two optio - **`CMAKE_DISABLE_FIND_PACKAGE_Python3=ON`**: Chrono's Parsers module auto-detects Python and, if found, links `libChrono_parsers` against it (on the release build Mac it found the Command Line Tools Python 3.9). SEA-Stack only uses the YAML parser, but that link would make the package require the build machine's Python install. With this option `CHRONO_HAS_PYTHON` is undefined in `ChConfigParsers.h`, and no Chrono library links Python. - **`CH_USE_EIGEN_OPENMP=OFF`**: the macOS v1.0.0 Chrono libraries were built with Eigen's internal OpenMP parallelism off (`EIGEN_DONT_PARALLELIZE`), as in the earlier release candidates. Keep it off so the package matches the tested build. +`scripts/unix/build_chrono.sh` applies both options on macOS. With Homebrew, pass the locations of the keg-only Eigen 3 and libomp, and of HDF5: + +```bash +export CMAKE_PREFIX_PATH="$(brew --prefix eigen@3):$(brew --prefix hdf5):$(brew --prefix libomp)" +./scripts/unix/build_chrono.sh --prefix /path/to/chrono-install -- \ + "-DEIGEN3_INCLUDE_DIR=$(brew --prefix eigen@3)/include/eigen3" \ + "-DHDF5_DIR=$(brew --prefix hdf5)/lib/cmake/hdf5" \ + "-DOpenMP_ROOT=$(brew --prefix libomp)" +``` + +The script also sets `CMAKE_INSTALL_NAME_DIR` to the `lib` folder of the install prefix. Chrono 10.0.0 otherwise installs its libraries with a bare file name as install name, and a program linked against the installation stops with *"dyld: Library not loaded: libChrono_core.dylib"*. A Chrono build tree does not have this problem. + Use a separate Chrono build directory for this configuration and point `ChronoDir` at it. The SEA-Stack packaging step aborts if any bundled library still references a path outside the package. --- diff --git a/scripts/windows/build_chrono.ps1 b/scripts/windows/build_chrono.ps1 new file mode 100644 index 0000000..f92bc11 --- /dev/null +++ b/scripts/windows/build_chrono.ps1 @@ -0,0 +1,150 @@ +<# +.SYNOPSIS + Build and install Project Chrono for SEA-Stack on Windows. + +.DESCRIPTION + Implements the recipe in docs/build/BUILD_CHRONO.md: release tag 10.0.0, + shared libraries, Parsers + HDF5 + OpenMP, no Python link. Counterpart of + scripts/unix/build_chrono.sh. + + Eigen3 and HDF5 are taken from vcpkg (triplet x64-windows) when -VcpkgRoot is + given, for example after: + vcpkg install eigen3:x64-windows hdf5[cpp]:x64-windows + + Run from a Visual Studio x64 developer shell. Ninja is used when cl and ninja + are both on PATH; otherwise CMake's default generator (Visual Studio). + + After a successful run, set "ChronoDir" in build-config.json to the directory + printed at the end (the one that contains the Chrono package config file). + +.PARAMETER Prefix + Install prefix (required), e.g. C:/deps/chrono-10.0.0. + +.PARAMETER WorkDir + Source and build directory. Default: %TEMP%\seastack-chrono-10.0.0. + +.PARAMETER VcpkgRoot + vcpkg root directory. Its CMake toolchain file is passed to the Chrono configure. + +.PARAMETER PrefixPath + Extra CMAKE_PREFIX_PATH (e.g. the VSG install prefix). + +.PARAMETER VSG + Enable the Chrono VSG module (needs VSG, vsgXchange and vsgImGui). + +.PARAMETER Jobs + Parallel build jobs (default: the build tool's default). + +.PARAMETER CMakeArgs + Extra arguments for the Chrono CMake configure. + +.EXAMPLE + .\scripts\windows\build_chrono.ps1 -Prefix C:/deps/chrono-10.0.0 -VcpkgRoot C:/vcpkg +#> +param( + [Parameter(Mandatory)][string]$Prefix, + [string]$WorkDir = "", + [string]$VcpkgRoot = "", + [string]$PrefixPath = "", + [switch]$VSG, + [int]$Jobs = 0, + [string[]]$CMakeArgs = @() +) +# Native tools write progress to stderr; failures are detected via exit codes below. +$ErrorActionPreference = 'Continue' + +$ChronoRepository = "https://github.com/projectchrono/chrono.git" +$ChronoTag = "10.0.0" +# Commit of the 10.0.0 tag. The checkout is verified against it because a +# Chrono main build can also report version 10.0.0. +$ChronoCommit = "9faf13dd8f1128dd75ed233a9627027b0422c3f7" + +function Fail([string]$msg) { Write-Host "[FAIL] $msg" -ForegroundColor Red; exit 1 } + +foreach ($tool in 'git', 'cmake') { + if (-not (Get-Command $tool -ErrorAction SilentlyContinue)) { Fail "$tool not on PATH" } +} + +if (-not $WorkDir) { $WorkDir = Join-Path $env:TEMP "seastack-chrono-$ChronoTag" } +New-Item -ItemType Directory -Force -Path $Prefix, $WorkDir | Out-Null +$Prefix = (Resolve-Path -LiteralPath $Prefix).Path -replace '\\', '/' +$WorkDir = (Resolve-Path -LiteralPath $WorkDir).Path +$sourceDir = Join-Path $WorkDir "chrono" +$buildDir = Join-Path $WorkDir "build" +$enableVsg = if ($VSG) { 'ON' } else { 'OFF' } + +Write-Host "Chrono tag: $ChronoTag ($ChronoCommit)" +Write-Host "Install prefix: $Prefix" +Write-Host "Work dir: $WorkDir" +Write-Host "VSG module: $enableVsg" + +Write-Host "`n>> Source" +if (-not (Test-Path -LiteralPath (Join-Path $sourceDir ".git"))) { + & git clone --depth 1 --branch $ChronoTag $ChronoRepository $sourceDir + if ($LASTEXITCODE -ne 0) { Fail "git clone" } +} +$actualCommit = (& git -C $sourceDir rev-parse HEAD) +if ($actualCommit -ne $ChronoCommit) { + Fail "$sourceDir is at $actualCommit, expected $ChronoCommit (tag $ChronoTag)" +} +Write-Host " [OK] $sourceDir at $actualCommit" + +Write-Host "`n>> Configure" +$configureArgs = @( + '-S', $sourceDir, + '-B', $buildDir, + '-DCMAKE_BUILD_TYPE=Release', + "-DCMAKE_INSTALL_PREFIX=$Prefix", + '-DBUILD_SHARED_LIBS=ON', + '-DBUILD_TESTING=OFF', + '-DBUILD_DEMOS=OFF', + '-DBUILD_BENCHMARKING=OFF', + '-DCH_ENABLE_MODULE_PARSERS=ON', + '-DCH_ENABLE_HDF5=ON', + '-DCH_ENABLE_OPENMP=ON', + "-DCH_ENABLE_MODULE_VSG=$enableVsg", + '-DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON' +) +if ((Get-Command cl -ErrorAction SilentlyContinue) -and (Get-Command ninja -ErrorAction SilentlyContinue)) { + $configureArgs += @('-G', 'Ninja') +} +if ($VcpkgRoot) { + $toolchain = Join-Path $VcpkgRoot "scripts\buildsystems\vcpkg.cmake" + if (-not (Test-Path -LiteralPath $toolchain)) { Fail "vcpkg toolchain file not found: $toolchain" } + $configureArgs += @("-DCMAKE_TOOLCHAIN_FILE=$($toolchain -replace '\\', '/')", '-DVCPKG_TARGET_TRIPLET=x64-windows') +} +# Chrono links an HDF5 "tools" target that vcpkg's HDF5 does not export. +$hdf5Shim = (Join-Path $PSScriptRoot "..\..\cmake\ChronoHdf5ToolsShim.cmake") +if (-not (Test-Path -LiteralPath $hdf5Shim)) { Fail "HDF5 shim not found: $hdf5Shim" } +$configureArgs += "-DCMAKE_PROJECT_INCLUDE=$((Resolve-Path -LiteralPath $hdf5Shim).Path -replace '\\', '/')" +if ($PrefixPath) { $configureArgs += "-DCMAKE_PREFIX_PATH=$PrefixPath" } +$configureArgs += $CMakeArgs +& cmake @configureArgs +if ($LASTEXITCODE -ne 0) { Fail "Chrono configure" } + +Write-Host "`n>> Build" +$buildArgs = @('--build', $buildDir, '--config', 'Release', '--parallel') +if ($Jobs -gt 0) { $buildArgs += "$Jobs" } +& cmake @buildArgs +if ($LASTEXITCODE -ne 0) { Fail "Chrono build" } + +Write-Host "`n>> Install" +& cmake --install $buildDir --config Release +if ($LASTEXITCODE -ne 0) { Fail "Chrono install" } + +Write-Host "`n>> Verify" +$configFile = Get-ChildItem -LiteralPath $Prefix -Recurse -File | + Where-Object { $_.Name -in 'ChronoConfig.cmake', 'chrono-config.cmake' } | + Select-Object -First 1 +if (-not $configFile) { Fail "no Chrono package config found under $Prefix" } +$chronoDir = $configFile.DirectoryName -replace '\\', '/' +foreach ($dll in 'Chrono_core.dll', 'Chrono_parsers.dll') { + if (-not (Get-ChildItem -LiteralPath $Prefix -Recurse -File -Filter $dll | Select-Object -First 1)) { + Fail "$dll not found under $Prefix" + } +} +Write-Host " [OK] Chrono_core.dll and Chrono_parsers.dll installed" + +Write-Host "`nChrono $ChronoTag installed." +Write-Host "ChronoDir: $chronoDir" +exit 0 From a9a52537284d2aa7ab695e0053ea023003e54c55 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 02:39:34 +0000 Subject: [PATCH 10/18] Add Windows jobs to continuous integration. Two jobs on windows-2022 mirror the Linux and macOS jobs through the PowerShell entry points: a Chrono-free build with its tests and the downstream-consumer check, and a Chrono build with the unit, regression and external tests plus the full suites on request. Eigen and HDF5 come from the vcpkg checkout on the runner, with its binary archives cached; Chrono is built by scripts/windows/build_chrono.ps1 and cached. In the Chrono-free job the vcpkg bin folder is put on PATH, because the HDF5 DLLs are only copied next to the tests in a Chrono build. --- .github/workflows/ci.yml | 345 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 344 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd40ffa..2874bca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ concurrency: env: # Thread counts are fixed so that results and timings are comparable between # runs: 2 concurrent tests, each with 2 OpenMP threads. The standard Linux - # runners have 4 virtual CPUs and the macOS runners 3. + # and Windows runners have 4 virtual CPUs and the macOS runners 3. OMP_NUM_THREADS: '2' OPENBLAS_NUM_THREADS: '1' CTEST_JOBS: '2' @@ -432,3 +432,346 @@ jobs: build/bin/Release/results/tests/**/plots/ if-no-files-found: warn retention-days: 30 + + # The Windows jobs use the PowerShell entry points under scripts/windows. + # Eigen and HDF5 come from the vcpkg checkout on the runner image. + chrono-free-windows: + name: Chrono-free build and tests (Windows) + runs-on: windows-2022 + timeout-minutes: 60 + steps: + - name: Check out the source + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ env.CHECKOUT_REF }} + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.12' + + # Exports the Visual Studio x64 compiler environment (vcvars64.bat) to the + # following steps, so that CMake can use Ninja with cl. + - name: Set up the MSVC environment + run: | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath + $vcvars = Join-Path $vsPath 'VC\Auxiliary\Build\vcvars64.bat' + if (-not (Test-Path -LiteralPath $vcvars)) { throw "vcvars64.bat not found: $vcvars" } + $before = @{} + Get-ChildItem Env: | ForEach-Object { $before[$_.Name] = $_.Value } + cmd /c "`"$vcvars`" >nul 2>&1 && set" | ForEach-Object { + if ($_ -match '^([^=]+)=(.*)$' -and $before[$Matches[1]] -ne $Matches[2]) { + "$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } + } + + - name: Locate vcpkg + id: vcpkg + run: | + $root = $env:VCPKG_INSTALLATION_ROOT + $commit = git -c safe.directory=* -C $root rev-parse --short=12 HEAD + if ($LASTEXITCODE -ne 0) { throw "cannot read the vcpkg commit in $root" } + $archives = Join-Path $HOME 'seastack-deps\vcpkg-archives' + New-Item -ItemType Directory -Force -Path $archives | Out-Null + "commit=$commit" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + "archives=$archives" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + "VCPKG_DEFAULT_BINARY_CACHE=$archives" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "VCPKG_INSTALLED=$(($root -replace '\\', '/'))/installed/x64-windows" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Restore the vcpkg binary cache + id: vcpkg-cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.vcpkg.outputs.archives }} + key: vcpkg-windows-2022-${{ steps.vcpkg.outputs.commit }}-eigen3-hdf5 + + - name: Install Eigen and HDF5 + run: | + & "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install eigen3:x64-windows "hdf5[cpp,hl,szip,zlib]:x64-windows" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" list + + - name: Save the vcpkg binary cache + if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.vcpkg.outputs.archives }} + key: ${{ steps.vcpkg-cache.outputs.cache-primary-key }} + + - name: Install Python packages + run: python -m pip install --requirement tests/regression/run_seastack/requirements.txt + + - name: Record the environment + run: | + "Runner: $env:RUNNER_OS $env:RUNNER_ARCH, image $env:ImageOS $env:ImageVersion" + "CPUs: $([Environment]::ProcessorCount)" + (Get-CimInstance Win32_Processor).Name + "Memory: {0:N0} GB" -f ((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB) + Get-PSDrive -PSProvider FileSystem | Format-Table Name, @{n='Used (GB)';e={[int]($_.Used/1GB)}}, @{n='Free (GB)';e={[int]($_.Free/1GB)}} + cmake --version | Select-Object -First 1 + "ninja $(ninja --version)" + "MSVC tools $env:VCToolsVersion" + python --version + python -m pip list --format=freeze | Select-String -Pattern '^(numpy|h5py|pyyaml|matplotlib)==' | ForEach-Object { $_.Line } + "OMP_NUM_THREADS=$env:OMP_NUM_THREADS CTEST_JOBS=$env:CTEST_JOBS" + + # CMakePrefixPath lets the Chrono-free configure find Eigen in vcpkg. The + # HDF5 DLLs are not copied next to the tests in a Chrono-free build, so + # their folder goes on PATH (docs/build/BUILD_WINDOWS.md, Troubleshooting). + - name: Write build-config.json and add the HDF5 DLLs to PATH + run: | + "$($env:VCPKG_INSTALLED -replace '/', '\')\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + [ordered]@{ + ChronoDir = '' + PythonRoot = ($env:pythonLocation -replace '\\', '/') + HDF5Dir = "$env:VCPKG_INSTALLED/share/hdf5" + CMakePrefixPath = $env:VCPKG_INSTALLED + Generator = '' + } | ConvertTo-Json | Set-Content -Encoding ascii build-config.json + Get-Content build-config.json + + - name: Build + id: build + run: .\scripts\windows\build.ps1 -NoChrono -External -Verbose + + - name: Run the chrono-free tests + id: ctest + run: .\scripts\windows\run_chrono_free_tests.ps1 -j $env:CTEST_JOBS -Junit test-results/chrono-free.xml + + # CTest exits with 0 when a test is skipped. Fail unless every test ran. + - name: Check that every test ran and passed + if: ${{ !cancelled() && steps.ctest.conclusion != 'skipped' }} + run: python scripts/ci/check_ctest_junit.py build/test-results/chrono-free.xml --summary $env:GITHUB_STEP_SUMMARY + + - name: Downstream-consumer check + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: .\scripts\windows\run_consumer_check.ps1 -WorkDir (Join-Path $env:RUNNER_TEMP 'consumer-check') + + - name: Upload test results + if: ${{ !cancelled() }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: chrono-free-windows-results + path: | + build/test-results/ + build/Testing/Temporary/LastTest.log + build/build-diagnostics.log + if-no-files-found: warn + retention-days: 14 + + chrono-windows: + name: Chrono build and tests (Windows) + runs-on: windows-2022 + timeout-minutes: 240 + steps: + - name: Check out the source + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ env.CHECKOUT_REF }} + submodules: recursive + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.12' + + # Exports the Visual Studio x64 compiler environment (vcvars64.bat) to the + # following steps, so that CMake can use Ninja with cl. + - name: Set up the MSVC environment + run: | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath + $vcvars = Join-Path $vsPath 'VC\Auxiliary\Build\vcvars64.bat' + if (-not (Test-Path -LiteralPath $vcvars)) { throw "vcvars64.bat not found: $vcvars" } + $before = @{} + Get-ChildItem Env: | ForEach-Object { $before[$_.Name] = $_.Value } + cmd /c "`"$vcvars`" >nul 2>&1 && set" | ForEach-Object { + if ($_ -match '^([^=]+)=(.*)$' -and $before[$Matches[1]] -ne $Matches[2]) { + "$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } + } + + - name: Locate vcpkg and the Chrono installation + id: deps + run: | + $root = $env:VCPKG_INSTALLATION_ROOT + $commit = git -c safe.directory=* -C $root rev-parse --short=12 HEAD + if ($LASTEXITCODE -ne 0) { throw "cannot read the vcpkg commit in $root" } + $archives = Join-Path $HOME 'seastack-deps\vcpkg-archives' + New-Item -ItemType Directory -Force -Path $archives | Out-Null + "commit=$commit" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + "archives=$archives" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + "chrono=$(Join-Path $HOME 'seastack-deps\chrono-10.0.0')" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + "msvc=$env:VCToolsVersion" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + "VCPKG_DEFAULT_BINARY_CACHE=$archives" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "VCPKG_INSTALLED=$(($root -replace '\\', '/'))/installed/x64-windows" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Restore the vcpkg binary cache + id: vcpkg-cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.deps.outputs.archives }} + key: vcpkg-windows-2022-${{ steps.deps.outputs.commit }}-eigen3-hdf5 + + - name: Install Eigen and HDF5 + run: | + & "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install eigen3:x64-windows "hdf5[cpp,hl,szip,zlib]:x64-windows" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" list + + - name: Save the vcpkg binary cache + if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.deps.outputs.archives }} + key: ${{ steps.vcpkg-cache.outputs.cache-primary-key }} + + # pytest runs tests/unit/python/test_demo_features.py, which is skipped without it. + - name: Install Python packages + run: | + python -m pip install --requirement tests/regression/run_seastack/requirements.txt + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + python -m pip install pytest + + - name: Record the environment + run: | + "Runner: $env:RUNNER_OS $env:RUNNER_ARCH, image $env:ImageOS $env:ImageVersion" + "CPUs: $([Environment]::ProcessorCount)" + (Get-CimInstance Win32_Processor).Name + "Memory: {0:N0} GB" -f ((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB) + Get-PSDrive -PSProvider FileSystem | Format-Table Name, @{n='Used (GB)';e={[int]($_.Used/1GB)}}, @{n='Free (GB)';e={[int]($_.Free/1GB)}} + cmake --version | Select-Object -First 1 + "ninja $(ninja --version)" + "MSVC tools $env:VCToolsVersion" + python --version + python -m pip list --format=freeze | Select-String -Pattern '^(numpy|h5py|pyyaml|matplotlib|pytest)==' | ForEach-Object { $_.Line } + "OMP_NUM_THREADS=$env:OMP_NUM_THREADS CTEST_JOBS=$env:CTEST_JOBS FULL_SUITES=$env:FULL_SUITES" + git log -1 --format='Source: %H %s' + + # Chrono is built by scripts/windows/build_chrono.ps1 and reused until that + # script, the HDF5 shim, the compiler or the vcpkg checkout changes. + - name: Restore the Chrono installation + id: chrono-cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.deps.outputs.chrono }} + key: chrono-10.0.0-windows-2022-msvc${{ steps.deps.outputs.msvc }}-vcpkg${{ steps.deps.outputs.commit }}-${{ hashFiles('scripts/windows/build_chrono.ps1', 'cmake/ChronoHdf5ToolsShim.cmake') }} + + - name: Build Chrono + if: ${{ steps.chrono-cache.outputs.cache-hit != 'true' }} + env: + CHRONO_PREFIX: ${{ steps.deps.outputs.chrono }} + run: | + $work = Join-Path $env:RUNNER_TEMP 'chrono-work' + .\scripts\windows\build_chrono.ps1 -Prefix $env:CHRONO_PREFIX -WorkDir $work -VcpkgRoot $env:VCPKG_INSTALLATION_ROOT + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + Remove-Item -Recurse -Force $work + + # Saved here, not at the end of the job, so that a test failure does not + # discard the Chrono build. + - name: Save the Chrono installation + if: ${{ steps.chrono-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.deps.outputs.chrono }} + key: ${{ steps.chrono-cache.outputs.cache-primary-key }} + + - name: Write build-config.json + env: + CHRONO_PREFIX: ${{ steps.deps.outputs.chrono }} + run: | + $config = Get-ChildItem -LiteralPath $env:CHRONO_PREFIX -Recurse -File | + Where-Object { $_.Name -in 'ChronoConfig.cmake', 'chrono-config.cmake' } | Select-Object -First 1 + if (-not $config) { throw "no Chrono package config under $env:CHRONO_PREFIX" } + [ordered]@{ + ChronoDir = ($config.DirectoryName -replace '\\', '/') + PythonRoot = ($env:pythonLocation -replace '\\', '/') + HDF5Dir = "$env:VCPKG_INSTALLED/share/hdf5" + Generator = '' + } | ConvertTo-Json | Set-Content -Encoding ascii build-config.json + Get-Content build-config.json + + - name: Build + id: build + run: .\scripts\windows\build.ps1 -MoorDyn -External -Demos -Verbose + + - name: Run the unit tests + run: .\scripts\windows\run_unit_tests.ps1 -j $env:CTEST_JOBS -Junit test-results/unit.xml + + - name: Run the regression tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: .\scripts\windows\run_regression_tests.ps1 -j $env:CTEST_JOBS -NoPdf -Junit test-results/regression.xml + + - name: Run the external-module tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: > + ctest --test-dir build -C Release -L '^external$' --no-tests=error + --output-on-failure -j $env:CTEST_JOBS + --output-junit test-results/external.xml + + # ---- Full suites (see FULL_SUITES above); Markdown reports only ---- + - name: Run the verification tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: .\scripts\windows\run_verification_tests.ps1 -j $env:CTEST_JOBS -NoPdf -Junit test-results/verification.xml + + - name: Run the comparison tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: .\scripts\windows\run_comparison_tests.ps1 -j $env:CTEST_JOBS -NoPdf -Junit test-results/comparison.xml + + # Runs last of the CTest suites, so the regression report describes the long run. + - name: Run the long regression tests + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: .\scripts\windows\run_regression_tests.ps1 -Long -j $env:CTEST_JOBS -NoPdf -Junit test-results/regression-long.xml + + - name: Run the demo cases against their baselines + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + run: > + python tests/regression/run_seastack/run_tests.py --all --quiet + --exe build/bin/Release/run_seastack.exe + + # Wall-clock timings on shared runners are for information only, so this + # step does not fail the job. + - name: Run the benchmarks + if: ${{ !cancelled() && steps.build.conclusion == 'success' && env.FULL_SUITES == 'true' }} + continue-on-error: true + run: .\scripts\windows\run_benchmarks.ps1 + + # CTest exits with 0 when a test is skipped. Fail unless every test ran. + - name: Check that every test ran and passed + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: | + $suites = @('unit', 'regression', 'external') + if ($env:FULL_SUITES -eq 'true') { $suites += 'verification', 'comparison', 'regression-long' } + $status = 0 + foreach ($suite in $suites) { + python scripts/ci/check_ctest_junit.py "build/test-results/$suite.xml" --summary $env:GITHUB_STEP_SUMMARY + if ($LASTEXITCODE -ne 0) { $status = 1 } + } + exit $status + + - name: Upload test results + if: ${{ !cancelled() }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: chrono-windows-results + path: | + build/test-results/ + build/Testing/Temporary/LastTest.log + build/build-diagnostics.log + if-no-files-found: warn + retention-days: 14 + + # Markdown reports with the figures they refer to. + - name: Upload test reports + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: chrono-windows-reports + path: | + build/bin/Release/results/tests/*/report/ + build/bin/Release/results/tests/**/plots/ + if-no-files-found: warn + retention-days: 30 From 9bdd32eee4ec5e0d86f9d3a6b8b98262765654cb Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 03:35:14 +0000 Subject: [PATCH 11/18] Do not fail the Windows job when the Chrono work folder cannot be removed. The first Windows run built and installed Chrono, then failed on Remove-Item with 'The directory is not empty' while deleting the temporary source and build folder, before the installation was cached. The folder is now removed on a best-effort basis. The Chrono build output is also written to chrono-build.log and uploaded with the test results, so that a failed Chrono build can be diagnosed from the artifact. --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2874bca..c59c7c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -666,9 +666,14 @@ jobs: CHRONO_PREFIX: ${{ steps.deps.outputs.chrono }} run: | $work = Join-Path $env:RUNNER_TEMP 'chrono-work' - .\scripts\windows\build_chrono.ps1 -Prefix $env:CHRONO_PREFIX -WorkDir $work -VcpkgRoot $env:VCPKG_INSTALLATION_ROOT + # The log is uploaded with the test results, so a failed Chrono build can be diagnosed. + $log = Join-Path $env:GITHUB_WORKSPACE 'chrono-build.log' + .\scripts\windows\build_chrono.ps1 -Prefix $env:CHRONO_PREFIX -WorkDir $work -VcpkgRoot $env:VCPKG_INSTALLATION_ROOT *>&1 | + Tee-Object -FilePath $log if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - Remove-Item -Recurse -Force $work + # Removing the work folder frees disk space; a locked file there must not fail the job. + Remove-Item -Recurse -Force $work -ErrorAction SilentlyContinue + exit 0 # Saved here, not at the end of the job, so that a test failure does not # discard the Chrono build. @@ -761,6 +766,7 @@ jobs: build/test-results/ build/Testing/Temporary/LastTest.log build/build-diagnostics.log + chrono-build.log if-no-files-found: warn retention-days: 14 From ef6ae96174ccc70e62c07cc128fdaa44db62defd Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 04:29:15 +0000 Subject: [PATCH 12/18] Point the Windows Chrono build at the vcpkg tree so that HDF5 finds ZLIB. On the windows-2022 runner the SEA-Stack configure stopped in find_package(HDF5): vcpkg's hdf5-config.cmake could not find its ZLIB dependency. The build-config.json written by the Windows Chrono job now sets CMakePrefixPath to the vcpkg installed tree, as docs/build/BUILD_WINDOWS.md describes and as the Chrono-free job already does. --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c59c7c0..65a8a08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -691,11 +691,14 @@ jobs: $config = Get-ChildItem -LiteralPath $env:CHRONO_PREFIX -Recurse -File | Where-Object { $_.Name -in 'ChronoConfig.cmake', 'chrono-config.cmake' } | Select-Object -First 1 if (-not $config) { throw "no Chrono package config under $env:CHRONO_PREFIX" } + # CMakePrefixPath lets vcpkg's HDF5 package find its ZLIB dependency + # (docs/build/BUILD_WINDOWS.md, section 2). [ordered]@{ - ChronoDir = ($config.DirectoryName -replace '\\', '/') - PythonRoot = ($env:pythonLocation -replace '\\', '/') - HDF5Dir = "$env:VCPKG_INSTALLED/share/hdf5" - Generator = '' + ChronoDir = ($config.DirectoryName -replace '\\', '/') + PythonRoot = ($env:pythonLocation -replace '\\', '/') + HDF5Dir = "$env:VCPKG_INSTALLED/share/hdf5" + CMakePrefixPath = $env:VCPKG_INSTALLED + Generator = '' } | ConvertTo-Json | Set-Content -Encoding ascii build-config.json Get-Content build-config.json From 66e62f9d0c5d188a24f65d6af7d3b445740bad20 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 08:39:48 +0000 Subject: [PATCH 13/18] Fix run_unit_tests.ps1 failing to parse under PowerShell 7. The help text contained a backtick followed by 'u' inside a double-quoted string. PowerShell 7 reads that as the start of a Unicode escape and rejects the whole script with a parser error; Windows PowerShell 5.1 ignores the backtick. The backticks are removed, which leaves the 5.1 output unchanged. --- scripts/windows/run_unit_tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/windows/run_unit_tests.ps1 b/scripts/windows/run_unit_tests.ps1 index 128e7c2..4afcc55 100644 --- a/scripts/windows/run_unit_tests.ps1 +++ b/scripts/windows/run_unit_tests.ps1 @@ -32,7 +32,7 @@ $repoRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $MyInvoca if ($Help) { Write-Host "`nSEA-Stack Unit Test Runner" -ForegroundColor Cyan Write-Host "==========================" -ForegroundColor Cyan - Write-Host "`nRuns CTest tests with label `unit`.`n" + Write-Host "`nRuns CTest tests with label unit.`n" Write-Host "OPTIONS:" -ForegroundColor Yellow Write-Host " -BuildDir Build directory (default: build)" Write-Host " -BuildType Release|Debug|RelWithDebInfo|MinSizeRel (default: Release)" From 7f66ffe5f9d871ea6709a45bb0ed770e38f7b8d3 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 08:39:48 +0000 Subject: [PATCH 14/18] Stage the remaining vcpkg runtime DLLs for the Windows tests in continuous integration. On the windows-2022 runner the regression test programs stopped with 0xc0000135 (DLL not found). They load HDF5 and its dependencies from the output folder, where build.ps1 copies hdf5*, szip* and zlib* only. The Windows Chrono job now copies any other DLL from the vcpkg bin folder into the output folder and records what was staged, what was copied and what hdf5.dll and szip.dll import in staged-dlls.txt, uploaded with the test results. --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65a8a08..7456069 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -706,6 +706,36 @@ jobs: id: build run: .\scripts\windows\build.ps1 -MoorDyn -External -Demos -Verbose + # The test programs load the HDF5 DLLs and their dependencies from the + # output folder. build.ps1 copies hdf5*, szip* and zlib*; copy any other + # vcpkg runtime DLL as well, and record what was staged in the artifact. + - name: Stage the vcpkg runtime DLLs + if: ${{ !cancelled() && steps.build.conclusion == 'success' }} + run: | + $bin = 'build\bin\Release' + $vcpkgBin = "$($env:VCPKG_INSTALLED -replace '/', '\')\bin" + New-Item -ItemType Directory -Force -Path 'build\test-results' | Out-Null + $report = 'build\test-results\staged-dlls.txt' + $staged = @(Get-ChildItem $bin -Filter *.dll | ForEach-Object { $_.Name }) + "DLLs in $bin after build.ps1:" | Out-File $report -Encoding utf8 + $staged | Sort-Object | Out-File $report -Encoding utf8 -Append + "DLLs in ${vcpkgBin}:" | Out-File $report -Encoding utf8 -Append + Get-ChildItem $vcpkgBin -Filter *.dll | ForEach-Object { $_.Name } | Sort-Object | Out-File $report -Encoding utf8 -Append + "Copied from vcpkg because build.ps1 did not stage them:" | Out-File $report -Encoding utf8 -Append + Get-ChildItem $vcpkgBin -Filter *.dll | Where-Object { $_.Name -notin $staged } | ForEach-Object { + Copy-Item -LiteralPath $_.FullName -Destination $bin + $_.Name + } | Out-File $report -Encoding utf8 -Append + if (Get-Command dumpbin -ErrorAction SilentlyContinue) { + foreach ($dll in 'hdf5.dll', 'szip.dll') { + "Imports of ${dll}:" | Out-File $report -Encoding utf8 -Append + dumpbin /nologo /dependents (Join-Path $vcpkgBin $dll) | + Where-Object { $_ -match '\.dll' -and $_ -notmatch 'api-ms|Dump of' } | + ForEach-Object { $_.Trim() } | Out-File $report -Encoding utf8 -Append + } + } + Get-Content $report + - name: Run the unit tests run: .\scripts\windows\run_unit_tests.ps1 -j $env:CTEST_JOBS -Junit test-results/unit.xml From faafcf438e2a2e822f570b272b940b40d34071bc Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 09:53:26 +0000 Subject: [PATCH 15/18] Stage and install vcpkg's zlib DLL under its newer name, libz.dll. Newer vcpkg releases ship zlib as libz.dll instead of zlib1.dll, and hdf5.dll imports it by that name. build.ps1 copied only zlib*.dll next to the executables, so on a current vcpkg every Chrono-linked test stopped with 0xc0000135 (DLL not found), as seen on the windows-2022 continuous integration runner. The install rule for the Windows package listed only zlib1.dll, so a package built with a current vcpkg would lack zlib and run_seastack.exe would not start. Both now also take libz.dll. Each copies or installs only the files that exist, so older vcpkg trees are handled as before. --- CMakeLists.txt | 6 ++++-- scripts/windows/build.ps1 | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29228cd..156251c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -838,12 +838,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") endif() endif() endforeach() - # vcpkg-style HDF5: zlib1.dll / szip.dll sit next to hdf5.dll but are not + # vcpkg-style HDF5: the zlib and szip DLLs sit next to hdf5.dll but are not # separate imported targets; install them so staged installs and CPack run. + # vcpkg's zlib DLL is zlib1.dll in older releases and libz.dll in newer ones; + # only the files that exist are installed. get_target_property(_hdf5_main_dll hdf5::hdf5-shared IMPORTED_LOCATION_RELEASE) if(_hdf5_main_dll AND EXISTS "${_hdf5_main_dll}") get_filename_component(_hdf5_peer_dir "${_hdf5_main_dll}" DIRECTORY) - foreach(_hdf5_peer_dll IN ITEMS zlib1.dll szip.dll) + foreach(_hdf5_peer_dll IN ITEMS zlib1.dll libz.dll szip.dll) set(_hdf5_peer "${_hdf5_peer_dir}/${_hdf5_peer_dll}") if(EXISTS "${_hdf5_peer}") install(FILES "${_hdf5_peer}" DESTINATION bin COMPONENT runtime) diff --git a/scripts/windows/build.ps1 b/scripts/windows/build.ps1 index 54045fc..c28a7a9 100644 --- a/scripts/windows/build.ps1 +++ b/scripts/windows/build.ps1 @@ -935,7 +935,8 @@ if ($useChrono -and $chronoContent) { $hdf5Root = Split-Path (Split-Path $Matches[1]) $hdf5BinDir = Join-Path $hdf5Root "bin" if (Test-Path -LiteralPath $hdf5BinDir) { - $hdf5Dlls = Get-ChildItem -Path $hdf5BinDir -Include "hdf5*.dll", "szip*.dll", "zlib*.dll" -Recurse -ErrorAction SilentlyContinue + # vcpkg's zlib DLL is zlib1.dll in older releases and libz.dll in newer ones. + $hdf5Dlls = Get-ChildItem -Path $hdf5BinDir -Include "hdf5*.dll", "szip*.dll", "zlib*.dll", "libz.dll" -Recurse -ErrorAction SilentlyContinue $copiedCount = 0 foreach ($dll in $hdf5Dlls) { $destDll = Join-Path $binPath $dll.Name From 70064f39def264146a89b1c8ecadfa881618c158 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 09:53:26 +0000 Subject: [PATCH 16/18] Check the staged vcpkg DLLs instead of copying them in continuous integration. The Windows Chrono job copied every vcpkg DLL that build.ps1 had not staged, which hid the libz.dll naming problem from the project's own staging. The step now only checks: it fails with the name of the missing file if a vcpkg DLL staged next to the tests imports another vcpkg DLL that was not staged, and records the listing in staged-dlls.txt. --- .github/workflows/ci.yml | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7456069..21dc515 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -706,10 +706,12 @@ jobs: id: build run: .\scripts\windows\build.ps1 -MoorDyn -External -Demos -Verbose - # The test programs load the HDF5 DLLs and their dependencies from the - # output folder. build.ps1 copies hdf5*, szip* and zlib*; copy any other - # vcpkg runtime DLL as well, and record what was staged in the artifact. - - name: Stage the vcpkg runtime DLLs + # The test programs load the vcpkg DLLs from the output folder, where + # build.ps1 copies them. Fail with a clear message if a DLL staged from + # vcpkg imports another vcpkg DLL that was not staged (for example after + # vcpkg renames a library), instead of letting every test stop with + # 0xc0000135. The listing is uploaded with the test results. + - name: Check the staged vcpkg DLLs if: ${{ !cancelled() && steps.build.conclusion == 'success' }} run: | $bin = 'build\bin\Release' @@ -717,24 +719,26 @@ jobs: New-Item -ItemType Directory -Force -Path 'build\test-results' | Out-Null $report = 'build\test-results\staged-dlls.txt' $staged = @(Get-ChildItem $bin -Filter *.dll | ForEach-Object { $_.Name }) + $vcpkgDlls = @(Get-ChildItem $vcpkgBin -Filter *.dll | ForEach-Object { $_.Name }) "DLLs in $bin after build.ps1:" | Out-File $report -Encoding utf8 $staged | Sort-Object | Out-File $report -Encoding utf8 -Append "DLLs in ${vcpkgBin}:" | Out-File $report -Encoding utf8 -Append - Get-ChildItem $vcpkgBin -Filter *.dll | ForEach-Object { $_.Name } | Sort-Object | Out-File $report -Encoding utf8 -Append - "Copied from vcpkg because build.ps1 did not stage them:" | Out-File $report -Encoding utf8 -Append - Get-ChildItem $vcpkgBin -Filter *.dll | Where-Object { $_.Name -notin $staged } | ForEach-Object { - Copy-Item -LiteralPath $_.FullName -Destination $bin - $_.Name - } | Out-File $report -Encoding utf8 -Append - if (Get-Command dumpbin -ErrorAction SilentlyContinue) { - foreach ($dll in 'hdf5.dll', 'szip.dll') { - "Imports of ${dll}:" | Out-File $report -Encoding utf8 -Append - dumpbin /nologo /dependents (Join-Path $vcpkgBin $dll) | - Where-Object { $_ -match '\.dll' -and $_ -notmatch 'api-ms|Dump of' } | - ForEach-Object { $_.Trim() } | Out-File $report -Encoding utf8 -Append + $vcpkgDlls | Sort-Object | Out-File $report -Encoding utf8 -Append + $missing = @() + foreach ($dll in ($staged | Where-Object { $_ -in $vcpkgDlls })) { + $imports = @(dumpbin /nologo /dependents (Join-Path $bin $dll) | + Where-Object { $_ -match '^\s+\S+\.dll\s*$' } | ForEach-Object { $_.Trim() }) + "Imports of ${dll}: $($imports -join ', ')" | Out-File $report -Encoding utf8 -Append + foreach ($import in $imports) { + if ($import -in $vcpkgDlls -and $import -notin $staged) { $missing += "$dll imports $import" } } } Get-Content $report + if ($missing) { + $missing | ForEach-Object { "::error::vcpkg DLL not staged next to the tests: $_" } + exit 1 + } + "[OK] every vcpkg DLL imported by a staged vcpkg DLL is staged" - name: Run the unit tests run: .\scripts\windows\run_unit_tests.ps1 -j $env:CTEST_JOBS -Junit test-results/unit.xml From 03649f9f76e1a098a442f3095846ae2c123cd4b6 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 11:19:25 +0000 Subject: [PATCH 17/18] Describe continuous integration in the contributing guide and the test guide. tests/README.md lists what each continuous integration job builds and runs, when the full suites run, that a skipped test fails a run, and what is uploaded. Its suite table now states when each suite runs in continuous integration and includes the external label. CONTRIBUTING.md points to it and states what to do when a test fails on one platform only. --- CONTRIBUTING.md | 14 ++++++++++++++ tests/README.md | 36 +++++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea26f9b..9dc8e5f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -139,6 +139,20 @@ See [tests/README.md](tests/README.md) for suite overview and how to run tests. For per-case tables and CI-style `ctest` usage, see [tests/TEST_SUITES_REFERENCE.md](tests/TEST_SUITES_REFERENCE.md). +### Continuous integration + +Every pull request is built and tested on Linux, macOS and Windows by GitHub +Actions ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)). The jobs run +the same build and test scripts as a local build, so a failure can be +reproduced with the commands shown in the job log. What runs, and when, is +described in [tests/README.md](tests/README.md#continuous-integration). + +- A run fails if a test fails **or is skipped**. +- Add the label **`full-tests`** to a pull request to also run the + verification, comparison and long regression suites before merging. +- If a test fails on one platform only, report it in the pull request. Do not + regenerate reference data or widen a tolerance to make the run pass. + ## License diff --git a/tests/README.md b/tests/README.md index b04acd3..6f9ea1e 100644 --- a/tests/README.md +++ b/tests/README.md @@ -29,15 +29,16 @@ Verification compares against **external or multi-code** reference data under `d Unit tests exercise libraries with assertions. **Chrono-free** tests omit Chrono DLLs; useful when you only need the non-Chrono stack. -| Track / suite | Purpose | Typical CI | CTest label(s) | -|---------------|---------|------------|----------------| -| Unit | Library checks | Every commit | `unit` | -| Chrono-free | No Chrono | Every commit | `chrono-free` | -| Core regression | vs `ss_ref_*.txt` | Every commit (fast) | `regression` | -| Consistency | Internal self-validation | Every commit | `regression;consistency` | -| Verification | Cross-code / multi-code | Nightly / on-demand | `verification` | -| Comparison | Method vs method (internal) | On-demand | `comparison` | -| Benchmark | Performance timing | On-demand | `benchmark` | +| Track / suite | Purpose | Continuous integration | CTest label(s) | +|---------------|---------|------------------------|----------------| +| Unit | Library checks | Every pull request | `unit` | +| Chrono-free | No Chrono | Every pull request | `chrono-free` | +| Core regression | vs `ss_ref_*.txt` | Every pull request | `regression` | +| Consistency | Internal self-validation | Every pull request | `regression;consistency` | +| External modules | External PTO and controller runs | Every pull request | `external` | +| Verification | Cross-code / multi-code | Nightly / on request | `verification` | +| Comparison | Method vs method (internal) | Nightly / on request | `comparison` | +| Benchmark | Performance timing | Nightly / on request (for information) | `benchmark` | ## Run the main test suites @@ -56,6 +57,23 @@ Unit tests exercise libraries with assertions. **Chrono-free** tests omit Chrono Verbose ctest output, `-BuildType`/Release notes, and **raw `ctest` vs PowerShell** behavior for verification/comparison reports: [TEST_SUITES_REFERENCE.md](TEST_SUITES_REFERENCE.md). +## Continuous integration + +GitHub Actions builds and tests SEA-Stack on Linux, macOS and Windows ([`.github/workflows/ci.yml`](../.github/workflows/ci.yml)). Each platform has two jobs, which call the scripts in the tables above: + +| Job | Build | Tests | +|-----|-------|-------| +| Chrono-free | `--no-chrono --external` / `-NoChrono -External` | `chrono-free` label and the downstream-consumer check | +| Chrono | Headless Chrono 10.0.0 built by `scripts/unix/build_chrono.sh` or `scripts/windows/build_chrono.ps1`, with MoorDyn, external modules and demos; no VSG | `unit`, `regression` and `external` labels | + +The Chrono job also runs the **full suites** (verification, comparison, long regression, the demo cases through `run_tests.py --all`, and the benchmarks) every night on `dev`, on a manual run of the workflow, and on a pull request that carries the label `full-tests`. + +- **Threads:** two tests run at a time, each with `OMP_NUM_THREADS=2`. +- **Skipped tests fail the run.** CTest exits with 0 when a test returns its skip code, for example when a Python package is missing; `scripts/ci/check_ctest_junit.py` reads the JUnit report of each suite and fails unless every test ran and passed. The suite scripts write that report with `--junit FILE` (Unix) or `-Junit FILE` (Windows). +- **Benchmarks do not fail the run.** Timings on shared runners are for information only. +- **Results:** each job uploads its JUnit reports and logs, and the Chrono job its Markdown reports with figures. The full suites on Linux also write the reports as PDF. +- **Not covered:** the VSG GUI build and the release packages. + ## Test-only environment variables `run_seastack` reads two variables that exist only so that tests can provoke From 3376d9681b09cf2f16ed44f2e91174361ba33f24 Mon Sep 17 00:00:00 2001 From: David Ogden <12831266+dav-og@users.noreply.github.com> Date: Wed, 2 Dec 2026 11:19:25 +0000 Subject: [PATCH 18/18] Add a single All checks job for branch protection. The job passes only if every build and test job passed. Requiring this one status keeps the branch protection settings independent of the list of platforms and jobs. --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21dc515..61374f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -818,3 +818,25 @@ jobs: build/bin/Release/results/tests/**/plots/ if-no-files-found: warn retention-days: 30 + + # One status for branch protection: passes only if every job above passed. + # Requiring this job means the list of platforms can change without editing + # the repository settings. + all-checks: + name: All checks + if: ${{ always() }} + needs: [chrono-free, chrono, chrono-free-windows, chrono-windows] + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - name: Require every job to have passed + env: + RESULTS: ${{ join(needs.*.result, ' ') }} + run: | + echo "Job results: ${RESULTS}" + for result in ${RESULTS}; do + if [[ "${result}" != "success" ]]; then + echo "::error::a job did not pass (${result})" + exit 1 + fi + done