From 906aa81c6c4e55e37c0c692c212d8c908cadaf2d Mon Sep 17 00:00:00 2001 From: DragonSlayer_14 Date: Thu, 10 Sep 2026 20:25:50 +0200 Subject: [PATCH] CI: Packaging-Tools & Rustup-Cross-Targets gepinnt und gecacht - cargo-binstall/cargo-deb/cargo-generate-rpm auf feste Versionen gepinnt (vorher "latest", nicht reproduzierbar) und ~/.cargo/bin versionsbasiert gecacht - rustup target add fuer aarch64/i686 in eigenen Schritt ausgelagert und ~/.rustup/.../lib/rustlib/ gecacht, Cache-Key basiert auf der aufgeloesten rustc-Version (nicht auf dem gleitenden "stable"-Label), damit bei einem Rust-Update kein veralteter Cache mit neuerem Compiler gemischt wird - x86_64-unknown-linux-gnu aus rustup target add entfernt (Host- Target, war bereits Teil der stable-Toolchain, No-Op) - drei neue customManagers-Eintraege in renovate.json fuer cargo-binstall (github-releases) sowie cargo-deb/cargo-generate-rpm (crates.io), damit Renovate die gepinnten Versionen aktuell haelt Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Kh9v73QApBwJj96w6A8R55 --- .gitea/workflows/main.yaml | 42 ++++++++++++++++++++++++++++++----- .gitea/workflows/testing.yaml | 42 ++++++++++++++++++++++++++++++----- renovate.json | 28 +++++++++++++++++++++++ 3 files changed, 100 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index c63f78b..056e2c8 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -9,6 +9,10 @@ jobs: release-and-publish: name: Build, Publish Packages (Stable) & Create Release runs-on: ubuntu-latest + env: + CARGO_BINSTALL_VERSION: "1.23.0" + CARGO_DEB_VERSION: "3.8.0" + CARGO_GENERATE_RPM_VERSION: "0.21.0" steps: - name: Checkout Repository uses: actions/checkout@v7 @@ -30,18 +34,44 @@ jobs: restore-keys: | cargo-${{ runner.os }}- - - name: Install Cross-Compilation Toolchains & Dependencies + - name: Install Cross-Compilation Toolchains (apt) run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu gcc-i686-linux-gnu - rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu i686-unknown-linux-gnu - - name: Install Packaging Tools (Prebuilt Binaries) + - name: Ermittle Rust-Version für Rustup-Target-Cache-Key + run: echo "RUST_VERSION=$(rustc --version | awk '{print $2}')" >> "$GITHUB_ENV" + + - name: Cache Rustup Cross-Compilation-Targets + id: cache-rustup-targets + uses: actions/cache@v6 + with: + path: | + ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu + ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu + key: rustup-targets-${{ runner.os }}-${{ env.RUST_VERSION }} + + - name: Add Rust Cross-Compilation Targets + if: steps.cache-rustup-targets.outputs.cache-hit != 'true' + run: rustup target add aarch64-unknown-linux-gnu i686-unknown-linux-gnu + + - name: PATH um Cargo-bin-Verzeichnis ergänzen run: | mkdir -p ~/.cargo/bin - curl -fsSL https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz | tar -xz -C ~/.cargo/bin - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - ~/.cargo/bin/cargo-binstall -y --no-symlinks cargo-deb cargo-generate-rpm + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + + - name: Cache Packaging-Tools (cargo-binstall, cargo-deb, cargo-generate-rpm) + id: cache-packaging-tools + uses: actions/cache@v6 + with: + path: ~/.cargo/bin + key: packaging-tools-${{ runner.os }}-${{ env.CARGO_BINSTALL_VERSION }}-${{ env.CARGO_DEB_VERSION }}-${{ env.CARGO_GENERATE_RPM_VERSION }} + + - name: Install Packaging Tools (Prebuilt Binaries) + if: steps.cache-packaging-tools.outputs.cache-hit != 'true' + run: | + curl -fsSL "https://github.com/cargo-bins/cargo-binstall/releases/download/v${CARGO_BINSTALL_VERSION}/cargo-binstall-x86_64-unknown-linux-musl.tgz" | tar -xz -C ~/.cargo/bin + ~/.cargo/bin/cargo-binstall -y --no-symlinks "cargo-deb@${CARGO_DEB_VERSION}" "cargo-generate-rpm@${CARGO_GENERATE_RPM_VERSION}" - name: Run Tests run: | diff --git a/.gitea/workflows/testing.yaml b/.gitea/workflows/testing.yaml index a818c08..913b2b9 100644 --- a/.gitea/workflows/testing.yaml +++ b/.gitea/workflows/testing.yaml @@ -9,6 +9,10 @@ jobs: build-and-publish: name: Build, Publish Packages (Testing) & Create Preview Release runs-on: ubuntu-latest + env: + CARGO_BINSTALL_VERSION: "1.23.0" + CARGO_DEB_VERSION: "3.8.0" + CARGO_GENERATE_RPM_VERSION: "0.21.0" steps: - name: Checkout Repository uses: actions/checkout@v7 @@ -30,18 +34,44 @@ jobs: restore-keys: | cargo-${{ runner.os }}- - - name: Install Cross-Compilation Toolchains & Dependencies + - name: Install Cross-Compilation Toolchains (apt) run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu gcc-i686-linux-gnu - rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu i686-unknown-linux-gnu - - name: Install Packaging Tools (Prebuilt Binaries) + - name: Ermittle Rust-Version für Rustup-Target-Cache-Key + run: echo "RUST_VERSION=$(rustc --version | awk '{print $2}')" >> "$GITHUB_ENV" + + - name: Cache Rustup Cross-Compilation-Targets + id: cache-rustup-targets + uses: actions/cache@v6 + with: + path: | + ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu + ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu + key: rustup-targets-${{ runner.os }}-${{ env.RUST_VERSION }} + + - name: Add Rust Cross-Compilation Targets + if: steps.cache-rustup-targets.outputs.cache-hit != 'true' + run: rustup target add aarch64-unknown-linux-gnu i686-unknown-linux-gnu + + - name: PATH um Cargo-bin-Verzeichnis ergänzen run: | mkdir -p ~/.cargo/bin - curl -fsSL https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz | tar -xz -C ~/.cargo/bin - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - ~/.cargo/bin/cargo-binstall -y --no-symlinks cargo-deb cargo-generate-rpm + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + + - name: Cache Packaging-Tools (cargo-binstall, cargo-deb, cargo-generate-rpm) + id: cache-packaging-tools + uses: actions/cache@v6 + with: + path: ~/.cargo/bin + key: packaging-tools-${{ runner.os }}-${{ env.CARGO_BINSTALL_VERSION }}-${{ env.CARGO_DEB_VERSION }}-${{ env.CARGO_GENERATE_RPM_VERSION }} + + - name: Install Packaging Tools (Prebuilt Binaries) + if: steps.cache-packaging-tools.outputs.cache-hit != 'true' + run: | + curl -fsSL "https://github.com/cargo-bins/cargo-binstall/releases/download/v${CARGO_BINSTALL_VERSION}/cargo-binstall-x86_64-unknown-linux-musl.tgz" | tar -xz -C ~/.cargo/bin + ~/.cargo/bin/cargo-binstall -y --no-symlinks "cargo-deb@${CARGO_DEB_VERSION}" "cargo-generate-rpm@${CARGO_GENERATE_RPM_VERSION}" - name: Run Tests run: | diff --git a/renovate.json b/renovate.json index 481e4f8..f6417c7 100644 --- a/renovate.json +++ b/renovate.json @@ -54,6 +54,34 @@ "depNameTemplate": "trufflesecurity/trufflehog", "datasourceTemplate": "github-releases", "extractVersionTemplate": "^v(?.*)$" + }, + { + "customType": "regex", + "fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"], + "matchStrings": [ + "CARGO_BINSTALL_VERSION:\\s*\"(?[^\"]+)\"" + ], + "depNameTemplate": "cargo-bins/cargo-binstall", + "datasourceTemplate": "github-releases", + "extractVersionTemplate": "^v(?.*)$" + }, + { + "customType": "regex", + "fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"], + "matchStrings": [ + "CARGO_DEB_VERSION:\\s*\"(?[^\"]+)\"" + ], + "depNameTemplate": "cargo-deb", + "datasourceTemplate": "crate" + }, + { + "customType": "regex", + "fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"], + "matchStrings": [ + "CARGO_GENERATE_RPM_VERSION:\\s*\"(?[^\"]+)\"" + ], + "depNameTemplate": "cargo-generate-rpm", + "datasourceTemplate": "crate" } ] }