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

+67
View File
@@ -0,0 +1,67 @@
name: Bug report
about: Something in Chronos, the Uploader or the Server does not work as expected.
title: "[Bug] "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time. Security problems are reported privately (see SECURITY.md), never here.
- type: dropdown
id: program
attributes:
label: Program
options:
- Chronos (desktop)
- Chronos Uploader
- Chronos Server (Docker / Unraid)
- Chronos Server (Windows)
- Setup / update
validations:
required: true
- type: input
id: version
attributes:
label: Version
description: "About shows it (server: admin panel › About, or /api/v1/server/info)."
placeholder: "0.2.0"
validations:
required: true
- type: input
id: system
attributes:
label: System
description: Windows version, or the Docker/Unraid host and PostgreSQL version.
placeholder: "Windows 11 24H2, RTX 4070 / Unraid 7.0, PostgreSQL 17"
- type: textarea
id: what-happened
attributes:
label: What happened
description: What you did, what you expected and what happened instead.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: |
1. Import a card with ...
2. Open the sequence ...
3. ...
- type: textarea
id: diagnostics
attributes:
label: Diagnostics
description: |
Desktop: Settings › Advanced › Diagnostics › *Export bundle* (or About › *Diagnostics bundle*), then drag the
zip here. Server: admin panel › Logs › *Diagnostics*. Bundles contain logs and system information, never photos, passwords or tokens; read them
before sharing if your folder or host names are private.
- type: checkboxes
id: checks
attributes:
label: Checks
options:
- label: I am using the latest release.
required: true
- label: I searched the existing issues.
required: true
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Report a security vulnerability
url: https://gitea.encke-hake.ts.net/BalboSoft/Chronos/src/branch/main/SECURITY.md
about: Please report security problems privately, never in a public issue.
@@ -0,0 +1,49 @@
name: Translation review
about: A wrong, unclear or too long text in a translated version of Chronos.
title: "[Translation] "
labels: ["translation"]
body:
- type: markdown
attributes:
value: |
Every language except English and Italian was machine-translated. Corrections from native speakers are very
welcome. The texts are in `i18n/<language>/<Area>.<language>.resx`; English sources are in `i18n/en/`.
Labels must stay short (at most about 30 characters), tooltips at most 200 characters, and placeholders such
as `{0}` must be kept.
- type: input
id: language
attributes:
label: Language
description: Language code as in the i18n folder.
placeholder: "de, fr, pt-BR, zh-Hans…"
validations:
required: true
- type: input
id: key
attributes:
label: Key
description: The `name` of the entry in the resx file, if you found it. Otherwise describe where the text appears.
placeholder: "Library.Filter.Year"
- type: textarea
id: current
attributes:
label: Current text
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed text
validations:
required: true
- type: textarea
id: context
attributes:
label: Context
description: Where the text appears (screen, button, tooltip) and why the proposal is better. A screenshot helps.
- type: checkboxes
id: native
attributes:
label: Reviewer
options:
- label: I am a native or fluent speaker of this language.
+42
View File
@@ -0,0 +1,42 @@
# Parses YAML files and checks the shape of Gitea issue forms, so a broken workflow, compose file or issue form fails
# CI instead of failing on Gitea (an issue form that does not parse is simply not offered).
# Usage: ruby .gitea/scripts/check-yaml.rb FILE...
require "yaml"
def issue_form_problem(doc)
return "the form is not a mapping" unless doc.is_a?(Hash)
return "the form needs a name and an about text" unless doc["name"].is_a?(String) && doc["about"].is_a?(String)
return "the form needs a body list" unless doc["body"].is_a?(Array) && !doc["body"].empty?
ids = []
doc["body"].each_with_index do |item, i|
return "body item #{i + 1} has no type" unless item.is_a?(Hash) && item["type"].is_a?(String)
attributes = item["attributes"]
return "body item #{i + 1} has no attributes" unless attributes.is_a?(Hash)
if item["type"] == "markdown"
return "markdown item #{i + 1} has no value" unless attributes["value"].is_a?(String)
else
return "body item #{i + 1} has no label" unless attributes["label"].is_a?(String)
ids << item["id"] if item["id"]
end
end
return "duplicate ids #{ids.tally.select { |_, n| n > 1 }.keys.join(', ')}" if ids.uniq.size != ids.size
nil
end
failures = 0
ARGV.each do |path|
doc = YAML.safe_load(File.read(path), aliases: true, filename: path)
if File.basename(File.dirname(path)) == "ISSUE_TEMPLATE" && File.basename(path) != "config.yml"
problem = issue_form_problem(doc)
raise problem if problem
end
puts "ok #{path}"
rescue StandardError => e
puts "::error file=#{path},title=YAML::#{e.message.lines.first.to_s.strip}"
failures += 1
end
exit(failures.zero? ? 0 : 1)
+117
View File
@@ -0,0 +1,117 @@
# Installs, runs, upgrades and removes the packed installers on a clean Windows runner (BRIEF §18): silent mode,
# folder with a space, Add/Remove Programs entry, shortcuts, the .chronos file type, upgrade in place (files of the
# previous version removed), user data kept, the uninstaller removing itself, and the documented exit codes.
param(
[Parameter(Mandatory)] [string] $Setup1,
[Parameter(Mandatory)] [string] $Setup2,
[Parameter(Mandatory)] [string] $UploaderSetup,
[Parameter(Mandatory)] [string] $Version1,
[Parameter(Mandatory)] [string] $Version2,
[Parameter(Mandatory)] [string] $Screenshots
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
# Relative paths are taken from the PowerShell location: .NET resolves them from the process directory, which a
# Set-Location does not move, and the programs get the screenshot folder as an argument.
$Setup1 = (Resolve-Path -LiteralPath $Setup1).Path
$Setup2 = (Resolve-Path -LiteralPath $Setup2).Path
$UploaderSetup = (Resolve-Path -LiteralPath $UploaderSetup).Path
$Screenshots = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Screenshots)
function Invoke-Program([string] $Exe, [string[]] $Arguments) {
$start = [System.Diagnostics.ProcessStartInfo]::new($Exe)
foreach ($argument in $Arguments) { $start.ArgumentList.Add($argument) }
$start.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($start)
if (-not $process.WaitForExit(600000)) {
$process.Kill($true)
throw "$Exe $Arguments did not finish in 10 minutes"
}
Write-Host "$(Split-Path $Exe -Leaf) $Arguments -> exit $($process.ExitCode)"
return $process.ExitCode
}
function Assert-True([bool] $Condition, [string] $Message) {
if (-not $Condition) { throw "FAILED: $Message" }
Write-Host "ok: $Message"
}
function Wait-Removed([string] $Path) {
for ($i = 0; $i -lt 120 -and (Test-Path -LiteralPath $Path); $i++) { Start-Sleep -Milliseconds 500 }
return -not (Test-Path -LiteralPath $Path)
}
function Get-DefaultValue([string] $Key) {
if (-not (Test-Path -LiteralPath $Key)) { return $null }
return (Get-Item -LiteralPath $Key).GetValue('')
}
$dir = Join-Path $env:RUNNER_TEMP 'Chronos Test'
$entryKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Chronos'
$programs = [Environment]::GetFolderPath('Programs')
$desktop = [Environment]::GetFolderPath('DesktopDirectory')
$links = @(
(Join-Path $programs 'Chronos.lnk'), (Join-Path $programs 'Chronos Uploader.lnk'),
(Join-Path $desktop 'Chronos.lnk'), (Join-Path $desktop 'Chronos Uploader.lnk'))
$userData = Join-Path $env:LOCALAPPDATA 'Chronos'
$userFile = Join-Path $userData 'kept-by-setup.txt'
New-Item -ItemType Directory -Force -Path $userData | Out-Null
Set-Content -LiteralPath $userFile -Value 'user data'
Write-Host '--- Arguments'
Assert-True ((Invoke-Program $Setup1 @('/BOGUS')) -eq 2) 'an unknown switch exits with 2 (invalid arguments)'
Assert-True ((Invoke-Program $Setup1 @('/S', '/uninstall')) -eq 6) 'removing a product that is not installed exits with 6'
Write-Host "--- Install $Version1 into '$dir'"
Assert-True ((Invoke-Program $Setup1 @('/S', "/DIR=$dir")) -eq 0) 'silent install exits with 0'
foreach ($file in 'Chronos.exe', 'Chronos.Uploader.exe', 'Uninstall Chronos.exe', 'install-log.json', 'legacy.txt') {
Assert-True (Test-Path -LiteralPath (Join-Path $dir $file)) "$file installed"
}
$entry = Get-ItemProperty -LiteralPath $entryKey
Assert-True ($entry.DisplayVersion -eq $Version1) "Add/Remove Programs lists version $Version1"
Assert-True ($entry.InstallLocation -eq $dir) 'Add/Remove Programs lists the chosen folder'
Assert-True ($entry.QuietUninstallString -eq "`"$(Join-Path $dir 'Uninstall Chronos.exe')`" /uninstall /S") 'quiet uninstall command points at the uninstaller'
foreach ($link in $links) { Assert-True (Test-Path -LiteralPath $link) "shortcut '$link' created" }
Assert-True ((Get-DefaultValue 'HKCU:\Software\Classes\.chronos') -eq 'Chronos.Project') '.chronos opens with Chronos'
Assert-True ((Get-DefaultValue 'HKCU:\Software\Classes\Chronos.Project\shell\open\command') -eq "`"$(Join-Path $dir 'Chronos.exe')`" `"%1`"") 'Chronos.Project opens the installed Chronos.exe'
Write-Host '--- Run the installed programs'
foreach ($program in 'Chronos.exe', 'Chronos.Uploader.exe') {
$before = @(Get-ChildItem -Path $Screenshots -Filter *.png -ErrorAction SilentlyContinue).Count
$code = Invoke-Program (Join-Path $dir $program) @('--capture', $Screenshots)
$count = @(Get-ChildItem -Path $Screenshots -Filter *.png -ErrorAction SilentlyContinue).Count - $before
Assert-True ($code -eq 0 -and $count -gt 0) "installed $program starts and draws its screens ($count screenshot(s))"
}
Write-Host "--- Upgrade in place to $Version2"
Assert-True ((Invoke-Program $Setup2 @('/S')) -eq 0) 'silent upgrade exits with 0'
Assert-True ((Get-ItemProperty -LiteralPath $entryKey).DisplayVersion -eq $Version2) "Add/Remove Programs lists version $Version2"
Assert-True ((Get-Content -Raw -LiteralPath (Join-Path $dir 'install-log.json') | ConvertFrom-Json).version -eq $Version2) "install log records version $Version2"
Assert-True (Test-Path -LiteralPath (Join-Path $dir 'Chronos.exe')) 'Chronos.exe still installed'
Assert-True (-not (Test-Path -LiteralPath (Join-Path $dir 'legacy.txt'))) 'a file only the previous version had is removed'
foreach ($link in $links) { Assert-True (Test-Path -LiteralPath $link) "shortcut '$link' kept" }
Assert-True (Test-Path -LiteralPath $userFile) 'user data kept by the upgrade'
Write-Host '--- Uninstall with the installed uninstaller'
Assert-True ((Invoke-Program (Join-Path $dir 'Uninstall Chronos.exe') @('/uninstall', '/S')) -eq 0) 'silent uninstall exits with 0'
Assert-True (Wait-Removed $dir) 'install folder removed, uninstaller included'
Assert-True (-not (Test-Path -LiteralPath $entryKey)) 'Add/Remove Programs entry removed'
foreach ($link in $links) { Assert-True (-not (Test-Path -LiteralPath $link)) "shortcut '$link' removed" }
Assert-True (-not (Test-Path -LiteralPath 'HKCU:\Software\Classes\Chronos.Project')) 'Chronos.Project file type removed'
Assert-True ($null -eq (Get-DefaultValue 'HKCU:\Software\Classes\.chronos')) '.chronos no longer opens with Chronos'
Assert-True (Test-Path -LiteralPath $userFile) 'user data kept by the uninstall'
Write-Host '--- Uploader installer: default folder, removal through the installer itself'
$uploaderDir = Join-Path $env:LOCALAPPDATA 'Programs\Chronos Uploader'
$uploaderKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ChronosUploader'
Assert-True ((Invoke-Program $UploaderSetup @('/S')) -eq 0) 'silent Uploader install exits with 0'
Assert-True (Test-Path -LiteralPath (Join-Path $uploaderDir 'Chronos.Uploader.exe')) 'Uploader installed in %LOCALAPPDATA%\Programs\Chronos Uploader'
Assert-True (Test-Path -LiteralPath $uploaderKey) 'Uploader listed in Add/Remove Programs'
Assert-True ((Invoke-Program $UploaderSetup @('/uninstall', '/S')) -eq 0) 'silent Uploader removal exits with 0'
Assert-True (Wait-Removed $uploaderDir) 'Uploader folder removed'
Assert-True (-not (Test-Path -LiteralPath $uploaderKey)) 'Uploader entry removed'
Assert-True (Test-Path -LiteralPath $userFile) 'user data kept'
Write-Host 'Installer test passed.'
+342
View File
@@ -0,0 +1,342 @@
name: CI
# Gitea Actions (BRIEF §19.1, amended 2026-10-23, R3). The runner is act_runner in Docker mode on the Linux server
# that also runs Gitea: every job runs in a container, one job at a time. The .NET jobs use the SDK image (kept by the
# host after the first pull) and check out with git, because JavaScript actions need Node.js, which that image lacks;
# nothing is uploaded as an artifact or cached. Builds use BUILD_CPUS cores so the host keeps memory for Gitea.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
DOTNET_NOLOGO: "1"
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
TOOLS: src/Chronos.Tools/bin/Release/net10.0/Chronos.Tools.dll
BUILD_CPUS: "4"
# The runner shares its CPU and disks with the server's other services: timed tests get three times their budget
# (Chronos.Testing TestTiming); the performance gates of perf.yml keep theirs.
CHRONOS_TEST_TIME_FACTOR: "3"
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
timeout-minutes: 90
defaults:
run:
shell: bash
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD
git log -1 --format='%h %s'
# Chronos.Data binds the system SQLite library (BRIEF §6.2), which the SDK image lacks.
- name: System SQLite
run: apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends libsqlite3-0 > /dev/null
- name: .NET info
run: dotnet --info
# The Windows projects compile here too (EnableWindowsTargeting); their tests need Windows (job windows below).
- name: Build (warnings are errors)
run: dotnet build Chronos.slnx -c Release -m:"$BUILD_CPUS"
- name: Zero-package guard
run: dotnet "$TOOLS" package-guard
- name: Localization check
run: dotnet "$TOOLS" i18n check
- name: XAML lint
run: dotnet "$TOOLS" xaml-lint
- name: Format check
run: dotnet format whitespace Chronos.slnx --verify-no-changes
# Missing samples become "RAW fixture missing" warnings in the log; the tests that need them skip.
- name: Fetch CC0 fixtures
run: dotnet "$TOOLS" fixtures --allow-missing
- name: Test · Core
run: dotnet run --project tests/Chronos.Core.Tests -c Release --no-build -- --junit out/junit/core.xml
- name: Test · Data (SQLite)
run: dotnet run --project tests/Chronos.Data.Tests -c Release --no-build -- --junit out/junit/data.xml
- name: Test · Server
run: dotnet run --project tests/Chronos.Server.Tests -c Release --no-build -- --junit out/junit/server.xml
- name: Test · Tools
run: dotnet run --project tests/Chronos.Tools.Tests -c Release --no-build -- --junit out/junit/tools.xml
# The release cross-compiles the Windows programs on Linux (BRIEF §18, amended 2026-10-23, R3): every push checks
# that they still publish with their icon, version and manifest, and that the installer packs. ReadyToRun is
# left out here (only start-up time differs) to keep the run short.
- name: Windows programs (win-x64, cross-compiled)
run: |
common="-c Release -r win-x64 --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=false -m:$BUILD_CPUS"
for p in Chronos.App Chronos.Uploader Chronos.Setup; do
dotnet publish "src/$p/$p.csproj" $common -o "out/publish/$p"
done
dotnet "$TOOLS" pack-installer --setup out/publish/Chronos.Setup/Chronos.Setup.exe --product Chronos \
--component "Chronos=out/publish/Chronos.App" --component "Uploader=out/publish/Chronos.Uploader" \
--version 0.0.0 --out out/installers/Chronos-Setup-ci.exe
dotnet "$TOOLS" pe-check out/publish/Chronos.App/Chronos.exe out/publish/Chronos.Uploader/Chronos.Uploader.exe \
out/publish/Chronos.Setup/Chronos.Setup.exe out/installers/Chronos-Setup-ci.exe
# The wire tests of MD5, cleartext, trust and TLS (BRIEF §6.3) run against a service container that postgres-ci
# prepares through SQL; a server that refuses TLS fails them instead of skipping them.
postgres:
name: PostgreSQL ${{ matrix.pg }} integration
needs: build
strategy:
fail-fast: false
matrix:
pg: ["16", "17"]
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
timeout-minutes: 45
services:
postgres:
image: postgres:${{ matrix.pg }}
env:
POSTGRES_USER: chronos
POSTGRES_PASSWORD: chronos-ci
POSTGRES_DB: chronos_test
defaults:
run:
shell: bash
env:
CHRONOS_TEST_PG: Host=postgres;Port=5432;Database=chronos_test;Username=chronos;Password=chronos-ci;SslMode=disable
CHRONOS_TEST_PG_MD5: Host=postgres;Port=5432;Database=chronos_test;Username=chronos_md5;Password=md5-ci;SslMode=disable
CHRONOS_TEST_PG_CLEARTEXT: Host=postgres;Port=5432;Database=chronos_test;Username=chronos_clear;Password=clear-ci;SslMode=disable
CHRONOS_TEST_PG_TRUST: Host=postgres;Port=5432;Database=chronos_test;Username=chronos_trust;SslMode=disable
CHRONOS_TEST_PG_TLS: "1"
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD
# Chronos.Data binds the system SQLite library (BRIEF §6.2), which the SDK image lacks.
- name: System SQLite
run: apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends libsqlite3-0 > /dev/null
- name: Configure PostgreSQL (MD5, cleartext, trust, TLS)
run: |
dotnet run --project src/Chronos.Tools -c Release -- postgres-ci --connection "$CHRONOS_TEST_PG" --host postgres --certificates "$RUNNER_TEMP/pg-tls"
echo "CHRONOS_TEST_PG_ROOT_CERT=$RUNNER_TEMP/pg-tls/server.crt" >> "$GITHUB_ENV"
- name: Test · Data (PostgreSQL)
run: dotnet run --project tests/Chronos.Data.Tests -c Release -- --junit out/junit/data-pg${{ matrix.pg }}.xml
- name: Test · Server (PostgreSQL)
run: dotnet run --project tests/Chronos.Server.Tests -c Release -- --junit out/junit/server-pg${{ matrix.pg }}.xml
# The runner's own image has the docker CLI and talks to the host's daemon: the image is built there and runs with
# PostgreSQL 17 on a network of this job, which the job container joins to reach it. Everything the job creates is
# labelled with the job container's id: a cancelled or timed-out job skips its clean-up step, so the next job removes
# what a job that no longer exists left on the host.
docker:
name: Docker image
needs: build
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Remove what cancelled jobs left
run: |
echo "NAME=chronos-ci-$(hostname)" >> "$GITHUB_ENV"
for c in $(docker ps -aq --filter label=chronos-ci.job); do
job="$(docker inspect -f '{{index .Config.Labels "chronos-ci.job"}}' "$c")"
docker inspect "$job" > /dev/null 2>&1 || docker rm -f -v "$c"
done
for n in $(docker network ls -q --filter label=chronos-ci.job); do
job="$(docker network inspect -f '{{index .Labels "chronos-ci.job"}}' "$n")"
docker inspect "$job" > /dev/null 2>&1 || docker network rm "$n"
done
for i in $(docker image ls -q --filter label=chronos-ci.job | sort -u); do
job="$(docker image inspect -f '{{index .Config.Labels "chronos-ci.job"}}' "$i")"
docker inspect "$job" > /dev/null 2>&1 || docker image rm -f "$i"
done
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD
- name: Build image
run: |
docker buildx version
docker build -f deploy/docker/Dockerfile --build-arg CHRONOS_VERSION=0.0.0-ci --label chronos-ci.job="$(hostname)" -t "$NAME:image" .
- name: Smoke test (/health)
run: |
docker network create --label chronos-ci.job="$(hostname)" "$NAME"
docker network connect "$NAME" "$(hostname)"
docker run -d --name "$NAME-pg" --network "$NAME" --label chronos-ci.job="$(hostname)" \
-e POSTGRES_USER=chronos -e POSTGRES_PASSWORD=chronos-ci -e POSTGRES_DB=chronos postgres:17
for i in $(seq 1 60); do
if docker exec "$NAME-pg" pg_isready -q -U chronos -d chronos; then break; fi
sleep 2
done
docker run -d --name "$NAME-server" --network "$NAME" --label chronos-ci.job="$(hostname)" \
-e CHRONOS_DB_HOST="$NAME-pg" -e CHRONOS_DB_USER=chronos -e CHRONOS_DB_PASSWORD=chronos-ci -e CHRONOS_DB_NAME=chronos \
-e CHRONOS_ADMIN_USER=admin -e CHRONOS_ADMIN_PASSWORD=ci-password-1234 "$NAME:image"
for i in $(seq 1 60); do
if curl -fsS --max-time 10 "http://$NAME-server:8080/health"; then echo; break; fi
sleep 2
done
curl -fsS --max-time 10 "http://$NAME-server:8080/api/v1/server/info"
echo
curl -fsSk --max-time 10 "https://$NAME-server:8443/health"
echo
test "$(docker inspect --format '{{.State.Running}}' "$NAME-server")" = "true"
- name: Container logs and clean-up
if: always()
run: |
docker logs "$NAME-server" || true
docker rm -f -v "$NAME-server" "$NAME-pg" || true
docker network disconnect "$NAME" "$(hostname)" || true
docker network rm "$NAME" || true
docker image rm "$NAME:image" || true
# Gitea fails a workflow that does not parse and offers no issue form that does not. The sources come as an archive:
# the Ruby image has no git.
yaml:
name: YAML check
runs-on: ubuntu-latest
container:
image: ruby:3.3-alpine
timeout-minutes: 15
steps:
- name: Workflows, compose file and public issue forms
env:
TOKEN: ${{ github.token }}
run: |
wget -q --header "Authorization: token $TOKEN" -O /tmp/sources.tar.gz \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${{ github.sha }}.tar.gz"
mkdir -p /tmp/sources && tar -xzf /tmp/sources.tar.gz -C /tmp/sources
cd /tmp/sources/*/
ruby .gitea/scripts/check-yaml.rb .gitea/workflows/*.yml .gitea/ISSUE_TEMPLATE/*.yml deploy/docker/docker-compose.yml
# Windows-only tests, screenshots and the installer test (BRIEF §18, §20.2) need a Windows runner: register an
# act_runner on a Windows PC in host mode with a label (for example "windows") and set the repository variable
# WINDOWS_RUNNER to that label. Without it the job is skipped. The PC needs the .NET SDK of global.json, Git for
# Windows in its default folder (C:/Program Files/Git) and PowerShell 7.
windows:
name: Windows tests and installer
needs: build
if: ${{ vars.WINDOWS_RUNNER != '' }}
runs-on: ${{ vars.WINDOWS_RUNNER || 'windows' }}
timeout-minutes: 90
permissions:
contents: write
# act finds a shell on PATH, where Git for Windows puts no bash.exe by default (and WSL's launcher may come
# first): Git Bash by its path, whose wrapper also puts its tools (base64, printf) on PATH.
defaults:
run:
shell: '"C:/Program Files/Git/bin/bash.exe" --noprofile --norc -e -o pipefail {0}'
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
# A host-mode runner keeps its work folder between runs: reuse the clone.
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" 2>/dev/null ||
git remote set-url origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
git checkout -q -f FETCH_HEAD
git clean -q -fdx
- name: Build
run: dotnet build Chronos.slnx -c Release
- name: Test · Core.Windows
run: dotnet run --project tests/Chronos.Core.Windows.Tests -c Release --no-build -- --junit out/junit/core-windows.xml
- name: Test · App
run: dotnet run --project tests/Chronos.App.Tests -c Release --no-build -- --junit out/junit/app.xml
- name: Screenshots
if: ${{ !cancelled() }}
timeout-minutes: 10
run: |
rm -rf out/screenshots
for exe in src/Chronos.App/bin/Release/net10.0-windows/Chronos.exe src/Chronos.Uploader/bin/Release/net10.0-windows/Chronos.Uploader.exe \
src/Chronos.Setup/bin/Release/net10.0-windows/Chronos.Setup.exe; do
"$exe" --capture out/screenshots &
wait $! || { echo "::error title=Screenshots::$(basename "$exe") --capture exited with $?"; exit 1; }
done
ls out/screenshots
# Same-repository pull requests: the pictures go to the ci-screenshots branch (one commit, overwritten each run),
# where tests/visual/baselines/README.md takes new baselines from. Before the diff, which may fail the job.
- name: Publish to the ci-screenshots branch
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
working-directory: out/screenshots
env:
TOKEN: ${{ github.token }}
run: |
git init -q -b ci-screenshots
git config user.name "chronos-ci"
git config user.email "chronos-ci@noreply.invalid"
git add -A
git commit -q -m "Screenshots of ${{ github.event.pull_request.head.sha }}"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" push -q -f \
"${{ github.server_url }}/${{ github.repository }}.git" HEAD:refs/heads/ci-screenshots
# BRIEF §20.2 visual regression against tests/visual/baselines (a warning only until baselines are committed).
- name: Screenshot diff
if: ${{ !cancelled() }}
run: dotnet src/Chronos.Tools/bin/Release/net10.0/Chronos.Tools.dll screenshots diff out/screenshots --baseline tests/visual/baselines --out out/screenshot-diff
- name: Install, run, upgrade and remove
shell: pwsh
run: |
foreach ($p in 'Chronos.App', 'Chronos.Uploader', 'Chronos.Setup') {
dotnet publish "src/$p/$p.csproj" -c Release -r win-x64 --self-contained -p:PublishSingleFile=true `
-p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=false -o "out/publish/$p"
if ($LASTEXITCODE -ne 0) { throw "dotnet publish $p failed" }
}
Remove-Item -Recurse -Force out/app-v1, out/installers -ErrorAction SilentlyContinue
Copy-Item -Recurse out/publish/Chronos.App out/app-v1
Set-Content -LiteralPath out/app-v1/legacy.txt -Value 'only in version 1'
$tools = 'src/Chronos.Tools/bin/Release/net10.0/Chronos.Tools.dll'
$installers = @(
@('--product', 'Chronos', '--version', '1.0.0', '--component', 'Chronos=out/app-v1',
'--component', 'Uploader=out/publish/Chronos.Uploader', '--out', 'out/installers/Chronos-Setup-1.0.0.exe'),
@('--product', 'Chronos', '--version', '1.0.1', '--component', 'Chronos=out/publish/Chronos.App',
'--component', 'Uploader=out/publish/Chronos.Uploader', '--out', 'out/installers/Chronos-Setup-1.0.1.exe'),
@('--product', 'Chronos Uploader', '--version', '1.0.1', '--component', 'Uploader=out/publish/Chronos.Uploader',
'--out', 'out/installers/Chronos-Uploader-Setup-1.0.1.exe'))
foreach ($installer in $installers) {
dotnet $tools pack-installer --setup out/publish/Chronos.Setup/Chronos.Setup.exe @installer
if ($LASTEXITCODE -ne 0) { throw "pack-installer $installer failed" }
}
./.gitea/scripts/installer-test.ps1 -Setup1 out/installers/Chronos-Setup-1.0.0.exe -Setup2 out/installers/Chronos-Setup-1.0.1.exe `
-UploaderSetup out/installers/Chronos-Uploader-Setup-1.0.1.exe -Version1 1.0.0 -Version2 1.0.1 -Screenshots out/installer-screenshots
+57
View File
@@ -0,0 +1,57 @@
name: Nightly image
# The server image of main as :nightly in the Gitea container registry (BRIEF §19.5, amended 2026-10-23, R3). Built by
# the host's daemon through the runner's own image, as in release.yml (linux/amd64).
on:
schedule:
- cron: "17 2 * * *"
workflow_dispatch:
permissions:
contents: read
packages: write
env:
PUBLIC_URL: ${{ vars.PUBLIC_URL || 'https://gitea.encke-hake.ts.net' }}
jobs:
nightly:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD
- name: Sign in to the registry
env:
REGISTRY: ${{ vars.REGISTRY }}
USER: ${{ vars.REGISTRY_USER || github.actor }}
TOKEN: ${{ secrets.REGISTRY_TOKEN || github.token }}
run: |
registry="${REGISTRY:-$(printf '%s' "$PUBLIC_URL" | sed -E 's#^[a-z]+://##; s#/.*$##')}"
owner="$(printf '%s' "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
{ echo "REGISTRY_HOST=$registry"; echo "IMAGE=$registry/$owner/chronos-server"; } >> "$GITHUB_ENV"
if ! printf '%s' "$TOKEN" | docker login "$registry" -u "$USER" --password-stdin; then
# The workflow's own token (user gitea-actions) has no package permission on an organisation's registry.
echo "::error title=Registry::Sign-in to $registry refused. Add the repository secret REGISTRY_TOKEN: an access token of a user who can write the owner's packages (scope package: read and write)."
exit 1
fi
- name: Build and push
run: |
docker build -f deploy/docker/Dockerfile --build-arg CHRONOS_VERSION="0.0.0-nightly.${{ github.run_number }}" -t "$IMAGE:nightly" .
docker push "$IMAGE:nightly"
- name: Clean up
if: always()
run: |
docker image rm "$IMAGE:nightly" 2> /dev/null || true
docker logout "$REGISTRY_HOST" || true
+64
View File
@@ -0,0 +1,64 @@
name: Performance gates
# BRIEF §1.1 and the Phase 2/3 gates on a synthetic 500,000-photo library (SQLite and PostgreSQL 17) and a
# 100,000-frame archive rebuild from sidecars. Too slow for every push: weekly and on demand. The timings are printed
# at the end of the log (Gitea shows no job summary).
on:
schedule:
- cron: "41 3 * * 1"
workflow_dispatch:
permissions:
contents: read
env:
DOTNET_NOLOGO: "1"
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
jobs:
perf:
name: Library and rebuild gates
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
timeout-minutes: 120
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: chronos
POSTGRES_PASSWORD: chronos-ci
POSTGRES_DB: chronos_perf
defaults:
run:
shell: bash
env:
CHRONOS_PERF: "1"
CHRONOS_TEST_PG: Host=postgres;Port=5432;Database=chronos_perf;Username=chronos;Password=chronos-ci;SslMode=disable
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "${{ github.sha }}"
git checkout -q FETCH_HEAD
# Chronos.Data binds the system SQLite library (BRIEF §6.2), which the SDK image lacks.
- name: System SQLite
run: apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends libsqlite3-0 > /dev/null
- name: Build
run: dotnet build tests/Chronos.Data.Tests -c Release -m:4
- name: Perf tests (SQLite, PostgreSQL 17)
run: |
dotnet run --project tests/Chronos.Data.Tests -c Release --no-build -- --filter category:perf --verbose --junit out/junit/perf.xml | tee out-perf.log
- name: Timings
if: always()
run: |
echo "Performance gates"
if grep -q "perf:" out-perf.log 2>/dev/null; then grep -h "perf:" out-perf.log | sed 's/^ *//'; else echo "no timings recorded"; fi
+309
View File
@@ -0,0 +1,309 @@
name: Release
# A tag vMAJOR.MINOR.PATCH[-PRERELEASE] builds, tests and publishes everything (BRIEF §19.3, amended 2026-10-23, R3)
# on the Linux runner: the Windows programs cross-compiled (installers, portable and server zips), SHA256SUMS and
# release notes on the Gitea release, then the server image in the Gitea container registry. Pre-releases get no
# :latest image and are ignored by the in-app update check.
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Existing tag to (re)publish, e.g. v0.2.0"
required: true
permissions:
contents: write
packages: write
env:
DOTNET_NOLOGO: "1"
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
TOOLS: src/Chronos.Tools/bin/Release/net10.0/Chronos.Tools.dll
BUILD_CPUS: "4"
# Timed tests get three times their budget on the shared runner (Chronos.Testing TestTiming, as in ci.yml).
CHRONOS_TEST_TIME_FACTOR: "3"
TAG: ${{ github.event.inputs.tag || github.ref_name }}
# Where people and programs reach Gitea (the runner itself uses github.server_url). Variable PUBLIC_URL overrides it.
PUBLIC_URL: ${{ vars.PUBLIC_URL || 'https://gitea.encke-hake.ts.net' }}
# The repository (owner/name on this Gitea) that receives the release: this one, or RELEASES_REPO together with the
# RELEASES_TOKEN secret (an access token with write access to it). Every build embeds its address as
# ChronosReleasesUrl, so the update check, licence and issue links read the repository published to.
RELEASES_REPO: ${{ vars.RELEASES_REPO || github.repository }}
jobs:
release:
name: Build, test and publish
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
timeout-minutes: 150
defaults:
run:
shell: bash
env:
# Secrets cannot appear in step conditions: expose only whether signing is configured.
HAS_SIGNING: ${{ secrets.SIGN_PFX_BASE64 != '' }}
outputs:
version: ${{ steps.version.outputs.version }}
latest: ${{ steps.publish.outputs.latest }}
steps:
- name: Version
id: version
run: |
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "::error title=Release::Tag '$TAG' is not vMAJOR.MINOR.PATCH or vMAJOR.MINOR.PATCH-PRERELEASE"
exit 1
fi
version="${TAG#v}"
prerelease=false
if [[ "$version" == *-* ]]; then prerelease=true; fi
echo "version=$version" >> "$GITHUB_OUTPUT"
{ echo "VERSION=$version"; echo "PRERELEASE=$prerelease"; } >> "$GITHUB_ENV"
# Full history and tags: the release notes list the commits since the previous tag.
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --tags origin
git checkout -q "refs/tags/$TAG"
git log -1 --format='%h %s'
# Chronos.Data binds the system SQLite library (BRIEF §6.2), which the SDK image lacks.
- name: System SQLite
run: apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends libsqlite3-0 > /dev/null
- name: Release target
env:
HAS_RELEASES_TOKEN: ${{ secrets.RELEASES_TOKEN != '' }}
run: |
target="$RELEASES_REPO"
if [ "$target" != "${{ github.repository }}" ] && [ "$HAS_RELEASES_TOKEN" != "true" ]; then
echo "::warning title=Release::RELEASES_TOKEN is not set: publishing to ${{ github.repository }} instead of $target."
target="${{ github.repository }}"
fi
{ echo "TARGET=$target"; echo "CHRONOS_RELEASES_URL=${PUBLIC_URL%/}/$target"; } >> "$GITHUB_ENV"
echo "Release $TAG of $target; programs link ${PUBLIC_URL%/}/$target"
- name: Build and test
run: |
dotnet build Chronos.slnx -c Release -m:"$BUILD_CPUS" -p:ChronosVersion="$VERSION" -p:ChronosReleasesUrl="$CHRONOS_RELEASES_URL"
dotnet "$TOOLS" package-guard
dotnet "$TOOLS" i18n check
for t in Core Data Server Tools; do
dotnet run --project "tests/Chronos.$t.Tests" -c Release --no-build -- --junit "out/junit/$t.xml"
done
# Cross-compiled on Linux (EnableWindowsTargeting); pe-check stops the release if a program lost its icon,
# version information or DPI-aware manifest.
- name: Publish self-contained programs (win-x64)
run: |
common="-c Release -r win-x64 --self-contained -p:ChronosVersion=$VERSION -p:ChronosReleasesUrl=$CHRONOS_RELEASES_URL -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -m:$BUILD_CPUS"
dotnet publish src/Chronos.App/Chronos.App.csproj $common -p:PublishReadyToRun=true -o out/publish/app
dotnet publish src/Chronos.Uploader/Chronos.Uploader.csproj $common -p:PublishReadyToRun=true -o out/publish/uploader
dotnet publish src/Chronos.Server/Chronos.Server.csproj $common -o out/publish/server
dotnet publish src/Chronos.Setup/Chronos.Setup.csproj $common -p:PublishReadyToRun=true -o out/publish/setup
dotnet "$TOOLS" pe-check out/publish/app/Chronos.exe out/publish/uploader/Chronos.Uploader.exe out/publish/setup/Chronos.Setup.exe
# Authenticode with osslsigncode, the Linux counterpart of signtool (BRIEF §18); unsigned builds are still released.
- name: Sign programs
if: env.HAS_SIGNING == 'true'
env:
SIGN_PFX: ${{ secrets.SIGN_PFX_BASE64 }}
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}
run: |
apt-get update -qq && apt-get install -y -qq osslsigncode > /dev/null
pfx="$RUNNER_TEMP/sign.pfx"
trap 'rm -f "$pfx"' EXIT
printf '%s' "$SIGN_PFX" | base64 -d > "$pfx"
for exe in out/publish/*/*.exe; do
osslsigncode sign -pkcs12 "$pfx" -pass "$SIGN_PASSWORD" -h sha256 -ts http://timestamp.digicert.com -in "$exe" -out "$exe.signed"
mv "$exe.signed" "$exe"
done
- name: Package installers and archives
run: |
mkdir -p out/release
dotnet "$TOOLS" pack-installer --setup out/publish/setup/Chronos.Setup.exe --product Chronos \
--component "Chronos=out/publish/app" --component "Uploader=out/publish/uploader" --component "Server=out/publish/server" \
--version "$VERSION" --out "out/release/Chronos-Setup-$VERSION.exe"
dotnet "$TOOLS" pack-installer --setup out/publish/setup/Chronos.Setup.exe --product "Chronos Uploader" \
--component "Uploader=out/publish/uploader" --version "$VERSION" --out "out/release/Chronos-Uploader-Setup-$VERSION.exe"
dotnet "$TOOLS" zip out/publish/server --out "out/release/Chronos-Server-win-x64-$VERSION.zip"
# The portable build keeps its data next to Chronos.exe because of portable.txt (never inside the installer).
cp -R out/publish/app out/portable
printf 'Chronos portable mode: settings, index and logs are kept in the data folder next to Chronos.exe.\r\n' > out/portable/portable.txt
dotnet "$TOOLS" zip out/portable --out "out/release/Chronos-win-x64-portable-$VERSION.zip"
dotnet "$TOOLS" pe-check out/release/*.exe
ls -l out/release
- name: Sign installers
if: env.HAS_SIGNING == 'true'
env:
SIGN_PFX: ${{ secrets.SIGN_PFX_BASE64 }}
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}
run: |
pfx="$RUNNER_TEMP/sign.pfx"
trap 'rm -f "$pfx"' EXIT
printf '%s' "$SIGN_PFX" | base64 -d > "$pfx"
for exe in out/release/*.exe; do
osslsigncode sign -pkcs12 "$pfx" -pass "$SIGN_PASSWORD" -h sha256 -ts http://timestamp.digicert.com -in "$exe" -out "$exe.signed"
mv "$exe.signed" "$exe"
done
- name: Unsigned build notice
if: env.HAS_SIGNING != 'true'
run: echo "::notice title=Signing::SIGN_PFX_BASE64 is not set; the installers are unsigned."
- name: Release notes
run: |
# A stable release lists everything since the previous stable one, not only what followed its last pre-release.
if [[ "$TAG" == *-* ]]; then
previous="$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true)"
else
previous="$(git describe --tags --abbrev=0 --exclude '*-*' "$TAG^" 2>/dev/null || true)"
fi
range="${previous:+$previous..}$TAG"
git log --no-merges --format='%h%x09%s' "$range" | dotnet "$TOOLS" changelog --title "Chronos $VERSION" --out out/release-notes.md
cat out/release-notes.md
- name: Checksums
working-directory: out/release
run: |
rm -f SHA256SUMS
sha256sum -- * > "$RUNNER_TEMP/SHA256SUMS"
mv "$RUNNER_TEMP/SHA256SUMS" SHA256SUMS
cat SHA256SUMS
# Created as a draft, published once every file is uploaded and listed at its size (gitea-release).
- name: Gitea release
id: publish
env:
AUTO_TOKEN: ${{ github.token }}
RELEASES_TOKEN: ${{ secrets.RELEASES_TOKEN }}
run: |
token="$AUTO_TOKEN"
if [ "$TARGET" != "${{ github.repository }}" ]; then token="$RELEASES_TOKEN"; fi
GITEA_TOKEN="$token" dotnet "$TOOLS" gitea-release --server "${{ github.server_url }}" --repo "$TARGET" --tag "$TAG" \
--title "Chronos $VERSION" --notes-file out/release-notes.md --assets out/release --prerelease "$PRERELEASE"
# The public content and the image's :latest follow the highest stable version (not Gitea's "latest", which
# is the most recently created one): re-publishing an older tag or publishing a pre-release never rolls them back.
stable="$(curl -fsS -H "Authorization: token $token" "${{ github.server_url }}/api/v1/repos/$TARGET/releases?draft=false&pre-release=false&limit=50")"
newest="$(printf '%s' "$stable" | grep -o '"tag_name":"v[^"]*"' | cut -d '"' -f 4 | sed 's/^v//' | sort -V | tail -n 1 || true)"
newest="${newest:+v$newest}"
latest=false
if [ "$PRERELEASE" = "false" ] && [ "$newest" = "$TAG" ]; then latest=true; fi
echo "Newest stable release of $TARGET: ${newest:-none}; $TAG moves the public content and :latest: $latest"
echo "latest=$latest" >> "$GITHUB_OUTPUT"
echo "LATEST=$latest" >> "$GITHUB_ENV"
# Only with a separate releases repository (RELEASES_REPO and RELEASES_TOKEN, BRIEF §19.4): its README, EULA,
# security policy, issue forms, Unraid template, compose file, i18n/ and SHA256SUMS follow the newest stable
# release, with links to that repository and image.
- name: Update the public releases repository
if: env.LATEST == 'true' && env.TARGET != github.repository
env:
TOKEN: ${{ secrets.RELEASES_TOKEN }}
run: |
server="${{ github.server_url }}"
branch="$(curl -fsS -H "Authorization: token $TOKEN" "$server/api/v1/repos/$TARGET" | grep -o '"default_branch":"[^"]*"' | head -n 1 | cut -d '"' -f 4)"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" clone -q --depth 1 "$server/$TARGET.git" public
git -C public checkout -q -B "$branch"
cp -R deploy/releases-repo/. public/
cp EULA.md SECURITY.md public/
mkdir -p public/.gitea
rm -rf public/.gitea/ISSUE_TEMPLATE
cp -R .gitea/ISSUE_TEMPLATE public/.gitea/ISSUE_TEMPLATE
mkdir -p public/unraid public/docker
cp deploy/unraid/chronos.xml public/unraid/chronos.xml
# Unraid keeps a template's icon as a PNG: the 256 px one the build generated (make-icon), not the SVG source.
cp artifacts/icons/chronos-server-256.png public/unraid/chronos-server.png
# The screenshots of the public README are the approved baselines, once committed (tests/visual/baselines).
mkdir -p public/screenshots
for shot in library jobs settings-rendering server uploader-queue; do
if [ -f "tests/visual/baselines/$shot-dark.png" ]; then cp "tests/visual/baselines/$shot-dark.png" public/screenshots/; fi
done
cp deploy/docker/docker-compose.yml deploy/docker/.env.example public/docker/
rm -rf public/i18n
cp -R i18n public/i18n
cp out/release/SHA256SUMS public/SHA256SUMS
registry="${{ vars.REGISTRY }}"
registry="${registry:-$(printf '%s' "$PUBLIC_URL" | sed -E 's#^[a-z]+://##; s#/.*$##')}"
owner="$(printf '%s' "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
public="${PUBLIC_URL%/}"
find public -path public/.git -prune -o -type f \( -name '*.md' -o -name '*.yml' -o -name '*.xml' \) -print0 |
xargs -0 -r sed -i -e "s#https://gitea.encke-hake.ts.net/BalboSoft/Chronos/raw/branch/main/deploy/unraid/#$public/$TARGET/raw/branch/$branch/unraid/#g" \
-e "s#https://gitea.encke-hake.ts.net/BalboSoft/Chronos/raw/branch/main/branding/chronos-server.svg#$public/$TARGET/raw/branch/$branch/unraid/chronos-server.png#g" \
-e "s#https://gitea.encke-hake.ts.net/BalboSoft/Chronos/raw/branch/main/deploy/docker/#$public/$TARGET/raw/branch/$branch/docker/#g" \
-e "s#https://gitea.encke-hake.ts.net/BalboSoft/Chronos\([^-A-Za-z0-9_.]\|\$\)#$public/$TARGET\1#g" \
-e "s#gitea.encke-hake.ts.net/balbosoft/chronos-server#$registry/$owner/chronos-server#g" -e "s#docker login gitea.encke-hake.ts.net#docker login $registry#g"
cd public
git config user.name "chronos-release"
git config user.email "chronos-release@noreply.invalid"
git add -A
if git diff --cached --quiet; then
echo "Public repository already up to date."
else
git commit -q -m "chore: update for $TAG"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" push -q origin "HEAD:$branch"
fi
# The server image (BRIEF §19.3) goes to the Gitea container registry of the repository owner once the release job's
# tests passed. The runner's own image has the docker CLI and builds with the host's daemon (linux/amd64; arm64 would
# need QEMU emulation installed on the host). REGISTRY, REGISTRY_USER and the REGISTRY_TOKEN secret override the
# registry (default: the host of PUBLIC_URL), the user and the token (default: the workflow's own).
image:
name: Server image
needs: release
runs-on: ubuntu-latest
timeout-minutes: 60
env:
VERSION: ${{ needs.release.outputs.version }}
LATEST: ${{ needs.release.outputs.latest }}
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init -q .
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git -c http.extraheader="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" fetch -q --depth=1 origin "refs/tags/$TAG:refs/tags/$TAG"
git checkout -q "refs/tags/$TAG"
- name: Sign in to the registry
env:
REGISTRY: ${{ vars.REGISTRY }}
USER: ${{ vars.REGISTRY_USER || github.actor }}
TOKEN: ${{ secrets.REGISTRY_TOKEN || github.token }}
run: |
registry="${REGISTRY:-$(printf '%s' "$PUBLIC_URL" | sed -E 's#^[a-z]+://##; s#/.*$##')}"
owner="$(printf '%s' "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
{ echo "REGISTRY_HOST=$registry"; echo "IMAGE=$registry/$owner/chronos-server"; } >> "$GITHUB_ENV"
if ! printf '%s' "$TOKEN" | docker login "$registry" -u "$USER" --password-stdin; then
# The workflow's own token (user gitea-actions) has no package permission on an organisation's registry.
echo "::error title=Registry::Sign-in to $registry refused. Add the repository secret REGISTRY_TOKEN: an access token of a user who can write the owner's packages (scope package: read and write)."
exit 1
fi
- name: Build and push
run: |
docker build -f deploy/docker/Dockerfile --build-arg CHRONOS_VERSION="$VERSION" -t "$IMAGE:$VERSION" .
docker push "$IMAGE:$VERSION"
# Compose and Unraid users follow :latest: it moves only to the newest stable release.
if [ "$LATEST" = "true" ]; then
docker tag "$IMAGE:$VERSION" "$IMAGE:latest"
docker push "$IMAGE:latest"
fi
echo "Image: $IMAGE:$VERSION$([ "$LATEST" = "true" ] && echo " and :latest")"
- name: Clean up
if: always()
run: |
docker image rm "$IMAGE:$VERSION" "$IMAGE:latest" 2> /dev/null || true
docker logout "$REGISTRY_HOST" || true