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,197 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Chronos.Core.Analysis.Deep;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Codecs.Jpeg;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Imaging.Decoders;
|
||||
using Chronos.Core.Metadata;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Data.Processing;
|
||||
using Chronos.Data.Tests.Archiving;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Data.Tests.Processing;
|
||||
|
||||
/// <summary>A temporary archive holding synthetic sequences (JPEGs with Exif), a processing engine and its job engine.</summary>
|
||||
internal sealed class ProcessingFixture : IAsyncDisposable
|
||||
{
|
||||
/// <summary>Small sources are analysed at native size; batches of two frames between checkpoints.</summary>
|
||||
public static readonly DeepAnalysisOptions DeepOptions = new() { MinAnalysisLongEdge = 64, FlowEvery = 5, MaxDegreeOfParallelism = 2, RegionSampleFrames = 9 };
|
||||
|
||||
private JobEngine? _engine;
|
||||
|
||||
private ProcessingFixture(ArchiveFixture archive, GateDecoder decoder, Func<ProcessingOptions, ProcessingOptions>? configure)
|
||||
{
|
||||
Archive = archive;
|
||||
Decoder = decoder;
|
||||
var options = new ProcessingOptions
|
||||
{
|
||||
Archive = new ArchiveServiceOptions { Decoder = new ImageDecoder([decoder]), Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) },
|
||||
DeepAnalysis = DeepOptions,
|
||||
ProducedBy = "test-pc",
|
||||
};
|
||||
Processing = new ProcessingService(archive.Db, configure?.Invoke(options) ?? options);
|
||||
}
|
||||
|
||||
public ArchiveFixture Archive { get; }
|
||||
public GateDecoder Decoder { get; }
|
||||
public ProcessingService Processing { get; }
|
||||
public ChronosDatabase Db => Archive.Db;
|
||||
public CancellationToken Ct => Archive.Ct;
|
||||
|
||||
public JobEngine Engine => _engine ?? throw new InvalidOperationException("Start the engine first.");
|
||||
|
||||
/// <param name="configure">Changes to the processing options (a server's host and render-node check).</param>
|
||||
public static async Task<ProcessingFixture> CreateAsync(TestContext context, Func<ProcessingOptions, ProcessingOptions>? configure = null) =>
|
||||
new(await ArchiveFixture.CreateAsync(context), new GateDecoder(), configure);
|
||||
|
||||
/// <summary>A started engine with the processing handlers, and the archive's when asked (one worker unless asked, fast checkpoints).</summary>
|
||||
public async Task<JobEngine> StartEngineAsync(bool withArchive = false, int workers = 1)
|
||||
{
|
||||
_engine = new JobEngine(Db, [.. withArchive ? Archive.Service.CreateJobHandlers() : [], .. Processing.CreateJobHandlers()],
|
||||
new JobEngineOptions { Workers = workers, WorkerId = "test", PollInterval = TimeSpan.FromMilliseconds(50), CheckpointInterval = TimeSpan.FromMilliseconds(50) });
|
||||
await _engine.StartAsync(Ct);
|
||||
return _engine;
|
||||
}
|
||||
|
||||
public Task<Job> EnqueueAsync(Chronos.Data.Archiving.Jobs.ArchiveJobRequest request) => Engine.EnqueueAsync(request, cancellationToken: Ct);
|
||||
|
||||
public Task<Job> WaitForAsync(Guid jobId, JobState state) => Archive.WaitForAsync(jobId, state, 60);
|
||||
|
||||
/// <summary>Writes frames <paramref name="first"/>… of <paramref name="sequence"/> as JPEGs with their Exif into
|
||||
/// <paramref name="folder"/> (adopted in place) and indexes the archive.</summary>
|
||||
public async Task<Sequence> AddAsync(SyntheticSequence sequence, string folder = "Synthetic", int first = 0)
|
||||
{
|
||||
Write(sequence, folder, first);
|
||||
await Archive.ScanAsync(ScanMode.Full);
|
||||
var location = (await Db.Sequences.ListLocationsAsync(Archive.Archive.Id, Ct)).Single(l => l.Folder == folder);
|
||||
return (await Db.Sequences.GetAsync(location.Id, Ct))!;
|
||||
}
|
||||
|
||||
/// <summary>Writes frames <paramref name="first"/>… of <paramref name="sequence"/> as JPEGs with their Exif into <paramref name="folder"/>.</summary>
|
||||
public void Write(SyntheticSequence sequence, string folder = "Synthetic", int first = 0)
|
||||
{
|
||||
var directory = Path.Combine(Archive.Paths.Root, folder);
|
||||
Directory.CreateDirectory(directory);
|
||||
for (var i = first; i < sequence.Count; i++)
|
||||
{
|
||||
using var image = sequence.Render(i);
|
||||
var exif = ExifWriter.BuildJpegApp1(sequence.Metadata[i]);
|
||||
File.WriteAllBytes(Path.Combine(directory, FileName(i)), JpegEncoder.Encode(image, new JpegEncodeOptions { Quality = 95, App1Segments = [exif[4..]] }));
|
||||
}
|
||||
}
|
||||
|
||||
public static string FileName(int index) => $"IMG_{index + 1:0000}.JPG";
|
||||
|
||||
public SequencePaths Folder(Sequence sequence) => Archive.Paths.Sequence(sequence.Folder);
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
if (_engine is not null) await _engine.DisposeAsync();
|
||||
await Archive.DisposeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Managed decoding that records every request and can hold one file's decode until the job is cancelled or the decode is released.</summary>
|
||||
internal sealed class GateDecoder : IImageDecoderProvider
|
||||
{
|
||||
private readonly ManagedDecoderProvider _managed = new();
|
||||
|
||||
public string Name => "gate";
|
||||
|
||||
public ConcurrentQueue<DecodeRequest> Requests { get; } = new();
|
||||
|
||||
/// <summary>File name whose decode waits for cancellation; null decodes everything.</summary>
|
||||
public string? Hold { get; set; }
|
||||
|
||||
/// <summary>Holds only decodes of this purpose (null: any).</summary>
|
||||
public DecodePurpose? HoldPurpose { get; set; }
|
||||
|
||||
/// <summary>Holds only decodes with this long edge (null: any).</summary>
|
||||
public int? HoldEdge { get; set; }
|
||||
|
||||
/// <summary>Completed when a decode of <see cref="Hold"/> started waiting.</summary>
|
||||
public TaskCompletionSource Holding { get; private set; } = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
private TaskCompletionSource _released = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
public void HoldFrame(int index, DecodePurpose? purpose = null, int? edge = null)
|
||||
{
|
||||
Holding = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
_released = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
(HoldPurpose, HoldEdge) = (purpose, edge);
|
||||
Hold = ProcessingFixture.FileName(index);
|
||||
}
|
||||
|
||||
/// <summary>File name whose tier probe waits until <see cref="Release"/> (a light analysis probes frames whose tier is
|
||||
/// not known yet, and decodes nothing); null probes everything.</summary>
|
||||
public string? HoldProbe { get; private set; }
|
||||
|
||||
/// <summary>Holds the next tier probe of frame <paramref name="index"/>'s file, as <see cref="HoldFrame"/> holds a decode.</summary>
|
||||
public void HoldProbeOf(int index)
|
||||
{
|
||||
Holding = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
_released = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
HoldProbe = ProcessingFixture.FileName(index);
|
||||
}
|
||||
|
||||
/// <summary>Lets the held decode go on, as a slow read would.</summary>
|
||||
public void Release() => _released.TrySetResult();
|
||||
|
||||
/// <summary>Tiers <see cref="Probe(string, ImageFileFormat)"/> reports per file name instead of the managed provider's (a
|
||||
/// host that reads them only as previews, or not at all).</summary>
|
||||
public ConcurrentDictionary<string, FileTier> Tiers { get; } = new();
|
||||
|
||||
/// <summary>Files (by name) whose decodes report the embedded-preview tier from a preview of this oriented size, as
|
||||
/// a size-limited decode that picked a smaller preview would.</summary>
|
||||
public ConcurrentDictionary<string, (int Width, int Height)> PreviewDecodes { get; } = new();
|
||||
|
||||
/// <summary>Files (by name) that cannot be read: their decodes throw <see cref="IOException"/> (a sharing violation).</summary>
|
||||
public ConcurrentDictionary<string, byte> Unreadable { get; } = new();
|
||||
|
||||
/// <summary>File name and decoder of every decode that produced pixels.</summary>
|
||||
public ConcurrentQueue<(string File, string Decoder)> Decoded { get; } = new();
|
||||
|
||||
public DecodeTier? TierFor(ImageFileFormat format) => _managed.TierFor(format);
|
||||
|
||||
public FileTier Probe(string path, ImageFileFormat format) => Probe(path, format, null);
|
||||
|
||||
public FileTier Probe(string path, ImageFileFormat format, string? companion)
|
||||
{
|
||||
var name = Path.GetFileName(path);
|
||||
if (HoldProbe is { } hold && name == hold)
|
||||
{
|
||||
Holding.TrySetResult();
|
||||
_released.Task.Wait(TimeSpan.FromSeconds(30));
|
||||
}
|
||||
return Tiers.TryGetValue(name, out var tier) ? tier : _managed.Probe(path, format, companion);
|
||||
}
|
||||
|
||||
public DecodedImage? Decode(DecodeRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Requests.Enqueue(request);
|
||||
var name = Path.GetFileName(request.Path);
|
||||
if (Hold is { } hold && name == hold && (HoldPurpose ?? request.Purpose) == request.Purpose
|
||||
&& (HoldEdge ?? request.MaxLongEdge) == request.MaxLongEdge)
|
||||
{
|
||||
Holding.TrySetResult();
|
||||
try
|
||||
{
|
||||
_released.Task.Wait(TimeSpan.FromSeconds(30), cancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
if (Unreadable.ContainsKey(name)) throw new IOException($"The process cannot access the file '{request.Path}' because it is being used by another process.");
|
||||
var decoded = _managed.Decode(request, cancellationToken);
|
||||
if (decoded is null) return null;
|
||||
Decoded.Enqueue((name, decoded.Decoder));
|
||||
if (!PreviewDecodes.TryGetValue(name, out var preview)) return decoded;
|
||||
return new DecodedImage(decoded.Pixels, DecodeTier.EmbeddedPreview, "test-preview", preview.Width, preview.Height);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user