Compare commits

...

1 Commits

Author SHA1 Message Date
6d0311f0b1 ci: Release-Workflow absichern (#1181)
All checks were successful
ci / pruefen (push) Successful in 1m47s
- release.yml: eigener Job pruefen (dieselben Prüfungen wie ci.yml); binary läuft erst danach (needs). Der Release wartet
  bewusst nicht auf den CI-Status des Commits: ein späterer Push bricht laufende CI-Läufe ab (v0.1.22 am 23.11.2026).
- Zeitlimits: Job (30 und 20 Minuten), Werkzeugschritte (12 Minuten), apt-get update 180 s, apt-get install 300 s,
  rustup-Abruf 300 s mit Wiederholungen, curl zur Gitea-API mit Zeitlimit. Ein hängender Spiegel bricht ab statt 20 Minuten zu blockieren.
- apt nur, wenn musl-tools, nodejs oder python3-venv fehlen.
- Feste Rust-Toolchain 1.99.1 statt stable (RUST_VERSION in beiden Workflows).
- ci.yml: dieselben Zeitlimits und Toolchain, pip mit Wiederholungen und Zeitlimit.

Lokal geprüft: YAML, bash -n, shellcheck, Installationsschritt mit Attrappen (nichts fehlt, apt hängt, apt klappt, nur python3-venv fehlt,
rustup-Abruf scheitert). Nicht geprüft: ein echter Lauf auf dem Gitea-Runner.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 14:29:41 +01:00
2 changed files with 98 additions and 14 deletions

View File

@ -9,18 +9,33 @@ on:
branches:
- '**'
env:
# Feste Toolchain statt „stable von heute“: die Version, mit der lokal geprüft wurde. Anheben von Hand und mit Test.
RUST_VERSION: '1.99.1'
jobs:
pruefen:
runs-on: nexus
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# Zeitlimits (→ #1181): ein nicht erreichbarer Spiegel hielt am 23.11.2026 den Runner gut 20 Minuten fest.
- name: Werkzeuge installieren
timeout-minutes: 12
run: |
set -eu
SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo"
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq musl-tools python3-venv nodejs
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal -c clippy,rustfmt -t x86_64-unknown-linux-musl
fehlt=""
command -v musl-gcc >/dev/null 2>&1 || fehlt="$fehlt musl-tools"
command -v node >/dev/null 2>&1 || fehlt="$fehlt nodejs"
python3 -c 'import ensurepip, venv' >/dev/null 2>&1 || fehlt="$fehlt python3-venv"
if [ -n "$fehlt" ]; then
timeout 180 $SUDO apt-get -o Acquire::Retries=2 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 update -qq
# shellcheck disable=SC2086
timeout 300 $SUDO apt-get install -y -qq $fehlt
fi
timeout 300 bash -c 'set -o pipefail; curl -sSf --retry 3 --connect-timeout 20 --max-time 120 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "$RUST_VERSION" -c clippy,rustfmt -t x86_64-unknown-linux-musl'
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Format
@ -30,6 +45,7 @@ jobs:
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Rust-Tests
timeout-minutes: 20
run: cargo test --workspace
# Reine Funktionen der Oberfläche (Ortszeit und Tabellen, Markdown der Chat-Antworten), ohne Browser (#1195, A8).
@ -43,7 +59,8 @@ jobs:
for zone in Europe/Berlin America/New_York Australia/Lord_Howe Asia/Kolkata; do TZ=$zone node tests/js/diagramm-zeit.test.mjs; done
- name: SDK-Tests
timeout-minutes: 5
run: |
python3 -m venv .venv
.venv/bin/pip install -q openai
.venv/bin/pip install -q --retries 3 --timeout 30 openai
.venv/bin/python -m unittest discover -s tests/sdk

View File

@ -1,10 +1,16 @@
# Release-Binary (→ #1067): das statische musl-Binary wird hier einmal gebaut und mit SHA-256-Prüfsumme an das
# Gitea-Release gehängt.
# - Push eines Tags `v*`: baut den Code dieses Tags und veröffentlicht.
# - Von Hand (workflow_dispatch) mit Eingabe `tag`: baut den Code dieses vorhandenen Tags (mit dem Workflow des
# - Push eines Tags `v*`: prüft und baut den Code dieses Tags und veröffentlicht.
# - Von Hand (workflow_dispatch) mit Eingabe `tag`: prüft und baut den Code dieses vorhandenen Tags (mit dem Workflow des
# gewählten Branches) und veröffentlicht; so lassen sich ältere Tags nachliefern, ohne sie zu verschieben.
# - Von Hand ohne `tag`: nur bauen, nichts veröffentlichen.
# - Von Hand ohne `tag`: prüfen und bauen, nichts veröffentlichen.
# Bewusst KEIN Auslöser `pull_request` (öffentliches Repository, Runner mit Docker-Socket).
#
# Absicherung (→ #1181, #1224): Der Job `binary` läuft erst, wenn der Job `pruefen` (dieselben Prüfungen wie `ci.yml`) auf
# demselben Commit erfolgreich war. Der Release wartet bewusst nicht auf den Status der CI-Läufe: Ein späterer Push bricht
# einen laufenden CI-Lauf ab (am 23.11.2026 beim Commit von v0.1.22 geschehen), und der Release käme nie durch.
# Alle Netzwerkschritte haben Zeitlimits, und ein Schritt, der hängt, bricht ab, statt den Runner minutenlang festzuhalten
# (am 23.11.2026 hing `apt-get update` gut 20 Minuten, weil Ubuntu-Spiegel nicht antworteten).
name: release
on:
@ -17,9 +23,66 @@ on:
description: 'Vorhandener Tag, der gebaut und veröffentlicht wird (z. B. v0.1.7); leer = nur bauen'
required: false
env:
# Feste Toolchain statt „stable von heute“: die Version, mit der lokal geprüft wurde. Anheben von Hand und mit Test.
RUST_VERSION: '1.99.1'
jobs:
binary:
pruefen:
runs-on: nexus
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Werkzeuge installieren
timeout-minutes: 12
run: |
set -eu
SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo"
fehlt=""
command -v musl-gcc >/dev/null 2>&1 || fehlt="$fehlt musl-tools"
command -v node >/dev/null 2>&1 || fehlt="$fehlt nodejs"
python3 -c 'import ensurepip, venv' >/dev/null 2>&1 || fehlt="$fehlt python3-venv"
if [ -n "$fehlt" ]; then
timeout 180 $SUDO apt-get -o Acquire::Retries=2 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 update -qq
# shellcheck disable=SC2086
timeout 300 $SUDO apt-get install -y -qq $fehlt
fi
timeout 300 bash -c 'set -o pipefail; curl -sSf --retry 3 --connect-timeout 20 --max-time 120 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "$RUST_VERSION" -c clippy,rustfmt -t x86_64-unknown-linux-musl'
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Format
run: cargo fmt --check
- name: clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Rust-Tests
timeout-minutes: 20
run: cargo test --workspace
- name: JS-Tests
run: |
node tests/js/markdown.test.mjs
TZ=Europe/Berlin node tests/js/tabellen.test.mjs
TZ=Europe/Berlin node tests/js/polling.test.mjs
TZ=Europe/Berlin node tests/js/diagramm.test.mjs
TZ=Europe/Berlin node tests/js/verlauf.test.mjs
for zone in Europe/Berlin America/New_York Australia/Lord_Howe Asia/Kolkata; do TZ=$zone node tests/js/diagramm-zeit.test.mjs; done
- name: SDK-Tests
timeout-minutes: 5
run: |
python3 -m venv .venv
.venv/bin/pip install -q --retries 3 --timeout 30 openai
.venv/bin/python -m unittest discover -s tests/sdk
binary:
needs: pruefen
runs-on: nexus
timeout-minutes: 20
steps:
- name: Tag bestimmen
env:
@ -35,11 +98,15 @@ jobs:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Werkzeuge installieren
timeout-minutes: 12
run: |
set -eu
SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo"
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq musl-tools
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal -t x86_64-unknown-linux-musl
if ! command -v musl-gcc >/dev/null 2>&1; then
timeout 180 $SUDO apt-get -o Acquire::Retries=2 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 update -qq
timeout 300 $SUDO apt-get install -y -qq musl-tools
fi
timeout 300 bash -c 'set -o pipefail; curl -sSf --retry 3 --connect-timeout 20 --max-time 120 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "$RUST_VERSION" -t x86_64-unknown-linux-musl'
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Bauen
@ -63,13 +130,13 @@ jobs:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
run: |
ID="$(curl -sf -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])' 2>/dev/null || true)"
ID="$(curl -sf --connect-timeout 20 --max-time 60 -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])' 2>/dev/null || true)"
if [ -z "$ID" ]; then
ID="$(curl -sf -X POST -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
ID="$(curl -sf --connect-timeout 20 --max-time 60 -X POST -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
-d "{\"tag_name\":\"$TAG\",\"name\":\"Nexus ${TAG#v}\",\"body\":\"Statisches musl-Binary, gebaut vom Runner. Prüfsumme in der .sha256-Datei.\"}" \
"$API/releases" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')"
fi
for f in dist/*; do
curl -sf -X POST -H "Authorization: token $TOKEN" -F "attachment=@$f" "$API/releases/$ID/assets?name=$(basename "$f")" >/dev/null
curl -sf --connect-timeout 20 --max-time 300 -X POST -H "Authorization: token $TOKEN" -F "attachment=@$f" "$API/releases/$ID/assets?name=$(basename "$f")" >/dev/null
echo "Angehängt: $(basename "$f")"
done