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

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:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-10-23 12:45:18 +02:00
1 parent c99842cc86
commit f2b58522b9
1801 files changed
+11804 -10676

No files matched your search

+229
View File
@@ -0,0 +1,229 @@
using System.Windows;
using System.Windows.Threading;
using Chronos.App.DesignTime;
using Chronos.App.Editor;
using Chronos.App.Infrastructure;
using Chronos.App.Shell;
using Chronos.Core.Diagnostics;
using Chronos.Ui.Mvvm;
using Chronos.Ui.Theming;
namespace Chronos.App;
/// <summary>
/// Chronos desktop client. Local mode starts here: settings and language before the first window, then the window,
/// then the index and the job engine (<see cref="AppServices"/>) off the UI thread. <c>--capture &lt;dir&gt;</c>
/// renders every screen with synthetic data in a throw-away data folder and exits. A file argument is a
/// <c>.chronos</c> project file (Explorer passes it on a double-click) opened once the index is open. One Chronos runs
/// per data folder: a second launch hands its file to the running one and exits, or, when the running one is closing,
/// waits for it to exit and starts with the file (<see cref="SingleInstance"/>).
/// </summary>
public partial class App : Application
{
/// <summary>How long a launch waits for a Chronos that is closing (it gives its services up to 10 s to stop).</summary>
private static readonly TimeSpan ClosingWait = TimeSpan.FromSeconds(30);
private readonly TaskCompletionSource _started = new(TaskCreationOptions.RunContinuationsAsynchronously);
private FileLogSink? _log;
private SingleInstance? _instance;
private bool _windowClosed;
public AppEnvironment Environment { get; private set; } = null!;
public AppSettings Settings { get; private set; } = null!;
public AppServices Services { get; private set; } = null!;
public static new App Current => (App)Application.Current;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var captureIndex = Array.IndexOf(e.Args, "--capture");
var capture = captureIndex >= 0;
// Capture never reads or writes the user's data folder.
Environment = capture ? AppEnvironment.ForCapture() : AppEnvironment.Detect();
_log = new FileLogSink(Environment.LogDirectory, "chronos");
// Capture runs in CI: mirror the log to stderr so failures are visible in the job output.
Log.SetSink(capture ? new TeeLogSink(_log, new StderrLogSink()) : _log);
Log.Info("app", $"Chronos {AppServices.VersionText} starting; data at {Environment.DataDirectory}");
// Settings tells the user once the window is up.
if (Environment.PortableSyncRoot is { } portableIn) Log.Warning("app", $"This portable copy runs in the OneDrive folder {portableIn}: its data is kept outside it");
if (Environment.EarlierPortableData is { } earlier) Log.Warning("app", $"The data this portable copy kept in {earlier} before is left there and no longer used");
if (Environment.SyncedFolder is { } synced) Log.Warning("app", $"The data folder lies in the OneDrive folder {synced}: synchronisation may damage the index");
var projectFile = capture ? null : ProjectFileArgument(e.Args);
if (!capture)
{
_instance = SingleInstance.TryAcquire(Environment.DataDirectory);
if (_instance is null)
{
if (SingleInstance.HandOver(Environment.DataDirectory, projectFile is null ? [] : [projectFile]))
{
Log.Info("app", "Chronos already runs on this data folder; arguments handed over");
Shutdown();
return;
}
// No answer: the running Chronos is closing (it stops listening first). Start once it has exited.
_instance = SingleInstance.WaitForTurn(Environment.DataDirectory, ClosingWait);
if (_instance is null)
{
Log.Info("app", "Chronos already runs on this data folder and did not answer");
Shutdown();
return;
}
Log.Info("app", "The previous Chronos on this data folder has exited");
}
// From now on: a launch while the window and the index open is kept until the shell can take it.
_instance.Listen();
}
Settings = capture ? new AppSettings { Language = "en" } : AppSettings.Load(Environment.SettingsPath);
UiLanguage.Apply(Settings.Language);
ThemeManager.Initialize(this, capture ? AppTheme.Dark : Settings.Theme);
AppResources.Merge(this);
DispatcherUnhandledException += OnUnhandledException;
AppDomain.CurrentDomain.UnhandledException += (_, args) => Log.Error("app", "Unhandled exception", args.ExceptionObject as Exception);
TaskScheduler.UnobservedTaskException += (_, args) =>
{
Log.Error("app", "Unobserved task exception", args.Exception);
args.SetObserved();
};
var dialogs = new AppDialogs();
Services = new AppServices(Environment, Settings, SaveSettings, dialogs);
SampleData? sample = capture ? SampleData.Configure(Services) : null;
var shell = new ShellViewModel(Services);
AsyncRelayCommand.Failed += ex => shell.ReportError(ex);
var window = new MainWindow(shell);
dialogs.Owner = window;
MainWindow = window;
if (capture)
{
var dir = captureIndex + 1 < e.Args.Length ? e.Args[captureIndex + 1] : "screenshots";
_ = ScreenCapture.RunAsync(window, shell, sample!, dir);
return;
}
// Closing the main window ends Chronos: later launches wait for it instead of handing over a file it cannot open.
window.Closed += (_, _) =>
{
_windowClosed = true;
_instance?.StopListening();
};
window.Show();
_instance?.Receive(args => Dispatcher.BeginInvoke(() => OnHandOver(shell, args)));
_ = StartAsync(shell, projectFile);
}
/// <summary>Opens the index and the job engine after the window is visible, fills the screens, then opens the project file given.</summary>
private async Task StartAsync(ShellViewModel shell, string? projectFile)
{
try
{
await Services.OpenAsync(Environment.DatabasePath);
await shell.StartAsync();
}
catch (Exception ex)
{
shell.ReportError(ex);
}
finally
{
_started.TrySetResult();
}
if (projectFile is not null) await OpenProjectFileAsync(shell, projectFile);
}
/// <summary>A later launch: its window comes to the front here, and its project file opens.</summary>
private void OnHandOver(ShellViewModel shell, IReadOnlyList<string> args)
{
if (_windowClosed)
{
Log.Warning("app", "A launch arrived while Chronos was closing; its arguments are ignored");
return;
}
if (MainWindow is { } window)
{
window.Show();
if (window.WindowState == WindowState.Minimized) window.WindowState = WindowState.Normal;
window.Activate();
}
if (ProjectFileArgument(args) is { } projectFile) _ = OpenProjectFileAsync(shell, projectFile);
}
/// <summary>Opens a project file once the index is open; failures become the usual one-sentence toast.</summary>
private async Task OpenProjectFileAsync(ShellViewModel shell, string path)
{
await _started.Task;
try
{
await new ProjectFiles(shell).OpenAsync(path);
}
catch (Exception ex)
{
shell.ReportError(ex);
}
}
/// <summary>The first argument that is not an option, as a full path (the hand-over crosses working folders).</summary>
private static string? ProjectFileArgument(IReadOnlyList<string> args)
{
if (args.FirstOrDefault(a => !a.StartsWith("--", StringComparison.Ordinal) && a.Length > 0) is not { } file) return null;
try
{
return System.IO.Path.GetFullPath(file);
}
catch (Exception ex) when (ex is ArgumentException or NotSupportedException or System.IO.PathTooLongException)
{
Log.Warning("app", $"Ignoring argument '{file}'", ex);
return null;
}
}
public void SaveSettings()
{
// A launch that handed over to the running Chronos exits before loading any settings.
if (Settings is null) return;
try
{
Settings.Save(Environment.SettingsPath);
}
catch (Exception ex) when (ex is System.IO.IOException or UnauthorizedAccessException)
{
Log.Warning("app", "Settings not saved", ex);
}
}
protected override void OnExit(ExitEventArgs e)
{
// The mutex stays until the services have stopped, so a launch now waits for this one to exit.
_instance?.StopListening();
SaveSettings();
if (MainWindow?.DataContext is ShellViewModel shell) shell.Dispose();
try
{
// Data and engine code continue on the thread pool, so waiting here cannot deadlock the dispatcher.
if (Services is not null && !Services.DisposeAsync().AsTask().Wait(TimeSpan.FromSeconds(10)))
Log.Warning("app", "Services did not stop within 10 s");
}
catch (AggregateException ex)
{
Log.Warning("app", "Services stopped with an error", ex);
}
_instance?.Dispose();
Log.Info("app", "Chronos exiting");
_log?.Dispose();
if (Environment.IsCapture) Environment.DeleteCaptureData();
base.OnExit(e);
}
private void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
Log.Error("app", "Unhandled UI exception", e.Exception);
if (MainWindow?.DataContext is ShellViewModel shell)
{
shell.ReportError(e.Exception);
e.Handled = true;
}
}
}