From 933cf213ba925f53c9f3bf34b5eb1637d49c6f28 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Fri, 9 Jan 2026 13:51:54 +0100 Subject: [PATCH] Repository hygiene updates --- .github/CODEOWNERS | 33 ++------- .github/PULL_REQUEST_TEMPLATE.md | 22 ++---- .github/workflows/build.yml | 116 +++++++++++++++++++++++++++++++ .github/workflows/spdx-check.yml | 45 ++++++++++++ README.md | 66 +++++++++++++++--- 5 files changed, 227 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/spdx-check.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f3ba832..27c85b0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,31 +1,10 @@ -# Lines starting with '#' are comments. -# Each line is a file pattern followed by one or more owners. +# CODEOWNERS +# SAM-BIM – repository ownership definition # https://github.blog/2017-07-06-introducing-code-owners/ -# SAM REPO CODEOWNERS - -# default global -# These owners will be the default owners for everything in the repo - +# Default owners for the entire repository * @michaldengusiak @ZiolkowskiJakub - -# project owners -# Order is important. The last matching pattern has the most precedence. -# So if a pull request only touches javascript files, only these owners -# will be requested to review. - -/SAM @michaldengusiak @ZiolkowskiJakub -/SAM_BHoM @michaldengusiak @ZiolkowskiJakub -/SAM_Excel @michaldengusiak @ZiolkowskiJakub -/SAM_LadybugTools @michaldengusiak @ZiolkowskiJakub -/SAM_Revit @michaldengusiak @ZiolkowskiJakub -/SAM_Tas @michaldengusiak @ZiolkowskiJakub -/SAM_Topologic @michaldengusiak @ZiolkowskiJakub -/SAM_UI @michaldengusiak @ZiolkowskiJakub -/SAM_gbXML @michaldengusiak @ZiolkowskiJakub -/SAM_GEM @michaldengusiak @ZiolkowskiJakub -/SAM_Template @michaldengusiak @ZiolkowskiJakub - - -# You can also use email addresses if you prefer. \ No newline at end of file +# Governance & workflow files (always require both owners) + /CODEOWNERS @michaldengusiak @ZiolkowskiJakub + /.github/ @michaldengusiak @ZiolkowskiJakub \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 597e853..d4a4c35 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,19 +1,5 @@ -### NOTE: Depends on - - +### Summary +What is delivered and why (1–3 sentences). - -### Issues addressed by this PR - - -Fixes # - - - - -### Test files - - - -### Additional comments - \ No newline at end of file +### Validation +How to verify or test the change. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..cebc2d1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,116 @@ +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_SQL" + + 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' + $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' + $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..269d562 --- /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–2026 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 782324e..697d0f4 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,65 @@ -# SAM_SQLite +[![Build (Windows)](https://github.com/SAM-BIM/SAM_SQL/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM/SAM_SQL/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_SQL -**SAM** is part of SAM Toolkit that is designed to help engneers to create Analytical Model. Welcome and let's make the opensource journey continue. :handshake: + + + + +**SAM_SQL** 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. + +This repository provides **database-agnostic SQL persistence, querying, and data-access utilities** +and is intended to be used alongside the SAM core libraries and related SAM-BIM modules. + +Welcome — and let’s keep the open-source journey going. 🤝 + +--- ## Resources -* [Wiki](https://github.com/HoareLea/SAM/wiki) +- 📘 **SAM Wiki:** https://github.com/SAM-BIM/SAM/wiki +- 🧠 **SAM Core:** https://github.com/SAM-BIM/SAM +- 🧰 **Installers:** https://github.com/SAM-BIM/SAM_Deploy + +--- ## Installing -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) +To install **SAM** using the Windows installer, download and run the +[latest installer](https://github.com/SAM-BIM/SAM_Deploy/releases/latest). + +Alternatively, you can build the toolkit from source using Visual Studio. +See the main repository for details: +👉 https://github.com/SAM-BIM/SAM + +--- + +## Development notes + +- Target framework: **.NET / C#** +- Coding style follows standard SAM-BIM conventions. +- New or modified `.cs` files must include the SPDX header: + +```csharp +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors +``` + + +## Licence + +This repository is free software licensed under the +**GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later)**. + +Each contributor retains copyright to their respective contributions. +The project history (Git) records authorship and provenance of all changes. + +See: +- `LICENSE` +- `NOTICE` +- `COPYRIGHT_HEADER.txt` -## Licence ## -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).