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,118 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Chronos.Core.Model;
|
||||
|
||||
namespace Chronos.Data.Jobs;
|
||||
|
||||
/// <summary>How much a kind of job counts in the priority queue (<see cref="JobPriorityQueue"/>).</summary>
|
||||
public enum JobKindPriority
|
||||
{
|
||||
Low,
|
||||
Normal,
|
||||
High,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The priority queue of Settings (owner review 1, R2). Jobs always run one at a time. Off, they run in claim order
|
||||
/// (priority, then age) and a running job is never interrupted: the user pauses it to let the next one start. On, a kind
|
||||
/// of a higher <see cref="JobKindPriority"/> runs first, and a queued job of a higher level that the engine can run makes
|
||||
/// the running job of a lower level yield without asking: it goes back to the queue with its checkpoint and resumes by
|
||||
/// itself once nothing above it waits. Kinds of the same level never interrupt each other.
|
||||
/// </summary>
|
||||
public sealed record JobPriorityQueue
|
||||
{
|
||||
/// <summary>The levels a kind has unless the user changed it: renders, imports and downloads first; the long passes that resume anywhere last.</summary>
|
||||
public static IReadOnlyDictionary<JobKind, JobKindPriority> DefaultLevels { get; } = new Dictionary<JobKind, JobKindPriority>
|
||||
{
|
||||
[JobKind.Render] = JobKindPriority.High,
|
||||
[JobKind.Import] = JobKindPriority.High,
|
||||
[JobKind.Download] = JobKindPriority.High,
|
||||
[JobKind.Verify] = JobKindPriority.Low,
|
||||
[JobKind.Proxies] = JobKindPriority.Low,
|
||||
};
|
||||
|
||||
/// <summary>The strict queue: no levels, no interruptions.</summary>
|
||||
public static JobPriorityQueue Off { get; } = new();
|
||||
|
||||
/// <summary>Whether levels order the queue and interrupt lower jobs.</summary>
|
||||
public bool Enabled { get; init; }
|
||||
|
||||
/// <summary>Levels the user set; a kind not listed has its <see cref="DefaultLevels"/> level, else normal.</summary>
|
||||
public IReadOnlyDictionary<JobKind, JobKindPriority> Levels { get; init; } = new Dictionary<JobKind, JobKindPriority>();
|
||||
|
||||
/// <summary>The level of <paramref name="kind"/>.</summary>
|
||||
public JobKindPriority LevelOf(JobKind kind) =>
|
||||
Levels.TryGetValue(kind, out var level) || DefaultLevels.TryGetValue(kind, out level) ? level : JobKindPriority.Normal;
|
||||
|
||||
/// <summary>Whether a queued job of <paramref name="challenger"/> interrupts a running job of <paramref name="running"/>.</summary>
|
||||
public bool Interrupts(JobKind challenger, JobKind running) => Enabled && LevelOf(challenger) > LevelOf(running);
|
||||
|
||||
/// <summary>
|
||||
/// Whether <paramref name="a"/> is claimed before <paramref name="b"/>: the higher level first while the queue is on,
|
||||
/// then the higher priority, the older job and the lower id (<see cref="Repositories.JobRepository.ClaimNextAsync"/>).
|
||||
/// </summary>
|
||||
public bool ClaimsBefore(Job a, Job b)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(a);
|
||||
ArgumentNullException.ThrowIfNull(b);
|
||||
if (Enabled && LevelOf(a.Kind) != LevelOf(b.Kind)) return LevelOf(a.Kind) > LevelOf(b.Kind);
|
||||
return a.Priority != b.Priority ? a.Priority > b.Priority : a.Created != b.Created ? a.Created < b.Created : a.Id.CompareTo(b.Id) < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The SQL ordering of the queue (before priority, age and id): the levels of <paramref name="kinds"/>, highest first, as
|
||||
/// a <c>CASE</c> over the kind column; empty while the queue is off or every kind has the same level.
|
||||
/// </summary>
|
||||
internal string OrderSql(IEnumerable<JobKind> kinds)
|
||||
{
|
||||
if (!Enabled) return string.Empty;
|
||||
var levels = kinds.Distinct().GroupBy(LevelOf).Where(g => g.Key != JobKindPriority.Normal).ToList();
|
||||
if (levels.Count == 0) return string.Empty;
|
||||
var sql = new StringBuilder("CASE");
|
||||
foreach (var level in levels)
|
||||
{
|
||||
sql.Append(" WHEN kind IN (").AppendJoin(", ", level.Select(k => ((int)k).ToString(CultureInfo.InvariantCulture))).Append(") THEN ")
|
||||
.Append(((int)level.Key).ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
return sql.Append(" ELSE ").Append(((int)JobKindPriority.Normal).ToString(CultureInfo.InvariantCulture)).Append(" END DESC, ").ToString();
|
||||
}
|
||||
|
||||
/// <summary>Wire name of a level in API v1 and settings files: <c>high</c>, <c>normal</c>, <c>low</c>.</summary>
|
||||
public static string Wire(JobKindPriority level) => level.ToString().ToLowerInvariant();
|
||||
|
||||
/// <summary>The level named <paramref name="text"/> (<see cref="Wire"/>, any case); false for anything else.</summary>
|
||||
public static bool TryParse(string? text, out JobKindPriority level)
|
||||
{
|
||||
foreach (var candidate in Enum.GetValues<JobKindPriority>())
|
||||
{
|
||||
if (!string.Equals(text, Wire(candidate), StringComparison.OrdinalIgnoreCase)) continue;
|
||||
level = candidate;
|
||||
return true;
|
||||
}
|
||||
level = JobKindPriority.Normal;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The queue from settings: <paramref name="levels"/> maps kind names (<see cref="JobWire.Kind"/> or the enum name) to
|
||||
/// level names; unknown kinds and levels are skipped, so a settings file written by a newer build still loads.
|
||||
/// </summary>
|
||||
public static JobPriorityQueue From(bool enabled, IReadOnlyDictionary<string, string>? levels)
|
||||
{
|
||||
var parsed = new Dictionary<JobKind, JobKindPriority>();
|
||||
foreach (var (name, value) in levels ?? new Dictionary<string, string>())
|
||||
{
|
||||
if ((JobWire.TryParseKind(name, out var kind) || Enum.TryParse(name, ignoreCase: true, out kind)) && Enum.IsDefined(kind) && TryParse(value, out var level))
|
||||
parsed[kind] = level;
|
||||
}
|
||||
return new JobPriorityQueue { Enabled = enabled, Levels = parsed };
|
||||
}
|
||||
|
||||
/// <summary>The levels that differ from <see cref="DefaultLevels"/>, by wire kind name: what settings store.</summary>
|
||||
public static Dictionary<string, string> Changed(IReadOnlyDictionary<JobKind, JobKindPriority> levels)
|
||||
{
|
||||
var defaults = new JobPriorityQueue();
|
||||
return levels.Where(l => defaults.LevelOf(l.Key) != l.Value).OrderBy(l => l.Key)
|
||||
.ToDictionary(l => JobWire.Kind(l.Key), l => Wire(l.Value), StringComparer.Ordinal);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user