|
|
|
|
@ -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
|
|
|
|
|
|