ci: Gitea Actions für Prüfung und Release-Binary, Runner-Vorlage und Betriebsdoku (#1067)
Some checks failed
ci / pruefen (push) Failing after 1m20s
Some checks failed
ci / pruefen (push) Failing after 1m20s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHhg3bfByVgQ9z7CGCSGc
This commit is contained in:
39
.gitea/workflows/ci.yml
Normal file
39
.gitea/workflows/ci.yml
Normal file
@ -0,0 +1,39 @@
|
||||
# Prüfung bei jedem Push auf einen Branch: Format, clippy, Rust-Tests, SDK-Tests (→ #1067).
|
||||
# Läuft auf dem Runner `nexus-runner` (Label `nexus`, nur für dieses Repository).
|
||||
# Bewusst KEIN Auslöser `pull_request`: Das Repository ist öffentlich, und der Runner hat den Docker-Socket.
|
||||
# Code aus fremden Forks darf dort nicht laufen.
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
pruefen:
|
||||
runs-on: nexus
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Werkzeuge installieren
|
||||
run: |
|
||||
SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo"
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq musl-tools python3-venv
|
||||
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal -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
|
||||
run: cargo test --workspace
|
||||
|
||||
- name: SDK-Tests
|
||||
run: |
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -q openai
|
||||
.venv/bin/python -m unittest discover -s tests/sdk
|
||||
57
.gitea/workflows/release.yml
Normal file
57
.gitea/workflows/release.yml
Normal file
@ -0,0 +1,57 @@
|
||||
# Release-Binary bei einem Tag `v*` (→ #1067): das statische musl-Binary wird hier einmal gebaut und mit
|
||||
# SHA-256-Prüfsumme an das Gitea-Release gehängt. Von Hand ausgelöst (workflow_dispatch) wird nur gebaut, nichts veröffentlicht.
|
||||
# Bewusst KEIN Auslöser `pull_request` (öffentliches Repository, Runner mit Docker-Socket).
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
binary:
|
||||
runs-on: nexus
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Werkzeuge installieren
|
||||
run: |
|
||||
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
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Bauen
|
||||
run: cargo build --release --target x86_64-unknown-linux-musl -p nexus
|
||||
|
||||
- name: Version prüfen und Prüfsumme bilden
|
||||
run: |
|
||||
BIN=target/x86_64-unknown-linux-musl/release/nexus
|
||||
VERSION="$("$BIN" version | awk '{print $2}')"
|
||||
echo "Gebaut: nexus $VERSION"
|
||||
if [ "${GITHUB_REF_TYPE:-}" = "tag" ] && [ "v$VERSION" != "$GITHUB_REF_NAME" ]; then
|
||||
echo "Version im Binary ($VERSION) passt nicht zum Tag ($GITHUB_REF_NAME)" >&2; exit 1
|
||||
fi
|
||||
mkdir -p dist
|
||||
cp "$BIN" "dist/nexus-$VERSION-linux-x86_64-musl"
|
||||
(cd dist && sha256sum "nexus-$VERSION-linux-x86_64-musl" > "nexus-$VERSION-linux-x86_64-musl.sha256" && cat ./*.sha256)
|
||||
|
||||
- name: Release veröffentlichen
|
||||
if: github.ref_type == 'tag'
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||||
run: |
|
||||
TAG="$GITHUB_REF_NAME"
|
||||
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)"
|
||||
if [ -z "$ID" ]; then
|
||||
ID="$(curl -sf -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
|
||||
echo "Angehängt: $(basename "$f")"
|
||||
done
|
||||
Reference in New Issue
Block a user