refactor!: rename Titano to Chronos and move CI and releases to Gitea
CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow) and pe-check. BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c99842cc86
commit
5f27a86406
1799 files changed
+11728
-10668
No files matched your search
@@ -0,0 +1,74 @@
|
||||
using Chronos.Core.IO;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Foundation;
|
||||
|
||||
public sealed class AtomicFileTests(TestContext context)
|
||||
{
|
||||
[Test]
|
||||
public void ReplacesContentAndLeavesNoTemporaryFiles()
|
||||
{
|
||||
var dir = context.CreateTempDirectory();
|
||||
var path = Path.Combine(dir, "sequence.json");
|
||||
AtomicFile.WriteAllText(path, "one");
|
||||
AtomicFile.WriteAllText(path, "two");
|
||||
Assert.Equal("two", File.ReadAllText(path));
|
||||
Assert.Count(1, Directory.GetFiles(dir));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[WindowsOnly]
|
||||
public void AReadOnlyTargetFailsAtOnceAndTheTemporaryFileGoes()
|
||||
{
|
||||
// Only a handle that holds the target clears by itself (owner review 1); a read-only file never does, so the write
|
||||
// must not keep the caller waiting (a settings field on the UI thread, a pass over hundreds of sidecars).
|
||||
var dir = context.CreateTempDirectory();
|
||||
var path = Path.Combine(dir, "settings.json");
|
||||
AtomicFile.WriteAllText(path, "stable");
|
||||
File.SetAttributes(path, FileAttributes.ReadOnly);
|
||||
try
|
||||
{
|
||||
var clock = System.Diagnostics.Stopwatch.StartNew();
|
||||
Assert.Throws<UnauthorizedAccessException>(() => AtomicFile.WriteAllText(path, "new"));
|
||||
Assert.Less(clock.Elapsed.TotalMilliseconds, 500, "no retries");
|
||||
Assert.Equal("stable", File.ReadAllText(path));
|
||||
Assert.Count(1, Directory.GetFiles(dir));
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.SetAttributes(path, FileAttributes.Normal);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReadsAreWholeAndShareTheFileWithOtherReaders()
|
||||
{
|
||||
var dir = context.CreateTempDirectory();
|
||||
var path = Path.Combine(dir, "project.json");
|
||||
File.WriteAllText(path, "é");
|
||||
using (new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete))
|
||||
{
|
||||
// A byte order mark is read as File.ReadAllText reads it.
|
||||
Assert.Equal("é", AtomicFile.ReadAllText(path));
|
||||
Assert.SequenceEqual(File.ReadAllBytes(path), AtomicFile.ReadAllBytes(path));
|
||||
}
|
||||
File.WriteAllText(path, string.Empty);
|
||||
Assert.Equal(string.Empty, AtomicFile.ReadAllText(path));
|
||||
Assert.Empty(AtomicFile.ReadAllBytes(path));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task FailedWriteKeepsPreviousContent()
|
||||
{
|
||||
var dir = context.CreateTempDirectory();
|
||||
var path = Path.Combine(dir, "project.json");
|
||||
AtomicFile.WriteAllText(path, "stable");
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(() => AtomicFile.WriteAsync(path, async (s, ct) =>
|
||||
{
|
||||
await s.WriteAsync("partial"u8.ToArray(), ct);
|
||||
throw new InvalidOperationException("boom");
|
||||
}));
|
||||
Assert.Equal("stable", File.ReadAllText(path));
|
||||
Assert.Count(1, Directory.GetFiles(dir));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Foundation;
|
||||
|
||||
public sealed class ColorSpaceTests
|
||||
{
|
||||
[Test]
|
||||
public void EightBitRoundTripIsExact()
|
||||
{
|
||||
for (var i = 0; i < 256; i++) Assert.Equal((byte)i, ColorSpace.Encode8(ColorSpace.Linear8((byte)i)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SixteenBitRoundTripWithinOneCode()
|
||||
{
|
||||
for (var i = 0; i < 65536; i += 7)
|
||||
{
|
||||
var back = ColorSpace.Encode16(ColorSpace.Linear16((ushort)i));
|
||||
Assert.InRange(back, i - 1, i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FastEncodeMatchesExact()
|
||||
{
|
||||
for (var i = 1; i <= 10000; i++)
|
||||
{
|
||||
var v = i / 10000f;
|
||||
Assert.Approximately(ColorSpace.LinearToSrgb(v), ColorSpace.EncodeFast(v), 2e-5);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MiddleGreyIsAbout118() => Assert.InRange(ColorSpace.Encode8(0.18f), 117, 119);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Text;
|
||||
using Chronos.Core.Hashing;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Foundation;
|
||||
|
||||
public sealed class Crc32Tests
|
||||
{
|
||||
[Test]
|
||||
public void CheckValueMatchesStandard() => Assert.Equal(0xCBF43926u, Crc32.Compute("123456789"u8));
|
||||
|
||||
[Test]
|
||||
public void IncrementalEqualsOneShot()
|
||||
{
|
||||
var data = Encoding.ASCII.GetBytes(new string('x', 1000) + "chronos");
|
||||
var crc = new Crc32();
|
||||
crc.Append(data.AsSpan(0, 7));
|
||||
crc.Append(data.AsSpan(7, 500));
|
||||
crc.Append(data.AsSpan(507));
|
||||
Assert.Equal(Crc32.Compute(data), crc.GetCurrentHashAsUInt32());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyInputIsZero() => Assert.Equal(0u, Crc32.Compute([]));
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Chronos.Core.IO;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Foundation;
|
||||
|
||||
/// <summary>BRIEF §6.2: where the client keeps its index, and never inside a folder OneDrive synchronises.</summary>
|
||||
public sealed class DataLocationTests(TestContext context)
|
||||
{
|
||||
[Test]
|
||||
public void AnInstalledCopyUsesThePerUserFolderAndAPortableOneItsOwn()
|
||||
{
|
||||
var app = context.CreateTempDirectory("app");
|
||||
var local = context.CreateTempDirectory("local");
|
||||
|
||||
var installed = DataLocation.Choose(app, portable: false, local, []);
|
||||
Assert.Equal(new DataLocation(Path.Combine(local, "Chronos"), false, null, null), installed);
|
||||
|
||||
var portable = DataLocation.Choose(app, portable: true, local, []);
|
||||
Assert.Equal(new DataLocation(Path.Combine(app, "data"), true, null, null), portable);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void APortableCopyInASynchronisedFolderKeepsItsDataInThePerUserFolder()
|
||||
{
|
||||
// A portable copy unpacked on a Desktop that OneDrive's folder backup moved into the sync root.
|
||||
var oneDrive = context.CreateTempDirectory("onedrive");
|
||||
var app = Path.Combine(oneDrive, "Desktop", "Chronos");
|
||||
var local = context.CreateTempDirectory("local");
|
||||
|
||||
var location = DataLocation.Choose(app, portable: true, local, [Path.Combine(context.CreateTempDirectory("other"), "OneDrive"), oneDrive]);
|
||||
|
||||
Assert.Equal(Path.Combine(local, "Chronos"), location.Root);
|
||||
Assert.True(location.IsPortable, "still a portable copy (updates, no sign-in entry)");
|
||||
Assert.Equal<string?>(oneDrive, location.PortableSyncRoot);
|
||||
Assert.Null(location.SyncedFolder);
|
||||
|
||||
// A sync root that only shares the start of the name is another folder.
|
||||
var beside = DataLocation.Choose(oneDrive + "Backup", portable: true, local, [oneDrive]);
|
||||
Assert.Equal(new DataLocation(Path.Combine(oneDrive + "Backup", "data"), true, null, null), beside);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void APerUserFolderInsideASyncRootIsReported()
|
||||
{
|
||||
var oneDrive = context.CreateTempDirectory("onedrive");
|
||||
var local = Path.Combine(oneDrive, "AppData", "Local");
|
||||
|
||||
var installed = DataLocation.Choose(context.CreateTempDirectory("app"), portable: false, local, [oneDrive]);
|
||||
Assert.Equal<string?>(oneDrive, installed.SyncedFolder);
|
||||
|
||||
var portable = DataLocation.Choose(Path.Combine(oneDrive, "Chronos"), portable: true, local, [oneDrive]);
|
||||
Assert.Equal<(string, string?, string?)>((Path.Combine(local, "Chronos"), oneDrive, oneDrive), (portable.Root, portable.SyncedFolder, portable.PortableSyncRoot));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SyncRootMatchingIsSegmentWiseAndIgnoresCase()
|
||||
{
|
||||
var root = Path.Combine(context.CreateTempDirectory(), "OneDrive");
|
||||
Assert.True(DataLocation.IsUnder(root, root));
|
||||
Assert.True(DataLocation.IsUnder(Path.Combine(root, "Pictures"), root + Path.DirectorySeparatorChar));
|
||||
Assert.True(DataLocation.IsUnder(Path.Combine(root, "x").ToUpperInvariant(), root));
|
||||
Assert.True(DataLocation.IsUnder(@"C:\Users\ada\OneDrive\Desktop\Chronos\data", @"c:\users\ada\onedrive"), "Windows paths on any platform");
|
||||
Assert.False(DataLocation.IsUnder(root + "Backup", root));
|
||||
Assert.False(DataLocation.IsUnder(root, string.Empty));
|
||||
Assert.Null(DataLocation.SyncRootOf(root + "Backup", [root]));
|
||||
Assert.Equal<string?>(root, DataLocation.SyncRootOf(Path.Combine(root, "Documents"), ["", root]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Foundation;
|
||||
|
||||
public sealed class ImageBufferTests
|
||||
{
|
||||
[Test]
|
||||
public void PlanesAreIndependentAndClearedByDefault()
|
||||
{
|
||||
using var image = new ImageBuffer(4, 3);
|
||||
Assert.Equal(12, image.PlaneLength);
|
||||
Assert.True(image.Data.ToArray().All(v => v == 0));
|
||||
image[1, 2, 1] = 0.5f;
|
||||
Assert.Equal(0.5f, image.Plane(1)[1 * 4 + 2]);
|
||||
Assert.Equal(0f, image.Plane(0)[1 * 4 + 2]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CloneCopiesPixels()
|
||||
{
|
||||
using var image = new ImageBuffer(2, 2, 1);
|
||||
image[0, 1, 1] = 3f;
|
||||
using var clone = image.Clone();
|
||||
image[0, 1, 1] = 0f;
|
||||
Assert.Equal(3f, clone[0, 1, 1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DisposedBufferThrows()
|
||||
{
|
||||
var image = new ImageBuffer(1, 1);
|
||||
image.Dispose();
|
||||
Assert.Throws<ObjectDisposedException>(() => _ = image.Storage);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Case("IMG_0001.CR2", ImageFileFormat.Cr2)]
|
||||
[Case("a.jpeg", ImageFileFormat.Jpeg)]
|
||||
[Case("photo.HEIC", ImageFileFormat.Heif)]
|
||||
[Case("notes.txt", ImageFileFormat.Unknown)]
|
||||
public void FormatFromExtension(string name, ImageFileFormat expected) =>
|
||||
Assert.Equal(expected, ImageFormatInfo.FromPath(name).Format);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Chronos.Core.IO;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Foundation;
|
||||
|
||||
/// <summary>The switch Task Manager's Startup tab keeps apart from a sign-in entry's command.</summary>
|
||||
public sealed class StartupApprovalTests
|
||||
{
|
||||
[Test]
|
||||
public void AnOddFirstByteMeansTurnedOff()
|
||||
{
|
||||
// As Task Manager writes them: a state, three zero bytes, then the time it was turned off.
|
||||
Assert.True(StartupApproval.IsTurnedOff([0x03, 0, 0, 0, 0x60, 0x1B, 0x3C, 0x92, 0x8A, 0x3F, 0xDB, 0x01]));
|
||||
Assert.True(StartupApproval.IsTurnedOff([0x01, 0, 0, 0]));
|
||||
Assert.False(StartupApproval.IsTurnedOff([0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
|
||||
Assert.False(StartupApproval.IsTurnedOff([0x06, 0, 0, 0]));
|
||||
// Never touched in Task Manager, or a value of another type: the entry is on.
|
||||
Assert.False(StartupApproval.IsTurnedOff(null));
|
||||
Assert.False(StartupApproval.IsTurnedOff([]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Chronos.Core.IO;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Foundation;
|
||||
|
||||
/// <summary>The sign-in entries of the client and the Uploader: which copy they start, and how setup moves them to a renamed program.</summary>
|
||||
public sealed class StartupCommandTests
|
||||
{
|
||||
private const string Installed = @"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.exe";
|
||||
|
||||
[Test]
|
||||
public void TheCommandNamesItsProgram()
|
||||
{
|
||||
var command = StartupCommand.Format(Installed, "--minimized");
|
||||
Assert.Equal("\"" + Installed + "\" --minimized", command);
|
||||
Assert.Equal(Installed, StartupCommand.Executable(command));
|
||||
Assert.Equal(@"C:\Users\ada\AppData\Local\Programs\Chronos", StartupCommand.Folder(command));
|
||||
// Written by hand or by an older tool: unquoted, or with spaces around.
|
||||
Assert.Equal(@"D:\Chronos\Chronos.exe", StartupCommand.Executable(@" D:\Chronos\Chronos.exe --minimized "));
|
||||
Assert.Equal(@"D:\Chronos\Chronos.exe", StartupCommand.Executable(@"D:\Chronos\Chronos.exe"));
|
||||
Assert.Null(StartupCommand.Executable(null));
|
||||
Assert.Null(StartupCommand.Executable(" "));
|
||||
Assert.Null(StartupCommand.Executable("\"unterminated --minimized"));
|
||||
Assert.Null(StartupCommand.Executable("\"\" --minimized"));
|
||||
Assert.Null(StartupCommand.Folder("Chronos.exe"));
|
||||
Assert.Equal(@"D:\Chronos", StartupCommand.FolderOf(@"D:\Chronos\Chronos.exe"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnEntryBelongsToTheCopyItStarts()
|
||||
{
|
||||
var command = StartupCommand.Format(Installed, "--minimized");
|
||||
Assert.True(StartupCommand.Starts(command, Installed));
|
||||
Assert.True(StartupCommand.Starts(command, Installed.ToUpperInvariant()), "Windows paths ignore case");
|
||||
// A portable copy on a USB stick, a second install or a development build is another program.
|
||||
Assert.False(StartupCommand.Starts(command, @"E:\Chronos\Chronos.exe"));
|
||||
Assert.False(StartupCommand.Starts(command, @"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.exe.old"));
|
||||
Assert.False(StartupCommand.Starts(command, null));
|
||||
Assert.False(StartupCommand.Starts(null, Installed));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetupMovesAnEntryToTheRenamedProgramWithItsOption()
|
||||
{
|
||||
// Setup matches an entry by the program it starts (one its install log lists, never any program under the
|
||||
// folder) and, when an update renamed that program, points the entry at the new one.
|
||||
const string renamed = @"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.old.exe";
|
||||
var moved = StartupCommand.Retarget(StartupCommand.Format(renamed, "--minimized"), Installed);
|
||||
Assert.Equal(StartupCommand.Format(Installed, "--minimized"), moved);
|
||||
Assert.True(StartupCommand.Starts(moved, Installed));
|
||||
// Written by hand or by an older tool: unquoted, without an option, or with more than one.
|
||||
Assert.Equal(StartupCommand.Format(Installed, "--tray"), StartupCommand.Retarget(@" D:\Chronos\Chronos.Uploader.exe --tray ", Installed));
|
||||
Assert.Equal("\"" + Installed + "\"", StartupCommand.Retarget(@"D:\Chronos\Chronos.exe", Installed));
|
||||
Assert.Equal("\"" + Installed + "\"", StartupCommand.Retarget("\"" + renamed + "\"", Installed));
|
||||
Assert.Equal(StartupCommand.Format(Installed, "--minimized --verbose"), StartupCommand.Retarget("\"" + renamed + "\" --minimized --verbose", Installed));
|
||||
// Nothing to move.
|
||||
Assert.Null(StartupCommand.Retarget(null, Installed));
|
||||
Assert.Null(StartupCommand.Retarget(" ", Installed));
|
||||
Assert.Null(StartupCommand.Retarget("\"unterminated --minimized", Installed));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user