Files
frameledger/tests/FrameLedger.Infrastructure.Tests/BuildLineTests.cs
T
poli0981andClaude Opus 5.5 648e9c28b1 build: the alpha line - RELEASE_LINE stamped into every assembly, release.yml's line-vs-tag rule and Velopack alpha channel, CI on the alpha branch, no wiki for an alpha (D73) (beta.32 PR-1) (#344)
The owner, 2026-10-31: an alpha build where new .NET versions are tried, .NET 11 RC3 / C# 15 first,
with an experimental-build warning (owner decisions D73-D76, asked while planning). This is the
plumbing on main; it changes nothing in a beta.

- RELEASE_LINE (main | alpha), read like VERSION by Directory.Build.props, stamped as the
  FrameLedger.ReleaseLine assembly metadata; any other value is a build error. Shared.BuildLine
  reads it back for composition (BuildLineTests, AssemblyIdentityTests).
- release.yml: the version gate reads RELEASE_LINE - the alpha line takes vX.Y.Z-alpha.N and
  nothing else, no other line may carry an -alpha. tag; an alpha's vpk download and pack take
  --channel alpha (feed releases.alpha.json, asset names from assets.<channel>.json); the main
  line's pack command is unchanged. An alpha's release is titled "(experimental alpha)".
- ci.yml: also on pushes to alpha; no sonarcloud job and no Changelog step for pull requests into
  alpha. wiki.yml: no publish after an -alpha. tag.
- tools/fps-impact-runbook.ps1: the Agent path no longer names a TFM.
- Docs: 12_BUILD §The alpha line, 13_CI_CD §The alpha line (+ ci/release/wiki sections, branch
  policy), 11_UPDATER §Channels corrected in place (the alpha line uses Velopack channels;
  GithubSource reads the newest ten releases, hence one alpha per beta), 20_OPEN_QUESTIONS §G
  "The main line's .NET" with its decision table written first, CLAUDE.md, CHANGELOG.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:58:38 +00:00

58 lines
2.1 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using System.Reflection;
using FluentAssertions;
using FrameLedger.Shared;
namespace FrameLedger.Infrastructure.Tests;
/// <summary>
/// D73: the release line is the <c>RELEASE_LINE</c> file, stamped into the assemblies by <c>Directory.Build.props</c> and
/// read back by <see cref="BuildLine"/>. On <c>main</c> the file says <c>main</c> and on the <c>alpha</c> branch
/// <c>alpha</c>, so these tests hold on both: what they pin is that the three agree, not which line this is.
/// </summary>
public sealed class BuildLineTests
{
private static string RepoRoot()
{
for (DirectoryInfo? dir = new(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
{
if (File.Exists(Path.Combine(dir.FullName, "FrameLedger.slnx")))
{
return dir.FullName;
}
}
throw new InvalidOperationException("the repository root (FrameLedger.slnx) is not above " + AppContext.BaseDirectory);
}
[Theory]
[InlineData("main", false)]
[InlineData("alpha", true)]
[InlineData(null, false)]
[InlineData("", false)]
[InlineData("Alpha", false)]
[InlineData("beta", false)]
public void OnlyTheExactWordAlphaIsTheAlphaLine(string? stamped, bool alpha)
{
BuildLine line = BuildLine.Parse(stamped);
line.IsAlpha.Should().Be(alpha);
line.Should().BeSameAs(alpha ? BuildLine.Alpha : BuildLine.Main);
}
[Fact]
public void TheBuildCarriesTheLineTheRepositoryNames()
{
string file = File.ReadAllText(Path.Combine(RepoRoot(), "RELEASE_LINE")).Trim();
string? stamped = typeof(BuildLine).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.FirstOrDefault(static a => string.Equals(a.Key, BuildLine.MetadataKey, StringComparison.Ordinal))?.Value;
file.Should().BeOneOf("main", "alpha");
stamped.Should().Be(file, "Directory.Build.props stamps RELEASE_LINE into every assembly");
BuildLine.Current.Name.Should().Be(file);
}
}