From ebce78e1c7e1ef479599577d503f6ef41e8517df Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Fri, 15 May 2026 16:25:48 +0200 Subject: [PATCH 1/4] Replace Newtonsoft.Json with System.Text.Json (10.0.8) SAM-BIM core migrated from Newtonsoft.Json to System.Text.Json.Nodes. SAM.Core's public surface now exposes JsonObject; replace each csproj's Newtonsoft package reference with System.Text.Json 10.0.8 so downstream consumers can resolve the type at compile time. Co-Authored-By: Claude Opus 4.7 --- .../SAM.Core.Grasshopper.SQL/SAM.Core.Grasshopper.SQL.csproj | 4 +--- SAM_SQL/SAM.Core.SQL/SAM.Core.SQL.csproj | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Grasshopper/SAM.Core.Grasshopper.SQL/SAM.Core.Grasshopper.SQL.csproj b/Grasshopper/SAM.Core.Grasshopper.SQL/SAM.Core.Grasshopper.SQL.csproj index 096cb33..83a2ad0 100644 --- a/Grasshopper/SAM.Core.Grasshopper.SQL/SAM.Core.Grasshopper.SQL.csproj +++ b/Grasshopper/SAM.Core.Grasshopper.SQL/SAM.Core.Grasshopper.SQL.csproj @@ -60,9 +60,7 @@ runtime - - 13.0.3 - + diff --git a/SAM_SQL/SAM.Core.SQL/SAM.Core.SQL.csproj b/SAM_SQL/SAM.Core.SQL/SAM.Core.SQL.csproj index 598e51e..9d392d3 100644 --- a/SAM_SQL/SAM.Core.SQL/SAM.Core.SQL.csproj +++ b/SAM_SQL/SAM.Core.SQL/SAM.Core.SQL.csproj @@ -36,7 +36,7 @@ - + From 1399e7b7ca7b9eb5ae5b8002bb013565537ae5dd Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Fri, 15 May 2026 22:01:19 +0200 Subject: [PATCH 2/4] CI: prefer sow/2026-Q2 for dep clones + trigger on it During the SAM-BIM Newtonsoft.Json -> System.Text.Json migration the quarterly sow/2026-Q2 branch carries the binary-breaking change. CI needs to consume the migrated SAM (and any sibling dep) from sow/2026-Q2, not from master, until the quarter-end merge. - Add "sow/2026-Q2" to push/pull_request branch triggers - For each dep clone, ls-remote sow/2026-Q2 and prefer it when present; fall back to default branch (e.g. master) otherwise. After the quarter merges back to master, this fallback naturally restores prior behaviour. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/build.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cebc2d1..68104a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build (Windows) on: push: - branches: [ "master", "main" ] + branches: [ "master", "main", "sow/2026-Q2" ] pull_request: - branches: [ "master", "main" ] + branches: [ "master", "main", "sow/2026-Q2" ] workflow_dispatch: jobs: @@ -55,8 +55,15 @@ jobs: $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 + $preferredBranch = 'sow/2026-Q2' + $hasPreferred = (git ls-remote --heads "https://github.com/$org/$r.git" $preferredBranch 2>$null | Out-String).Trim() + if ($hasPreferred) { + Write-Host "Cloning $org/$r @ $preferredBranch" + git clone --depth 1 --branch $preferredBranch "https://github.com/$org/$r.git" $r + } else { + Write-Host "Cloning $org/$r @ default branch" + git clone --depth 1 "https://github.com/$org/$r.git" $r + } } # Ensure ReferencePath exists even before SAM_Windows builds From 5b2e70e9987c301def25c9699914db257f3f49aa Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Fri, 15 May 2026 22:05:58 +0200 Subject: [PATCH 3/4] CI: cascade dep clones to PR head_ref -> sow/2026-Q2 -> default Refines the previous workflow patch so CI on the migration PR can succeed before anything has been merged. Each dep repo is cloned from: 1. github.head_ref (feature/remove-newtonsoft on these PRs) - has the migration right now on every dep 2. sow/2026-Q2 - source of truth after these PRs merge 3. default branch - source of truth after quarter-end merge Co-Authored-By: Claude Opus 4.7 --- .github/workflows/build.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68104a2..6837d87 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,17 +55,27 @@ jobs: $deps = $buildOrder[0..($buildOrder.Count-2)] foreach ($r in $deps) { if (Test-Path $r) { continue } - $preferredBranch = 'sow/2026-Q2' - $hasPreferred = (git ls-remote --heads "https://github.com/$org/$r.git" $preferredBranch 2>$null | Out-String).Trim() - if ($hasPreferred) { - Write-Host "Cloning $org/$r @ $preferredBranch" - git clone --depth 1 --branch $preferredBranch "https://github.com/$org/$r.git" $r - } else { + $headRef = '${{ github.head_ref }}' + $candidates = @() + if ($headRef) { $candidates += $headRef } + $candidates += 'sow/2026-Q2' + $cloned = $false + foreach ($cand in $candidates) { + $has = (git ls-remote --heads "https://github.com/$org/$r.git" $cand 2>$null | Out-String).Trim() + if ($has) { + Write-Host "Cloning $org/$r @ $cand" + git clone --depth 1 --branch $cand "https://github.com/$org/$r.git" $r + $cloned = $true + break + } + } + if (-not $cloned) { Write-Host "Cloning $org/$r @ default branch" 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 From e17ba8d9a2e8c05c563c39a0dbb811379dcf21d4 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Fri, 15 May 2026 22:51:45 +0200 Subject: [PATCH 4/4] CI: harmonize spdx-check.yml with org-canonical Version A template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the older spdx-check.yml (literal en-dash grep, top 6 lines, PR-only trigger) with the modern template shipped on SAM core: - grep -qE with [-–] char class — accepts both hyphen-minus and en-dash - 20-line lookback (was 6) - BOM and CR stripping - mapfile + diff-filter for cleaner change detection - Adds workflow_dispatch trigger Co-Authored-By: Claude Opus 4.7 --- .github/workflows/spdx-check.yml | 81 +++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index 269d562..e386bd3 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -2,44 +2,89 @@ name: SPDX + Copyright header check on: pull_request: + workflow_dispatch: jobs: spdx: runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v5 with: fetch-depth: 0 - name: Check header in changed .cs files + shell: bash run: | - set -e - BASE="${{ github.event.pull_request.base.sha }}" - HEAD="${{ github.event.pull_request.head.sha }}" + set -euo pipefail + + if [ "${{ github.event_name }}" = "pull_request" ]; then + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" + else + HEAD="${{ github.sha }}" + BASE="$(git rev-parse "${HEAD}^" 2>/dev/null || true)" + fi - FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) + echo "Base SHA: ${BASE:-}" + echo "Head SHA: $HEAD" + echo - if [ -z "$FILES" ]; then + if [ -z "${BASE:-}" ]; then + mapfile -t files < <(git ls-files '*.cs') + else + mapfile -t files < <(git diff --diff-filter=ACMR --name-only "$BASE" "$HEAD" -- '*.cs' || true) + fi + + if [ "${#files[@]}" -eq 0 ]; then echo "No C# files changed." exit 0 fi - MISSING="" - for f in $FILES; do - HEADBLOCK=$(head -n 6 "$f") + echo "Changed C# files:" + printf ' - %s\n' "${files[@]}" + echo + + missing=() + + for f in "${files[@]}"; do + if [ ! -f "$f" ]; then + echo "Skipping missing file: $f" + continue + fi + + headblock="$(head -n 20 "$f" | sed '1s/^\xEF\xBB\xBF//' | tr -d '\r')" + + echo "Checking: $f" + + if ! grep -q "SPDX-License-Identifier: LGPL-3.0-or-later" <<< "$headblock"; then + echo " Missing SPDX line" + missing+=("$f") + continue + fi + + if ! grep -qE "Copyright \(c\) 2020[-–]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" <<< "$headblock"; then + echo " Missing copyright line" + missing+=("$f") + continue + fi - 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" + echo " OK" 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 + if [ "${#missing[@]}" -gt 0 ]; then + echo "Missing required header in:" + printf ' - %s\n' "${missing[@]}" + echo + echo "Each checked .cs file must contain within the first 20 lines:" echo "// SPDX-License-Identifier: LGPL-3.0-or-later" - echo "// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors" + echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" exit 1 fi - echo "✅ SPDX + copyright headers OK." + echo "SPDX + copyright headers OK." \ No newline at end of file