refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
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 and the system SQLite. 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; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). 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> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
1 parent
c99842cc86
commit
f2b58522b9
1801 files changed
+11804
-10676
No files matched your search
@@ -0,0 +1,136 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace Chronos.Core.Diagnostics;
|
||||
|
||||
public enum LogLevel
|
||||
{
|
||||
Trace,
|
||||
Debug,
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
}
|
||||
|
||||
/// <summary>Destination for engine log events (file logger on desktop, ILogger bridge on the server).</summary>
|
||||
public interface ILogSink
|
||||
{
|
||||
void Write(LogLevel level, string category, string message, Exception? exception);
|
||||
}
|
||||
|
||||
/// <summary>Tiny engine-wide logger. Core code logs through it; hosts plug in a sink.</summary>
|
||||
public static class Log
|
||||
{
|
||||
private static ILogSink _sink = new ConsoleSink();
|
||||
|
||||
public static LogLevel MinimumLevel { get; set; } = LogLevel.Info;
|
||||
|
||||
public static void SetSink(ILogSink sink) => _sink = sink ?? throw new ArgumentNullException(nameof(sink));
|
||||
|
||||
public static void Debug(string category, string message) => Write(LogLevel.Debug, category, message, null);
|
||||
public static void Info(string category, string message) => Write(LogLevel.Info, category, message, null);
|
||||
public static void Warning(string category, string message, Exception? ex = null) => Write(LogLevel.Warning, category, message, ex);
|
||||
public static void Error(string category, string message, Exception? ex = null) => Write(LogLevel.Error, category, message, ex);
|
||||
|
||||
public static void Write(LogLevel level, string category, string message, Exception? exception)
|
||||
{
|
||||
if (level < MinimumLevel) return;
|
||||
try
|
||||
{
|
||||
_sink.Write(level, category, message, exception);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Logging must never take the process down.
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class ConsoleSink : ILogSink
|
||||
{
|
||||
public void Write(LogLevel level, string category, string message, Exception? exception)
|
||||
{
|
||||
var line = string.Create(CultureInfo.InvariantCulture, $"{DateTime.UtcNow:O} {level,-7} {category}: {message}");
|
||||
if (exception is not null) line += Environment.NewLine + exception;
|
||||
Console.Error.WriteLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Appends log lines to rotating files (one per day, kept for <c>retainDays</c>).</summary>
|
||||
public sealed class FileLogSink : ILogSink, IDisposable
|
||||
{
|
||||
private readonly string _directory;
|
||||
private readonly string _prefix;
|
||||
private readonly int _retainDays;
|
||||
private readonly Lock _gate = new();
|
||||
private StreamWriter? _writer;
|
||||
private DateOnly _day;
|
||||
|
||||
public FileLogSink(string directory, string prefix, int retainDays = 14)
|
||||
{
|
||||
_directory = directory;
|
||||
_prefix = prefix;
|
||||
_retainDays = retainDays;
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
public string CurrentPath => Path.Combine(_directory, $"{_prefix}-{_day:yyyyMMdd}.log");
|
||||
|
||||
public void Write(LogLevel level, string category, string message, Exception? exception)
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
var today = DateOnly.FromDateTime(DateTime.UtcNow);
|
||||
if (_writer is null || today != _day)
|
||||
{
|
||||
_writer?.Dispose();
|
||||
_day = today;
|
||||
_writer = new StreamWriter(new FileStream(CurrentPath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite)) { AutoFlush = true };
|
||||
Prune();
|
||||
}
|
||||
_writer.WriteLine(string.Create(CultureInfo.InvariantCulture, $"{DateTime.UtcNow:O} {level,-7} {category}: {message}"));
|
||||
if (exception is not null) _writer.WriteLine(exception.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void Prune()
|
||||
{
|
||||
foreach (var file in Directory.EnumerateFiles(_directory, _prefix + "-*.log"))
|
||||
{
|
||||
if (File.GetLastWriteTimeUtc(file) < DateTime.UtcNow.AddDays(-_retainDays))
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
lock (_gate) _writer?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes every event to several sinks.</summary>
|
||||
public sealed class TeeLogSink(params ILogSink[] sinks) : ILogSink
|
||||
{
|
||||
public void Write(LogLevel level, string category, string message, Exception? exception)
|
||||
{
|
||||
foreach (var sink in sinks) sink.Write(level, category, message, exception);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes events to standard error (CI and command-line diagnostics).</summary>
|
||||
public sealed class StderrLogSink : ILogSink
|
||||
{
|
||||
public void Write(LogLevel level, string category, string message, Exception? exception)
|
||||
{
|
||||
var line = string.Create(CultureInfo.InvariantCulture, $"{DateTime.UtcNow:O} {level,-7} {category}: {message}");
|
||||
if (exception is not null) line += Environment.NewLine + exception;
|
||||
Console.Error.WriteLine(line);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user