Author SHA1 Message Date
DragonSlayer_14 a734edd76c Merge pull request 'Merge dev in testing: Passt Workflows und Dependencies an' (#32) from dev into testing
Testing Build, Publish & Preview Release / Erkenne relevante Code-Änderungen (push) Successful in 10s
Unit-Tests / Unit-Tests (pull_request) Skipped
Auto-PR (Testing → Main) / Erstelle automatisch PR von testing nach main (push) Successful in 16s
Security Scans / Trivy & OSV-Scanner (push) Successful in 40s
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 28s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 53s
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Successful in 11m15s
TruffleHog Secret Scan / TruffleHog (push) Successful in 10s
Reviewed-on: #32
2026-09-13 15:09:03 +00:00
Gitea-Bot 64420cc224 Chore: Erhöht Patch-Version auf 1.0.5 für Promotion nach testing
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 57s
Security Scans / Trivy & OSV-Scanner (push) Successful in 56s
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 30s
TruffleHog Secret Scan / TruffleHog (push) Successful in 30s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 4m34s
Unit-Tests / Unit-Tests (pull_request) Successful in 3m1s
2026-09-13 14:45:19 +00:00
DragonSlayer_14 bdd26a9189 Merge pull request 'chore(deps): update cargo dependencies' (#30) from renovate/cargo-dependencies into dev
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 24s
Security Scans / Trivy & OSV-Scanner (push) Successful in 36s
Auto Patch-Version-Bump (Dev → Testing PR) / Erkenne relevante Änderungen im PR (pull_request) Successful in 12s
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 30s
Auto Patch-Version-Bump (Dev → Testing PR) / Patch-Version erhöhen & auf Dev pushen (pull_request) Successful in 16s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 53s
Unit-Tests / Unit-Tests (pull_request) Successful in 3m9s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 4m14s
Reviewed-on: #30
Reviewed-by: dragonslayer14@murena.io <4+dragonslayer_14@noreply.localhost>
2026-09-13 14:44:12 +00:00
DragonSlayer_14 84a64f1bde Merge pull request 'chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.83.0' (#31) from renovate/gitea-actions into dev
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 21s
Security Scans / Trivy & OSV-Scanner (push) Successful in 31s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 1m25s
Reviewed-on: #31
Reviewed-by: dragonslayer14@murena.io <4+dragonslayer_14@noreply.localhost>
2026-09-13 14:43:14 +00:00
Renovate-Bot 4d2e92f6bb chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.83.0
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 18s
Unit-Tests / Unit-Tests (pull_request) Skipped
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 12s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 18s
2026-09-13 14:01:59 +00:00
Renovate-Bot eb5519be87 chore(deps): update cargo dependencies
Unit-Tests / Unit-Tests (pull_request) Skipped
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 30s
TruffleHog Secret Scan / TruffleHog (push) Successful in 29s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 46s
2026-09-13 14:01:55 +00:00
DragonSlayer_14andClaude Sonnet 5 f7f5290404 Feat: Fügt automatischen PR-Workflow für Testing→Main hinzu
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 28s
Security Scans / Trivy & OSV-Scanner (push) Successful in 56s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 1m32s
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjPGeW28DpjnMkuvLSRTKv
2026-09-13 14:26:01 +02:00
DragonSlayer_14andClaude Sonnet 5 dffa74f47c Feat: Fügt automatischen Patch-Version-Bump für Dev→Testing-PRs hinzu
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 29s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 3m28s
Security Scans / Trivy & OSV-Scanner (push) Successful in 52s
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DrWxHCG7URf4FEy8Hja23f
2026-09-13 14:04:51 +02:00
DragonSlayer_14 c455aa894e Merge pull request 'Merge dev in testing: Passt Workflows und README an' (#28) from dev into testing
TruffleHog Secret Scan / TruffleHog (push) Successful in 32s
Security Scans / Trivy & OSV-Scanner (push) Successful in 53s
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 30s
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Successful in 15m22s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 53s
Unit-Tests / Unit-Tests (pull_request) Skipped
Testing Build, Publish & Preview Release / Erkenne relevante Code-Änderungen (push) Successful in 14s
Reviewed-on: #28
2026-09-13 10:16:11 +00:00
DragonSlayer_14andClaude Sonnet 5 513eae640f Feat: Baut Pakete nur bei tatsächlichen Code-Änderungen
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 30s
Security Scans / Trivy & OSV-Scanner (push) Successful in 1m33s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 3m38s
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 17s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 26s
Unit-Tests / Unit-Tests (pull_request) Successful in 38s
Fügt einen vorgeschalteten detect-changes-Job ein, der mittels
dorny/paths-filter@v4 prüft, ob sich Programmcode (src/, Cargo.toml,
Cargo.lock, scripts/, .cargo/ bzw. die jeweilige Workflow-Datei selbst)
geändert hat. Der Build-/Publish-/Release-Job wird nur noch ausgeführt,
wenn das der Fall ist; bei reinen Config- oder Workflow-Änderungen
schließt der Workflow erfolgreich ohne Build/Release ab.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TcFzG54jW33nvp1TawCZJV
2026-09-13 11:39:21 +02:00
DragonSlayer_14andClaude Sonnet 5 475f0f9903 Fix: Verschiebt allowCustomCrateRegistries in die globale Renovate-Config
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 29s
Security Scans / Trivy & OSV-Scanner (push) Successful in 53s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 2m12s
Die Option ist repo-only nicht erlaubt und wurde in der Renovate-Workflow-
Umgebung (RENOVATE_ALLOW_CUSTOM_CRATE_REGISTRIES) gesetzt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0156cWd2mGWNQU1kBbBPWpD7
2026-09-13 01:18:13 +02:00
Gitea-Bot db42d73adb Style: Automatische Formatierung & Clippy-Fixes
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 18s
Security Scans / Trivy & OSV-Scanner (push) Successful in 29s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 1m55s
2026-09-12 22:22:15 +00:00
Gitea-Bot 074d5a7ff2 Style: Automatische Formatierung & Clippy-Fixes
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 18s
Security Scans / Trivy & OSV-Scanner (push) Successful in 30s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 1m5s
2026-09-12 22:21:10 +00:00
DragonSlayer_14 5ac35bb370 Feat: Fügt code-quality-Workflow für automatische Formatierung und fixes hinzu
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 17s
Security Scans / Trivy & OSV-Scanner (push) Successful in 28s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 1m3s
- Introduced `code-quality.yaml` to automate Rust code formatting and Clippy fixes in the `dev` branch.
- Updated `jsonSchemas.xml` to include schema paths for new Gitea workflows.
2026-09-13 00:20:01 +02:00
DragonSlayer_14 4b5de248cd Merge pull request 'chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.82.3' (#27) from renovate/gitea-actions into dev
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 11s
Security Scans / Trivy & OSV-Scanner (push) Successful in 17s
Reviewed-on: #27
2026-09-12 11:08:07 +00:00
Renovate-Bot 0f01f53391 chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.82.3
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
Unit-Tests / Unit-Tests (pull_request) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 15s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 26s
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 12s
2026-09-12 09:00:36 +00:00
DragonSlayer_14 64a0aaa772 Fix: Aktiviert allowCustomCrateRegistries in renovate.json
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
TruffleHog Secret Scan / TruffleHog (push) Successful in 12s
Security Scans / Trivy & OSV-Scanner (push) Successful in 18s
2026-09-11 23:22:32 +02:00
DragonSlayer_14 d247777667 Docs: Entfernt unnötige Security-Scan-Badges aus README.md 2026-09-11 23:20:57 +02:00
DragonSlayer_14 9507bb1cca Merge pull request 'Merge testing in main: Release 1.0.4' (#26) from testing into main
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Skipped
Security Scans / Trivy & OSV-Scanner (push) Successful in 42s
Main Release & Publish / Build, Publish Packages (Stable) & Create Release (push) Successful in 12m31s
TruffleHog Secret Scan / TruffleHog (push) Successful in 13s
Reviewed-on: #26
2026-09-11 20:52:01 +00:00
18 changed files with 545 additions and 103 deletions
+54
View File
@@ -0,0 +1,54 @@
name: Code Quality (Auto-Format & Clippy-Fix)
on:
push:
branches:
- dev
workflow_dispatch:
jobs:
fix:
name: Formatierung & Clippy automatisch beheben
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
ref: ${{ gitea.ref_name || github.ref_name }}
token: ${{ secrets.PACKAGE_TOKEN || secrets.RELEASE_TOKEN || secrets.PUBLISH_TOKEN || secrets.API_TOKEN || secrets.PAT_TOKEN || secrets.CUSTOM_TOKEN || secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN || github.token }}
- name: Install Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v2
with:
toolchain: stable
components: clippy, rustfmt
cache: false
- name: Cache Cargo-Abhängigkeiten & Build-Artefakte
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Formatierung automatisch beheben
run: cargo fmt
- name: Clippy-Fixes automatisch anwenden
run: cargo clippy --fix --allow-dirty --allow-staged --all-targets
- name: Änderungen committen & pushen
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name "Gitea-Bot"
git config user.email "no-reply@creativedragonslayer.de"
git add -A
git commit -m "Style: Automatische Formatierung & Clippy-Fixes"
git push origin HEAD:${{ gitea.ref_name || github.ref_name }}
else
echo "Keine Formatierungs- oder Clippy-Änderungen."
fi
+25
View File
@@ -6,8 +6,33 @@ on:
- main
jobs:
detect-changes:
name: Erkenne relevante Code-Änderungen
runs-on: ubuntu-latest
outputs:
code_changed: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout Repository
uses: actions/checkout@v7
- name: Prüfe auf Änderungen am Programmcode
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
code:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'scripts/**'
- '.cargo/**'
- 'Dockerfile'
- '.gitea/workflows/main.yaml'
release-and-publish:
name: Build, Publish Packages (Stable) & Create Release
needs: detect-changes
if: needs.detect-changes.outputs.code_changed == 'true'
runs-on: ubuntu-latest
env:
CARGO_BINSTALL_VERSION: "1.23.0"
+2 -1
View File
@@ -9,7 +9,7 @@ jobs:
renovate:
name: Dependency-Updates prüfen & Pull Requests erstellen
runs-on: ubuntu-latest
container: ghcr.io/renovatebot/renovate:44.82.0
container: ghcr.io/renovatebot/renovate:44.83.0
steps:
- name: Renovate ausführen
run: renovate
@@ -19,6 +19,7 @@ jobs:
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
RENOVATE_REPOSITORIES: ${{ gitea.repository || github.repository }}
RENOVATE_AUTODISCOVER: "false"
RENOVATE_ALLOW_CUSTOM_CRATE_REGISTRIES: "true"
RENOVATE_GIT_AUTHOR: "Renovate Bot <renovate-bot@creativedragonslayer.de>"
RENOVATE_HOST_RULES: >-
[{"hostType":"cargo","matchHost":"${{ gitea.server_url || github.server_url }}","token":"${{ secrets.RENOVATE_TOKEN }}"}]
+111
View File
@@ -0,0 +1,111 @@
name: Auto-PR (Testing → Main)
on:
push:
branches:
- testing
jobs:
create-pr:
name: Erstelle automatisch PR von testing nach main
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Prüfe auf bereits offenen PR nach main
id: check_pr
env:
GITEA_URL: ${{ gitea.server_url || github.server_url }}
REPO: ${{ gitea.repository || github.repository }}
TOKEN: ${{ secrets.PACKAGE_TOKEN || secrets.RELEASE_TOKEN || secrets.PUBLISH_TOKEN || secrets.API_TOKEN || secrets.PAT_TOKEN || secrets.CUSTOM_TOKEN || secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN || github.token }}
run: |
OPEN_PRS=$(curl -s -H "Authorization: token ${TOKEN}" "${GITEA_URL}/api/v1/repos/${REPO}/pulls?state=open&limit=50")
EXISTS=$(echo "$OPEN_PRS" | jq -r '[.[] | select(.base.ref == "main" and .head.ref == "testing")] | length')
echo "Bereits offene testing→main PRs: ${EXISTS}"
echo "exists=${EXISTS}" >> "$GITHUB_OUTPUT"
- name: Ermittle Versionen auf main & testing
id: versions
if: steps.check_pr.outputs.exists == '0'
run: |
git fetch origin main
MAIN_VERSION="$(git show origin/main:Cargo.toml | sed -n 's/^version = "\(.*\)"/\1/p' | head -n1)"
TESTING_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
echo "Version auf main: ${MAIN_VERSION} / Version auf testing: ${TESTING_VERSION}"
echo "main_version=${MAIN_VERSION}" >> "$GITHUB_OUTPUT"
echo "testing_version=${TESTING_VERSION}" >> "$GITHUB_OUTPUT"
- name: Ermittle geänderte Kategorien (main...testing)
id: categories
if: steps.check_pr.outputs.exists == '0' && steps.versions.outputs.main_version == steps.versions.outputs.testing_version
run: |
CHANGED_FILES="$(git diff --name-only origin/main...HEAD)"
echo "Geänderte Dateien main...testing:"
echo "$CHANGED_FILES"
WORKFLOWS="false"
CONFIG="false"
DOCS="false"
if echo "$CHANGED_FILES" | grep -q '^\.gitea/workflows/'; then
WORKFLOWS="true"
fi
if echo "$CHANGED_FILES" | grep -qE '^(renovate\.json|qodana\.yaml|Cargo\.toml|Cargo\.lock|\.cargo/)'; then
CONFIG="true"
fi
if echo "$CHANGED_FILES" | grep -qE '(^|/)[^/]+\.md$|^LICENSE$'; then
DOCS="true"
fi
echo "workflows=${WORKFLOWS}" >> "$GITHUB_OUTPUT"
echo "config=${CONFIG}" >> "$GITHUB_OUTPUT"
echo "docs=${DOCS}" >> "$GITHUB_OUTPUT"
- name: Bestimme PR-Titel
id: title
if: steps.check_pr.outputs.exists == '0'
run: |
if [ "${{ steps.versions.outputs.main_version }}" != "${{ steps.versions.outputs.testing_version }}" ]; then
TITLE="Merge testing in main: Release ${{ steps.versions.outputs.testing_version }}"
else
PARTS=()
[ "${{ steps.categories.outputs.workflows }}" = "true" ] && PARTS+=("Workflows")
[ "${{ steps.categories.outputs.config }}" = "true" ] && PARTS+=("Konfigurationen")
[ "${{ steps.categories.outputs.docs }}" = "true" ] && PARTS+=("Dokumentation")
if [ ${#PARTS[@]} -eq 0 ]; then
TITLE="Merge testing in main"
else
JOINED=""
for PART in "${PARTS[@]}"; do
if [ -z "$JOINED" ]; then
JOINED="$PART"
else
JOINED="${JOINED} & ${PART}"
fi
done
TITLE="Merge testing in main: ${JOINED} aktualisiert"
fi
fi
echo "Ermittelter PR-Titel: ${TITLE}"
echo "title=${TITLE}" >> "$GITHUB_OUTPUT"
- name: Erstelle PR (testing -> main)
if: steps.check_pr.outputs.exists == '0'
env:
GITEA_URL: ${{ gitea.server_url || github.server_url }}
REPO: ${{ gitea.repository || github.repository }}
TOKEN: ${{ secrets.PACKAGE_TOKEN || secrets.RELEASE_TOKEN || secrets.PUBLISH_TOKEN || secrets.API_TOKEN || secrets.PAT_TOKEN || secrets.CUSTOM_TOKEN || secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN || github.token }}
TITLE: ${{ steps.title.outputs.title }}
run: |
PAYLOAD=$(jq -n --arg title "$TITLE" --arg head "testing" --arg base "main" \
'{title: $title, head: $head, base: $base}')
curl -f -s -S -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
"${GITEA_URL}/api/v1/repos/${REPO}/pulls"
echo "PR erstellt: ${TITLE}"
+25
View File
@@ -6,8 +6,33 @@ on:
- testing
jobs:
detect-changes:
name: Erkenne relevante Code-Änderungen
runs-on: ubuntu-latest
outputs:
code_changed: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout Repository
uses: actions/checkout@v7
- name: Prüfe auf Änderungen am Programmcode
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
code:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'scripts/**'
- '.cargo/**'
- 'Dockerfile'
- '.gitea/workflows/testing.yaml'
build-and-publish:
name: Build, Publish Packages (Testing) & Create Preview Release
needs: detect-changes
if: needs.detect-changes.outputs.code_changed == 'true'
runs-on: ubuntu-latest
env:
CARGO_BINSTALL_VERSION: "1.23.0"
+85
View File
@@ -0,0 +1,85 @@
name: Auto Patch-Version-Bump (Dev → Testing PR)
on:
pull_request:
types: [opened]
branches:
- testing
jobs:
detect-changes:
name: Erkenne relevante Änderungen im PR
runs-on: ubuntu-latest
if: ${{ (gitea.head_ref || github.head_ref) == 'dev' }}
outputs:
code_changed: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout Dev-Branch (PR-Head)
uses: actions/checkout@v7
with:
ref: ${{ gitea.head_ref || github.head_ref }}
fetch-depth: 0
- name: Prüfe auf Änderungen an Cargo.toml, Cargo.lock, src/ oder Dockerfile
uses: dorny/paths-filter@v4
id: filter
with:
base: ${{ gitea.base_ref || github.base_ref }}
filters: |
code:
- 'Cargo.toml'
- 'Cargo.lock'
- 'src/**'
- 'Dockerfile'
bump-version:
name: Patch-Version erhöhen & auf Dev pushen
needs: detect-changes
if: needs.detect-changes.outputs.code_changed == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Dev-Branch (PR-Head)
uses: actions/checkout@v7
with:
ref: ${{ gitea.head_ref || github.head_ref }}
fetch-depth: 0
token: ${{ secrets.PACKAGE_TOKEN || secrets.RELEASE_TOKEN || secrets.PUBLISH_TOKEN || secrets.API_TOKEN || secrets.PAT_TOKEN || secrets.CUSTOM_TOKEN || secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN || github.token }}
- name: Ermittle Cargo-Version auf testing & dev
id: versions
run: |
git fetch origin testing --depth=1
TESTING_VERSION="$(git show origin/testing:Cargo.toml | sed -n 's/^version = "\(.*\)"/\1/p' | head -n1)"
DEV_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
echo "Version auf testing: ${TESTING_VERSION} / Version auf dev: ${DEV_VERSION}"
echo "testing_version=${TESTING_VERSION}" >> "$GITHUB_OUTPUT"
echo "dev_version=${DEV_VERSION}" >> "$GITHUB_OUTPUT"
- name: Patch-Version um 1 erhöhen (Cargo.toml & Cargo.lock)
if: steps.versions.outputs.testing_version == steps.versions.outputs.dev_version
run: |
VERSION="${{ steps.versions.outputs.dev_version }}"
MAJOR="$(echo "$VERSION" | cut -d. -f1)"
MINOR="$(echo "$VERSION" | cut -d. -f2)"
PATCH="$(echo "$VERSION" | cut -d. -f3)"
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
echo "Erhöhe Version: ${VERSION} -> ${NEW_VERSION}"
sed -i "0,/^version = \"${VERSION}\"/s//version = \"${NEW_VERSION}\"/" Cargo.toml
PACKAGE_NAME="$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
awk -v new="$NEW_VERSION" -v pkg="$PACKAGE_NAME" '
found_name && /^version = "/ {
print "version = \"" new "\""
found_name = 0
next
}
$0 == "name = \"" pkg "\"" { found_name = 1 }
{ print }
' Cargo.lock > Cargo.lock.tmp && mv Cargo.lock.tmp Cargo.lock
git config user.name "Gitea-Bot"
git config user.email "no-reply@creativedragonslayer.de"
git add Cargo.toml Cargo.lock
git commit -m "Chore: Erhöht Patch-Version auf ${NEW_VERSION} für Promotion nach testing"
git push origin HEAD:${{ gitea.head_ref || github.head_ref }}
+3
View File
@@ -26,6 +26,9 @@
<Item>
<option name="path" value=".gitea/workflows/trufflehog-scan.yaml" />
</Item>
<Item>
<option name="path" value=".gitea/workflows/code-quality.yaml" />
</Item>
</list>
</option>
</SchemaInfo>
Generated
+9 -9
View File
@@ -219,9 +219,9 @@ dependencies = [
[[package]]
name = "config-ctdra"
version = "1.0.4"
version = "1.0.6"
source = "sparse+https://gitea.creative-dragonslayer.de/api/packages/Rust-Crates/cargo/"
checksum = "f7b3e25b95d4cdb6fc856f2af0106d4558b882c2f10798db46181e51827749a4"
checksum = "83eb23d473fce79e8234ad66baf210289b5c9e4c4a587273b4df7deceb73f416"
dependencies = [
"confy",
"program-ctdra",
@@ -322,7 +322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc 0.2.189",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -833,9 +833,9 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
[[package]]
name = "logger-ctdra"
version = "1.0.3"
version = "1.0.5"
source = "sparse+https://gitea.creative-dragonslayer.de/api/packages/Rust-Crates/cargo/"
checksum = "af9ea239d80163c80b12cae5f74c0c2824199921dedafba74678e96a11a8b15e"
checksum = "ce612b7d943b77060fa36eab0c85782e650c4cf023e9d560bef791951ed92cad"
dependencies = [
"program-ctdra",
"time",
@@ -872,7 +872,7 @@ dependencies = [
[[package]]
name = "mirror-package"
version = "1.0.4"
version = "1.0.5"
dependencies = [
"anyhow",
"clap",
@@ -1041,7 +1041,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -1220,7 +1220,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -1898,7 +1898,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "mirror-package"
version = "1.0.4"
version = "1.0.5"
edition = "2024"
authors = ['DragonSlayer_14']
readme = "README.md"
-2
View File
@@ -2,8 +2,6 @@
[![Main Release & Publish](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions/workflows/main.yaml/badge.svg?branch=main)](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=main.yaml)
[![Testing Build, Publish & Preview Release](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions/workflows/testing.yaml/badge.svg?branch=testing)](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=testing.yaml)
[![Security Scans](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions/workflows/security-scan.yaml/badge.svg?branch=main)](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=security-scan.yaml)
[![TruffleHog Secret Scan](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions/workflows/trufflehog-scan.yaml/badge.svg?branch=main)](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=trufflehog-scan.yaml)
Automatisiertes Werkzeug zum Extrahieren, Herunterladen und Spiegeln vorkompilierter Linux-Pakete aus GitHub-Releases in eine selbstgehostete Gitea- / Forgejo-Paket-Registry.
+15 -4
View File
@@ -59,7 +59,11 @@ impl AppConfig {
/// Fügt ein Repository zur Konfiguration hinzu oder aktualisiert ein bestehendes.
pub fn add_or_update_repo(&mut self, mut repo: RepoConfig) {
repo.name = Self::normalize_repo_name(&repo.name);
if let Some(existing) = self.repositories.iter_mut().find(|r| Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&repo.name)) {
if let Some(existing) = self
.repositories
.iter_mut()
.find(|r| Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&repo.name))
{
existing.name = repo.name;
existing.include_prereleases = repo.include_prereleases;
} else {
@@ -71,20 +75,27 @@ impl AppConfig {
pub fn remove_repo(&mut self, repo_name: &str) -> bool {
let normalized = Self::normalize_repo_name(repo_name);
let before_len = self.repositories.len();
self.repositories.retain(|r| !Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&normalized));
self.repositories
.retain(|r| !Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&normalized));
self.repositories.len() < before_len
}
/// Sucht ein Repository anhand des Namens.
pub fn find_repo(&self, repo_name: &str) -> Option<&RepoConfig> {
let normalized = Self::normalize_repo_name(repo_name);
self.repositories.iter().find(|r| Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&normalized))
self.repositories
.iter()
.find(|r| Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&normalized))
}
/// Aktualisiert den zuletzt synchronisierten Tag für ein bestimmtes Repository.
pub fn update_last_synced_tag(&mut self, repo_name: &str, tag: String) {
let normalized = Self::normalize_repo_name(repo_name);
if let Some(repo) = self.repositories.iter_mut().find(|r| Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&normalized)) {
if let Some(repo) = self
.repositories
.iter_mut()
.find(|r| Self::normalize_repo_name(&r.name).eq_ignore_ascii_case(&normalized))
{
repo.last_synced_tag = Some(tag);
}
}
+26 -7
View File
@@ -1,5 +1,5 @@
use crate::github::PackageType;
use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use std::path::Path;
use tokio::fs::File;
@@ -12,7 +12,11 @@ pub struct GiteaConfig {
}
impl GiteaConfig {
pub fn new(base_url: impl Into<String>, token: impl Into<String>, owner: impl Into<String>) -> Self {
pub fn new(
base_url: impl Into<String>,
token: impl Into<String>,
owner: impl Into<String>,
) -> Self {
let mut base_url = base_url.into();
while base_url.ends_with('/') {
base_url.pop();
@@ -44,17 +48,29 @@ pub fn get_target_upload_urls(
match pkg_type {
PackageType::Debian => {
if prerelease {
vec![format!("{}/api/packages/{}/debian/pool/testing/main/upload", base, owner)]
vec![format!(
"{}/api/packages/{}/debian/pool/testing/main/upload",
base, owner
)]
} else {
vec![
format!("{}/api/packages/{}/debian/pool/stable/main/upload", base, owner),
format!("{}/api/packages/{}/debian/pool/testing/main/upload", base, owner),
format!(
"{}/api/packages/{}/debian/pool/stable/main/upload",
base, owner
),
format!(
"{}/api/packages/{}/debian/pool/testing/main/upload",
base, owner
),
]
}
}
PackageType::Rpm => {
if prerelease {
vec![format!("{}/api/packages/{}/rpm/testing/upload", base, owner)]
vec![format!(
"{}/api/packages/{}/rpm/testing/upload",
base, owner
)]
} else {
vec![format!("{}/api/packages/{}/rpm/stable/upload", base, owner)]
}
@@ -82,7 +98,10 @@ impl GiteaClient {
let mut headers = reqwest::header::HeaderMap::new();
headers.insert(
reqwest::header::USER_AGENT,
reqwest::header::HeaderValue::from_static(concat!("mirror-package/", env!("CARGO_PKG_VERSION"))),
reqwest::header::HeaderValue::from_static(concat!(
"mirror-package/",
env!("CARGO_PKG_VERSION")
)),
);
let client = reqwest::Client::builder()
+14 -7
View File
@@ -91,7 +91,10 @@ impl GitHubClient {
let mut headers = reqwest::header::HeaderMap::new();
headers.insert(
reqwest::header::USER_AGENT,
reqwest::header::HeaderValue::from_static(concat!("mirror-package/", env!("CARGO_PKG_VERSION"))),
reqwest::header::HeaderValue::from_static(concat!(
"mirror-package/",
env!("CARGO_PKG_VERSION")
)),
);
headers.insert(
reqwest::header::ACCEPT,
@@ -111,7 +114,6 @@ impl GitHubClient {
self.token.as_deref()
}
/// Ruft Releases für ein angegebenes Repository ab (Format "owner/repo").
///
/// Wenn `history` false ist, werden nur die neuesten Releases abgerufen.
@@ -139,7 +141,10 @@ impl GitHubClient {
req = req.bearer_auth(token);
}
let resp = req.send().await.with_context(|| format!("Failed to send request to {}", url))?;
let resp = req
.send()
.await
.with_context(|| format!("Failed to send request to {}", url))?;
let status = resp.status();
if !status.is_success() {
@@ -153,10 +158,12 @@ impl GitHubClient {
);
}
let raw_releases: Vec<GhApiRelease> = resp
.json()
.await
.with_context(|| format!("Failed to parse GitHub releases JSON for {}/{}", owner, name))?;
let raw_releases: Vec<GhApiRelease> = resp.json().await.with_context(|| {
format!(
"Failed to parse GitHub releases JSON for {}/{}",
owner, name
)
})?;
if raw_releases.is_empty() {
break;
+59 -15
View File
@@ -1,11 +1,11 @@
use anyhow::Result;
use clap::Parser;
use logger_ctdra::{log, set_log_level, LogLevel};
use logger_ctdra::{LogLevel, log, set_log_level};
use mirror_package::cli::{Cli, Commands, ConfigAction};
use mirror_package::config::{
get_config_file_path, init_config_path, load_config, modify_config, AppConfig, RepoConfig,
AppConfig, RepoConfig, get_config_file_path, init_config_path, load_config, modify_config,
};
use mirror_package::pipeline::{sync_single_repository, SyncOptions, SyncReport};
use mirror_package::pipeline::{SyncOptions, SyncReport, sync_single_repository};
#[tokio::main]
async fn main() -> Result<()> {
@@ -65,7 +65,9 @@ async fn main() -> Result<()> {
let mut report = SyncReport::default();
for repo in repos_to_sync {
if let Err(e) = sync_single_repository(&repo, &app_config, &options, &mut report).await {
if let Err(e) =
sync_single_repository(&repo, &app_config, &options, &mut report).await
{
log(
"sync",
&format!("Failed to sync repository '{}': {:#}", repo.name, e),
@@ -128,23 +130,38 @@ async fn main() -> Result<()> {
log(
"config",
&format!("Repository '{}' removed from configuration.", normalized_name),
&format!(
"Repository '{}' removed from configuration.",
normalized_name
),
LogLevel::Info,
);
}
Commands::List => {
println!("Configured repositories (Config file: {:?}):", get_config_file_path());
println!(
"Configured repositories (Config file: {:?}):",
get_config_file_path()
);
if app_config.repositories.is_empty() {
println!(" (None configured yet. Use 'mirror-package add <owner/repo>' to add one.)");
println!(
" (None configured yet. Use 'mirror-package add <owner/repo>' to add one.)"
);
} else {
println!("{:<40} {:<15} {:<20}", "REPOSITORY", "PRE-RELEASES", "LAST SYNCED TAG");
println!(
"{:<40} {:<15} {:<20}",
"REPOSITORY", "PRE-RELEASES", "LAST SYNCED TAG"
);
println!("{:-<40} {:-<15} {:-<20}", "", "", "");
for repo in &app_config.repositories {
println!(
"{:<40} {:<15} {:<20}",
repo.name,
if repo.include_prereleases { "yes" } else { "no" },
if repo.include_prereleases {
"yes"
} else {
"no"
},
repo.last_synced_tag.as_deref().unwrap_or("-")
);
}
@@ -154,17 +171,40 @@ async fn main() -> Result<()> {
Commands::Config(config_args) => match config_args.action {
None | Some(ConfigAction::Show) => {
println!("Configuration location: {:?}", get_config_file_path());
println!("Gitea URL: {}", app_config.gitea_url.as_deref().unwrap_or("(not configured)"));
println!("Registry Owner: {}", app_config.registry_owner.as_deref().unwrap_or("(not configured)"));
println!(
"Gitea URL: {}",
app_config
.gitea_url
.as_deref()
.unwrap_or("(not configured)")
);
println!(
"Registry Owner: {}",
app_config
.registry_owner
.as_deref()
.unwrap_or("(not configured)")
);
println!(
"Gitea Token: {}",
if app_config.gitea_token.is_some() { "******** (set)" } else { "(not configured)" }
if app_config.gitea_token.is_some() {
"******** (set)"
} else {
"(not configured)"
}
);
println!(
"GitHub Token: {}",
if app_config.github_token.is_some() { "******** (set)" } else { "(not configured, public access only)" }
if app_config.github_token.is_some() {
"******** (set)"
} else {
"(not configured, public access only)"
}
);
println!(
"Repositories: {} configured",
app_config.repositories.len()
);
println!("Repositories: {} configured", app_config.repositories.len());
}
Some(ConfigAction::Set {
@@ -188,7 +228,11 @@ async fn main() -> Result<()> {
}
})?;
log("config", "Configuration successfully updated.", LogLevel::Info);
log(
"config",
"Configuration successfully updated.",
LogLevel::Info,
);
}
},
}
+39 -26
View File
@@ -1,11 +1,11 @@
use crate::config::{modify_config, AppConfig, RepoConfig};
use crate::gitea::{get_target_upload_urls, GiteaClient, GiteaConfig, UploadStatus};
use crate::config::{AppConfig, RepoConfig, modify_config};
use crate::gitea::{GiteaClient, GiteaConfig, UploadStatus, get_target_upload_urls};
use crate::github::GitHubClient;
use anyhow::{bail, Context, Result};
use logger_ctdra::{log, LogLevel};
use anyhow::{Context, Result, bail};
use logger_ctdra::{LogLevel, log};
use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
use tokio::fs::{remove_file, File};
use tokio::fs::{File, remove_file};
use tokio::io::AsyncWriteExt;
/// Zusammenfassende Statistiken eines Synchronisationsvorgangs.
@@ -52,7 +52,9 @@ pub async fn sync_single_repository(
let gitea_token = app_config.gitea_token.as_deref().unwrap_or_default();
let registry_owner = app_config.registry_owner.as_deref().unwrap_or_default();
if !options.dry_run && (gitea_url.is_empty() || gitea_token.is_empty() || registry_owner.is_empty()) {
if !options.dry_run
&& (gitea_url.is_empty() || gitea_token.is_empty() || registry_owner.is_empty())
{
bail!(
"Missing Gitea configuration. Ensure --gitea-url, --gitea-token, and --registry-owner are provided or configured."
);
@@ -61,12 +63,8 @@ pub async fn sync_single_repository(
let github_client = GitHubClient::new(app_config.github_token.clone())
.context("Failed to initialize GitHub client")?;
let gitea_client = GiteaClient::new(GiteaConfig::new(
gitea_url,
gitea_token,
registry_owner,
))
.context("Failed to initialize Gitea client")?;
let gitea_client = GiteaClient::new(GiteaConfig::new(gitea_url, gitea_token, registry_owner))
.context("Failed to initialize Gitea client")?;
let releases = github_client
.fetch_releases(repo_name, options.history, include_prereleases)
@@ -97,7 +95,11 @@ pub async fn sync_single_repository(
for release in &releases {
report.releases_processed += 1;
let release_type_str = if release.prerelease { "pre-release" } else { "stable release" };
let release_type_str = if release.prerelease {
"pre-release"
} else {
"stable release"
};
log(
"sync",
@@ -156,9 +158,10 @@ pub async fn sync_single_repository(
}
// Asset in temporäre Datei herunterladen
let temp_file_path = download_to_temp_file(&github_client, &asset.download_url, &asset.name)
.await
.with_context(|| format!("Failed to download asset '{}'", asset.name))?;
let temp_file_path =
download_to_temp_file(&github_client, &asset.download_url, &asset.name)
.await
.with_context(|| format!("Failed to download asset '{}'", asset.name))?;
// Asset auf alle Ziel-Distributions-URLs hochladen
for url in &target_urls {
@@ -168,7 +171,10 @@ pub async fn sync_single_repository(
LogLevel::Debug,
);
match gitea_client.upload_file(&temp_file_path, url, options.dry_run).await {
match gitea_client
.upload_file(&temp_file_path, url, options.dry_run)
.await
{
Ok(UploadStatus::Uploaded) => {
log(
"upload",
@@ -220,13 +226,13 @@ pub async fn sync_single_repository(
}
// Zuletzt synchronisierten Tag persistieren, wenn kein Dry-Run
if !options.dry_run {
if let Some(tag) = latest_synced_tag {
let name_copy = repo_name.to_string();
let _ = modify_config(move |cfg| {
cfg.update_last_synced_tag(&name_copy, tag);
});
}
if !options.dry_run
&& let Some(tag) = latest_synced_tag
{
let name_copy = repo_name.to_string();
let _ = modify_config(move |cfg| {
cfg.update_last_synced_tag(&name_copy, tag);
});
}
report.repositories_processed += 1;
@@ -254,7 +260,10 @@ async fn download_to_temp_file(
log(
"download",
&format!("Downloading '{}' to temporary path {:?}...", filename, temp_path),
&format!(
"Downloading '{}' to temporary path {:?}...",
filename, temp_path
),
LogLevel::Debug,
);
@@ -263,7 +272,11 @@ async fn download_to_temp_file(
.await
.with_context(|| format!("Failed to create temp file {:?}", temp_path))?;
while let Some(chunk) = response.chunk().await.context("Error reading download stream")? {
while let Some(chunk) = response
.chunk()
.await
.context("Error reading download stream")?
{
file.write_all(&chunk)
.await
.context("Error writing chunk to temp file")?;
+10 -9
View File
@@ -1,4 +1,3 @@
/// Sanitizes a string by removing surrounding quotes (single or double).
///
/// # Arguments
@@ -12,7 +11,10 @@ pub fn sanitize_string(input: &str) -> String {
let trimmed = input.trim();
if let Some(stripped) = trimmed.strip_prefix('"').and_then(|s| s.strip_suffix('"')) {
stripped.to_string()
} else if let Some(stripped) = trimmed.strip_prefix('\'').and_then(|s| s.strip_suffix('\'')) {
} else if let Some(stripped) = trimmed
.strip_prefix('\'')
.and_then(|s| s.strip_suffix('\''))
{
stripped.to_string()
} else {
trimmed.to_string()
@@ -25,7 +27,7 @@ pub fn sanitize_string(input: &str) -> String {
///
/// * `env_vars` - A reference to a mutable map of environment variables.
pub fn sanitize_env_vars(env_vars: &mut std::collections::HashMap<String, String>) {
for (_key, value) in env_vars.iter_mut() {
for value in env_vars.values_mut() {
*value = sanitize_string(value);
}
}
@@ -35,15 +37,14 @@ pub fn sanitize_env_vars(env_vars: &mut std::collections::HashMap<String, String
/// und umgebende Schrägstriche entfernt werden.
pub fn clean_repo_input(input: &str) -> &str {
let mut trimmed = input.trim();
if (trimmed.starts_with('"') && trimmed.ends_with('"'))
|| (trimmed.starts_with('\'') && trimmed.ends_with('\''))
if ((trimmed.starts_with('"') && trimmed.ends_with('"'))
|| (trimmed.starts_with('\'') && trimmed.ends_with('\'')))
&& trimmed.len() >= 2
{
if trimmed.len() >= 2 {
trimmed = trimmed[1..trimmed.len() - 1].trim();
}
trimmed = trimmed[1..trimmed.len() - 1].trim();
}
let without_query_or_fragment = match trimmed.find(|c| c == '?' || c == '#') {
let without_query_or_fragment = match trimmed.find(['?', '#']) {
Some(idx) => &trimmed[..idx],
None => trimmed,
};
+47 -14
View File
@@ -5,14 +5,23 @@ use std::collections::HashMap;
#[test]
fn test_sanitize_env_vars() {
let mut env_vars = HashMap::new();
env_vars.insert("GITEA_URL".to_string(), "\"https://gitea.example.com\"".to_string());
env_vars.insert(
"GITEA_URL".to_string(),
"\"https://gitea.example.com\"".to_string(),
);
env_vars.insert("GITEA_TOKEN".to_string(), "\"token123\"".to_string());
env_vars.insert("REGISTRY_OWNER".to_string(), "\"owner\"".to_string());
env_vars.insert("GITHUB_TOKEN".to_string(), "\"github_token123\"".to_string());
env_vars.insert(
"GITHUB_TOKEN".to_string(),
"\"github_token123\"".to_string(),
);
sanitize_env_vars(&mut env_vars);
assert_eq!(env_vars.get("GITEA_URL").unwrap(), "https://gitea.example.com");
assert_eq!(
env_vars.get("GITEA_URL").unwrap(),
"https://gitea.example.com"
);
assert_eq!(env_vars.get("GITEA_TOKEN").unwrap(), "token123");
assert_eq!(env_vars.get("REGISTRY_OWNER").unwrap(), "owner");
assert_eq!(env_vars.get("GITHUB_TOKEN").unwrap(), "github_token123");
@@ -31,7 +40,10 @@ fn test_load_config_with_env_vars() {
// Only assert if the environment variables are set
if std::env::var("GITEA_URL").is_ok() {
assert_eq!(config.gitea_url, Some("https://gitea.example.com".to_string()));
assert_eq!(
config.gitea_url,
Some("https://gitea.example.com".to_string())
);
assert_eq!(config.gitea_token, Some("token123".to_string()));
assert_eq!(config.registry_owner, Some("owner".to_string()));
assert_eq!(config.github_token, Some("github_token123".to_string()));
@@ -40,8 +52,14 @@ fn test_load_config_with_env_vars() {
#[test]
fn test_sanitize_string() {
assert_eq!(sanitize_string("\"https://gitea.example.com\""), "https://gitea.example.com");
assert_eq!(sanitize_string("'https://gitea.example.com'"), "https://gitea.example.com");
assert_eq!(
sanitize_string("\"https://gitea.example.com\""),
"https://gitea.example.com"
);
assert_eq!(
sanitize_string("'https://gitea.example.com'"),
"https://gitea.example.com"
);
assert_eq!(sanitize_string("\"token123\""), "token123");
assert_eq!(sanitize_string("'token123'"), "token123");
assert_eq!(sanitize_string("\"owner\""), "owner");
@@ -68,11 +86,23 @@ fn test_sanitize_string() {
#[test]
fn test_clean_repo_input() {
assert_eq!(clean_repo_input("owner/repo"), "owner/repo");
assert_eq!(clean_repo_input("https://github.com/owner/repo"), "owner/repo");
assert_eq!(clean_repo_input("http://github.com/owner/repo"), "owner/repo");
assert_eq!(
clean_repo_input("https://github.com/owner/repo"),
"owner/repo"
);
assert_eq!(
clean_repo_input("http://github.com/owner/repo"),
"owner/repo"
);
assert_eq!(clean_repo_input("github.com/owner/repo"), "owner/repo");
assert_eq!(clean_repo_input("https://github.com/owner/repo.git"), "owner/repo");
assert_eq!(clean_repo_input("https://github.com/owner/repo/"), "owner/repo");
assert_eq!(
clean_repo_input("https://github.com/owner/repo.git"),
"owner/repo"
);
assert_eq!(
clean_repo_input("https://github.com/owner/repo/"),
"owner/repo"
);
assert_eq!(
clean_repo_input("https://github.com/raspberrypi/rpi-imager?tab=readme-ov-file"),
"raspberrypi/rpi-imager"
@@ -123,14 +153,14 @@ fn test_add_or_update_repo() {
config.add_or_update_repo(repo.clone());
assert_eq!(config.repositories.len(), 1);
assert_eq!(config.repositories[0].name, "owner/repo");
assert_eq!(config.repositories[0].include_prereleases, true);
assert!(config.repositories[0].include_prereleases);
// Updating existing repo with a URL with query param
let repo_updated = RepoConfig::new("https://github.com/owner/repo#readme", false);
config.add_or_update_repo(repo_updated);
assert_eq!(config.repositories.len(), 1);
assert_eq!(config.repositories[0].name, "owner/repo");
assert_eq!(config.repositories[0].include_prereleases, false);
assert!(!config.repositories[0].include_prereleases);
}
#[test]
@@ -159,5 +189,8 @@ fn test_update_last_synced_tag() {
let repo = RepoConfig::new("owner/repo", true);
config.add_or_update_repo(repo.clone());
config.update_last_synced_tag("owner/repo", "v1.0.0".to_string());
assert_eq!(config.find_repo("owner/repo").unwrap().last_synced_tag, Some("v1.0.0".to_string()));
}
assert_eq!(
config.find_repo("owner/repo").unwrap().last_synced_tag,
Some("v1.0.0".to_string())
);
}
+20 -8
View File
@@ -41,7 +41,10 @@ fn test_package_classification() {
);
// Nicht unterstützte Paketformate sollten ignoriert werden
assert_eq!(PackageType::from_filename("rpi-imager-1.8.5.AppImage"), None);
assert_eq!(
PackageType::from_filename("rpi-imager-1.8.5.AppImage"),
None
);
assert_eq!(PackageType::from_filename("rpi-imager-1.8.5.dmg"), None);
assert_eq!(PackageType::from_filename("rpi-imager-1.8.5.exe"), None);
assert_eq!(PackageType::from_filename("source-code.tar.gz"), None);
@@ -57,19 +60,25 @@ fn test_parse_repo_owner_name() {
("raspberrypi", "rpi-imager")
);
assert_eq!(
parse_repo_owner_name("https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher").unwrap(),
parse_repo_owner_name("https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher")
.unwrap(),
("Heroic-Games-Launcher", "HeroicGamesLauncher")
);
assert_eq!(
parse_repo_owner_name("https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher.git").unwrap(),
parse_repo_owner_name("https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher.git")
.unwrap(),
("Heroic-Games-Launcher", "HeroicGamesLauncher")
);
assert_eq!(
parse_repo_owner_name("https://github.com/raspberrypi/rpi-imager?tab=readme-ov-file").unwrap(),
parse_repo_owner_name("https://github.com/raspberrypi/rpi-imager?tab=readme-ov-file")
.unwrap(),
("raspberrypi", "rpi-imager")
);
assert_eq!(
parse_repo_owner_name("https://github.com/raspberrypi/rpi-imager/?tab=readme-ov-file#install").unwrap(),
parse_repo_owner_name(
"https://github.com/raspberrypi/rpi-imager/?tab=readme-ov-file#install"
)
.unwrap(),
("raspberrypi", "rpi-imager")
);
assert_eq!(
@@ -86,14 +95,17 @@ async fn test_github_client_empty_token() {
use mirror_package::github::GitHubClient;
// Test that a client with an empty or whitespace token sanitizes it to None
let client = GitHubClient::new(Some("".to_string())).expect("Failed to create client with empty token");
let client =
GitHubClient::new(Some("".to_string())).expect("Failed to create client with empty token");
assert_eq!(client.token(), None);
let client_whitespace = GitHubClient::new(Some(" ".to_string())).expect("Failed to create client with whitespace token");
let client_whitespace = GitHubClient::new(Some(" ".to_string()))
.expect("Failed to create client with whitespace token");
assert_eq!(client_whitespace.token(), None);
// Test with a valid token
let client_with_token = GitHubClient::new(Some("valid_token".to_string())).expect("Failed to create client with valid token");
let client_with_token = GitHubClient::new(Some("valid_token".to_string()))
.expect("Failed to create client with valid token");
assert_eq!(client_with_token.token(), Some("valid_token"));
// Test with no token