From 55630ae9989511ddbb37d16a6e473e9877840cac Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Thu, 8 Jan 2026 13:44:00 +0100 Subject: [PATCH 1/4] add worklfow --- .github/workflows/build.yml | 120 +++++++++++++++++++++++++++++++ .github/workflows/spdx-check.yml | 45 ++++++++++++ README.md | 3 + 3 files changed, 168 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/spdx-check.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d70676d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,120 @@ +name: Build (Windows) + +on: + push: + branches: [ "master", "main" ] + pull_request: + branches: [ "master", "main" ] + workflow_dispatch: + +jobs: + build: + # Guard: if this workflow ever gets merged upstream (e.g. HoareLea), + # it will show as "skipped" there and won't break their CI. + if: github.repository_owner == 'SAM-BIM' + runs-on: windows-2022 + + env: + MSBUILDDISABLENODEREUSE: "1" + ORG_NAME: "SAM-BIM" + # >>> CHANGE THIS PER REPO <<< + # Examples: SAM, SAM_gbXML, SAM_GEM, SAM_Tas, ... + REPO_NAME: "SAM_Validation" + + steps: + - name: Checkout this repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: ${{ env.REPO_NAME }} + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.x" + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Clone dependency repos (siblings) + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + + $org = '${{ env.ORG_NAME }}' + $repo = '${{ env.REPO_NAME }}' + + # >>> ADJUST BUILD ORDER HERE IF NEEDED <<< + # Keep the current repo LAST. + $buildOrder = @( + 'SAM' + 'SAM_Mollier' + 'SAM_IAPWS' + $repo + ) + + # Clone everything except the last one (already checked out by Actions) + $deps = $buildOrder[0..($buildOrder.Count-2)] + foreach ($r in $deps) { + if (Test-Path $r) { continue } + Write-Host "Cloning https://github.com/$org/$r.git" + git clone --depth 1 "https://github.com/$org/$r.git" $r + } + + # Ensure ReferencePath exists even before SAM_Windows builds + New-Item -ItemType Directory -Force -Path "SAM_Windows\build" | Out-Null + + - name: Restore + Rebuild in order (CI props like SAM_Deploy) + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + + $repo = '${{ env.REPO_NAME }}' + $windowsRef = (Resolve-Path 'SAM_Windows\build').Path + + # IMPORTANT: keep these as an ARRAY of args (do NOT join into one string) + $common = @( + '/m:1' + '/nr:false' + '/v:m' + '/p:Configuration=Release' + '/p:UseSharedCompilation=false' + '/p:RunPostBuildEvent=OnOutputUpdated' + "/p:ReferencePath=$windowsRef" + ) + + # If you really want Platform, use QUOTED Any CPU: + # $common += '/p:Platform="Any CPU"' + + # Same build order as above (keep repo LAST) + $buildOrder = @( + 'SAM' + 'SAM_Mollier' + 'SAM_IAPWS' + $repo + ) + + # Convert build order -> solution paths (robust: first .sln in each folder) + $solutions = foreach ($r in $buildOrder) { + $sln = Get-ChildItem -Path $r -Filter *.sln -File | Select-Object -First 1 + if (-not $sln) { throw "No .sln found under: $r" } + $sln.FullName + } + + foreach ($sln in $solutions) { + Write-Host "==> Restore: $sln" + & msbuild $sln /t:Restore @common + } + + foreach ($sln in $solutions) { + Write-Host "==> Rebuild: $sln" + & msbuild $sln /t:Rebuild @common + } + + - name: Upload build folders (optional) + uses: actions/upload-artifact@v4 + with: + name: ${{ env.REPO_NAME }}-build-folders + path: | + **\build\* + if-no-files-found: warn diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml new file mode 100644 index 0000000..9b1f74e --- /dev/null +++ b/.github/workflows/spdx-check.yml @@ -0,0 +1,45 @@ +name: SPDX + Copyright header check + +on: + pull_request: + +jobs: + spdx: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check header in changed .cs files + run: | + set -e + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" + + FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) + + if [ -z "$FILES" ]; then + echo "No C# files changed." + exit 0 + fi + + MISSING="" + for f in $FILES; do + HEADBLOCK=$(head -n 6 "$f") + + echo "$HEADBLOCK" | grep -q "// SPDX-License-Identifier: LGPL-3.0-or-later" || MISSING="$MISSING $f" + echo "$HEADBLOCK" | grep -q "// Copyright (c) 2020–2025 Michal Dengusiak & Jakub Ziolkowski and contributors" || MISSING="$MISSING $f" + done + + if [ -n "$MISSING" ]; then + echo "❌ Missing required header in:" + for f in $MISSING; do echo " - $f"; done + echo "" + echo "Each changed .cs file must start with:" + echo "// SPDX-License-Identifier: LGPL-3.0-or-later" + echo "// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors" + exit 1 + fi + + echo "✅ SPDX + copyright headers OK." diff --git a/README.md b/README.md index e4f2bff..e68f744 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build](https://github.com/SAM-BIM/SAM_Validation/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM/SAM_Validation/actions/workflows/build.yml) +[![Installer (latest)](https://img.shields.io/github/v/release/SAM-BIM/SAM_Deploy?label=installer)](https://github.com/SAM-BIM/SAM_Deploy/releases/latest) + # SAM_Validation From b75fe6e1f25e18dfcb6a55591884d1a0affc13d4 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Thu, 8 Jan 2026 17:37:18 +0100 Subject: [PATCH 2/4] standard SAM-BIM legal files --- COPYRIGHT_HEADER.txt | 2 ++ NOTICE | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 COPYRIGHT_HEADER.txt create mode 100644 NOTICE diff --git a/COPYRIGHT_HEADER.txt b/COPYRIGHT_HEADER.txt new file mode 100644 index 0000000..e645f12 --- /dev/null +++ b/COPYRIGHT_HEADER.txt @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors \ No newline at end of file diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..22b0be5 --- /dev/null +++ b/NOTICE @@ -0,0 +1,19 @@ +SAM-BIM — Sustainable Analytical Model (SAM) + +Copyright © 2020–2026 +Michal Dengusiak & Jakub Ziolkowski and contributors + +This repository is part of the SAM (Sustainable Analytical Model) toolkit. + +License +This project is licensed under the GNU Lesser General Public License +v3.0 or later (LGPL-3.0-or-later). See the LICENSE file for details. + +Attribution and third-party software +Each contributor retains copyright to their respective contributions. +The project history (Git) records authorship and provenance of all changes. + +This repository may include or depend on third-party open-source components. +Where applicable, third-party notices and license information are provided in: +- THIRD_PARTY.md (if present) +- LICENSE (and any license files within third-party source folders) From cf9958819a9ff8bcf74dac5130452563de5dd9da Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Fri, 9 Jan 2026 15:35:49 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 97 ++++++++++++++++++++++--------------------------------- 1 file changed, 38 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index e68f744..885feaf 100644 --- a/README.md +++ b/README.md @@ -3,28 +3,34 @@ # SAM_Validation - + + + -**SAM_Validation** is a repository containing validation tests for various SAM toolkits. Welcome and let's make the opensource journey continue. :handshake: +**SAM_Validation** is part of the **SAM (Sustainable Analytical Model) Toolkit** — +an open-source collection of tools designed to help engineers create, manage, +and process analytical building models for energy and environmental analysis. -# SAM_Validation - -🧪 A modular validation suite for the Sustainable Analytical Model (SAM) platform developed by Hoare Lea. -This repository compares outputs from SAM modules against trusted reference implementations such as PsychroLib and IAPWS-IF97 to ensure numerical correctness, thermodynamic validity, and regression stability. +This repository provides a **modular validation and regression test suite** +used to verify the numerical correctness, physical consistency, and long-term stability +of SAM core modules against trusted reference implementations. --- -## ✅ Purpose +## Purpose -This repository helps verify the physical and numerical accuracy of core SAM components, such as: +The validation framework supports verification of SAM components such as: -- `SAM_Mollier` (moist air / psychrometrics) -- `SAM_IAPWS` (pure water/steam thermodynamics) -- `SAM_SolarCalculator` (solar irradiance and weather input models) +- `SAM_Mollier` — moist air and psychrometric calculations +- `SAM_IAPWS` — pure water and steam thermodynamics +- `SAM_SolarCalculator` — solar and weather-related calculations + +Reference libraries include **PsychroLib** and **IAPWS-IF97**. --- -## 📁 Structure +## Repository structure ``` SAM_Validation/ @@ -45,39 +51,24 @@ SAM_Validation/ ├── CreateSolution.md # How to create and configure the solution ``` -Each toolkit directory contains: +Each module directory contains: - `Test/`: Unit and integration tests. - `validationfiles/`: Reference data used for validation. --- -## 📘 Getting Started - -➡️ See [RunInstructions.md](./RunInstructions.md) for first-time setup and test execution. -➡️ See [TestPlan.md](./TestPlan.md) for an overview of planned and implemented tests. -➡️ See [CreateSolution.md](./CreateSolution.md) for help creating a solution and linking references. - ---- - -## 🧪 Current Test Coverage - -### ✅ `SAM_Mollier/Test/HumidityRatioTests.cs` -Validates: -- `HumidityRatio.HumidityRatio(...)` against PsychroLib 2.5.0 -- Tolerance: ±0.0005 kg/kg +## Getting Started -More tests to come: -- Enthalpy -- Dew point -- Wet bulb +➡️ See [RunInstructions.md](./RunInstructions.md) — how to configure and execute tests +➡️ See [TestPlan.md](./TestPlan.md) — overview of test coverage and status +➡️ See [CreateSolution.md](./CreateSolution.md) — solution setup and project linking ---- ## 🔧 Run the Tests Locally Ensure you have: - [.NET SDK 7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) -- References to `SAM_Mollier` and optionally `SAM_Psychrometrics` +- Referenced SAM modules under test ```bash dotnet test @@ -89,37 +80,25 @@ dotnet test - 🔗 [PsychroLib 2.5.0](https://github.com/psychrometrics/psychrolib) - 🔗 [IAPWS-IF97 Steam Tables](https://www.iapws.org/relguide/IF97-Rev.pdf) -- 🔗 [SAM_Mollier](https://github.com/HoareLea/SAM_Mollier) - ---- - -## 🛠 Roadmap - -- [x] Validate humidity ratio (RH-based) -- [x] Validate enthalpy -- [ ] Validate dew point, wet bulb -- [ ] Add Region 1–5 tests for `SAM_IAPWS` -- [ ] Validate solar input with `SAM_SolarCalculator` -- [ ] Shared test utilities & loader helpers +- 🔗 [SAM_Mollier](https://github.com/SAM_BIM/SAM_Mollier) --- -## 👥 Maintainers - -- **Michal Dengusiak** – Lead architect and domain expert - ---- +## Development notes -## Resources -* [Wiki](https://github.com/HoareLea/SAM_Validation/wiki) +- Target framework: **.NET / C#** +- Coding style follows standard SAM-BIM conventions. +- New or modified `.cs` files must include the SPDX header from `COPYRIGHT_HEADER.txt` -## Installing +## Licence -To install **SAM** from .exe just download and run [latest installer](https://github.com/HoareLea/SAM_Deploy/releases) otherwise rebuild using VS [SAM](https://github.com/HoareLea/SAM) +This repository is free software licensed under the +**GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later)**. -## Licence ## +Each contributor retains copyright to their respective contributions. +The project history (Git) records authorship and provenance of all changes. -SAM is free software licenced under GNU Lesser General Public Licence - [https://www.gnu.org/licenses/lgpl-3.0.html](https://www.gnu.org/licenses/lgpl-3.0.html) -Each contributor holds copyright over their respective contributions. -The project versioning (Git) records all such contribution source information. -See [LICENSE](https://github.com/HoareLea/SAM_Template/blob/master/LICENSE) and [COPYRIGHT_HEADER](https://github.com/HoareLea/SAM/blob/master/COPYRIGHT_HEADER.txt). +See: +- `LICENSE` +- `NOTICE` +- `COPYRIGHT_HEADER.txt` \ No newline at end of file From 4b04f5a09384374a2d9790948126223f7c122544 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Fri, 9 Jan 2026 15:53:48 +0100 Subject: [PATCH 4/4] Update test.yml --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c6c5fa3..7e0db23 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,6 @@ name: Run SAM validation tests on: push: branches: [ main ] - pull_request: jobs: build: