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>
120 lines
5.8 KiB
C#
120 lines
5.8 KiB
C#
using System.Diagnostics;
|
|
using Chronos.Core.Imaging;
|
|
using Chronos.Core.Model;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Data.Tests.Perf;
|
|
|
|
/// <summary>
|
|
/// The §1.1 library: 2,000 sequences of 250 photos (500,000 frames) over twelve years, a dozen cameras, sixty tags and
|
|
/// mixed status flags, written straight into the index (no files). Everything but ids and hashes follows the seed, so
|
|
/// every run measures the same library.
|
|
/// </summary>
|
|
internal static class SyntheticLibrary
|
|
{
|
|
public const int Sequences = 2_000;
|
|
public const int FramesPerSequence = 250;
|
|
public const int Photos = Sequences * FramesPerSequence;
|
|
|
|
public static readonly (string Make, string Model)[] Cameras =
|
|
[
|
|
("Canon", "Canon EOS R5"), ("Canon", "Canon EOS 5D Mark IV"), ("Canon", "Canon EOS R6"), ("NIKON CORPORATION", "NIKON Z 7_2"),
|
|
("NIKON CORPORATION", "NIKON D850"), ("SONY", "ILCE-7M4"), ("SONY", "ILCE-7RM5"), ("FUJIFILM", "X-T5"), ("FUJIFILM", "GFX100S"),
|
|
("Panasonic", "DC-S5M2"), ("OM Digital Solutions", "OM-1"), ("GoPro", "HERO12 Black"),
|
|
];
|
|
|
|
private static readonly string[] Subjects =
|
|
["Harbour", "Milky Way", "Storm front", "Construction site", "City lights", "Glacier", "Sunrise", "Aurora", "Harvest", "Tide", "Fog", "Market"];
|
|
|
|
private static readonly string[] Places =
|
|
["Dolomites", "Trieste", "Lofoten", "Atacama", "Iceland", "Rome", "Garda", "Etna", "Patagonia", "Namib", "Kyoto", "Sardinia"];
|
|
|
|
private static readonly ImageFileFormat[] Formats = [ImageFileFormat.Cr3, ImageFileFormat.Nef, ImageFileFormat.Arw, ImageFileFormat.Jpeg, ImageFileFormat.Raf, ImageFileFormat.Dng];
|
|
|
|
public static string Tag(int i) => i switch
|
|
{
|
|
0 => "milky way",
|
|
1 => "harbour",
|
|
2 => "client",
|
|
_ => $"tag {i:00}",
|
|
};
|
|
|
|
/// <summary>Writes the library into <paramref name="db"/> and returns its archive.</summary>
|
|
public static async Task<Archive> BuildAsync(ChronosDatabase db, TestContext context, int seed = 7)
|
|
{
|
|
var watch = Stopwatch.StartNew();
|
|
var archive = new Archive { Id = Guid.CreateVersion7(), Name = "Perf", RootPath = "/archive/perf", Created = DateTimeOffset.UtcNow };
|
|
await db.Archives.UpsertAsync(archive, context.Cancellation);
|
|
var random = new Random(seed);
|
|
var sequences = new List<Sequence>(Sequences);
|
|
for (var i = 0; i < Sequences; i++)
|
|
{
|
|
var (make, model) = Cameras[random.Next(Cameras.Length)];
|
|
var first = new DateTime(2015, 1, 1).AddDays(random.Next(12 * 365)).AddMinutes(random.Next(24 * 60));
|
|
var interval = 2 + random.Next(30);
|
|
var status = (random.Next(4) > 0 ? SequenceStatus.AnalyzedLight : 0) | (random.Next(3) == 0 ? SequenceStatus.ProxiesBuilt : 0)
|
|
| (random.Next(2) == 0 ? SequenceStatus.Verified : 0) | (random.Next(10) == 0 ? SequenceStatus.HasWarnings : 0);
|
|
var tags = Enumerable.Range(0, random.Next(5)).Select(_ => Tag(random.Next(60))).Distinct().ToArray();
|
|
sequences.Add(new Sequence
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
ArchiveId = archive.Id,
|
|
Title = random.Next(8) == 0 ? null : $"{Subjects[random.Next(Subjects.Length)]} {Places[random.Next(Places.Length)]} {i}",
|
|
Folder = $"{first.Year}/{first:yyyy-MM-dd}_{i:0000}",
|
|
CameraMake = make,
|
|
CameraModel = model,
|
|
FirstCapture = first,
|
|
LastCapture = first.AddSeconds(interval * (FramesPerSequence - 1)),
|
|
FrameCount = FramesPerSequence,
|
|
MedianInterval = interval,
|
|
TotalBytes = FramesPerSequence * 25_000_000L,
|
|
Status = status,
|
|
Rating = random.Next(6),
|
|
Tags = tags,
|
|
UpdatedAt = DateTimeOffset.UtcNow,
|
|
});
|
|
}
|
|
foreach (var s in sequences) await db.Sequences.UpsertAsync(s, context.Cancellation);
|
|
await db.Frames.BulkInsertAsync(sequences.SelectMany((s, i) => Frames(s, seed, i)), context.Cancellation);
|
|
context.Log($"perf: built {Sequences:N0} sequences / {Photos:N0} photos in {watch.Elapsed.TotalSeconds:F1} s");
|
|
return archive;
|
|
}
|
|
|
|
private static IEnumerable<Frame> Frames(Sequence sequence, int seed, int index)
|
|
{
|
|
// Seeded by the sequence's position, not its random id, so every run builds the same frames.
|
|
var random = new Random(unchecked((seed * 100_003) + index));
|
|
var format = Formats[random.Next(Formats.Length)];
|
|
for (var i = 0; i < FramesPerSequence; i++)
|
|
{
|
|
var flags = random.Next(2_000) switch
|
|
{
|
|
0 => FrameFlags.Missing,
|
|
1 => FrameFlags.Corrupt,
|
|
2 or 3 => FrameFlags.Duplicate,
|
|
_ => FrameFlags.None,
|
|
};
|
|
yield return new Frame
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
SequenceId = sequence.Id,
|
|
Index = i,
|
|
RelativePath = $"{sequence.Folder}/originals/IMG_{i:0000}.{format.ToString().ToUpperInvariant()}",
|
|
FileName = $"IMG_{i:0000}.{format.ToString().ToUpperInvariant()}",
|
|
Size = 20_000_000 + random.Next(10_000_000),
|
|
Sha256 = Convert.ToHexStringLower(Guid.NewGuid().ToByteArray()) + Convert.ToHexStringLower(Guid.NewGuid().ToByteArray()),
|
|
CapturedAt = sequence.FirstCapture!.Value.AddSeconds(sequence.MedianInterval!.Value * i),
|
|
TimestampSource = TimestampSource.ExifOriginal,
|
|
ExposureTime = 1 / 250.0,
|
|
FNumber = 8,
|
|
Iso = 100,
|
|
FocalLength = 24,
|
|
Width = 6000,
|
|
Height = 4000,
|
|
Format = format,
|
|
Flags = flags,
|
|
};
|
|
}
|
|
}
|
|
}
|