From 70b43862e90052e7af88e8cb7a529b1fc4ad8b04 Mon Sep 17 00:00:00 2001 From: Meliox Date: Wed, 10 Jun 2026 19:10:28 +0200 Subject: [PATCH] weekly patch test --- .github/workflows/weekly-patch-test.yml | 110 ++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/weekly-patch-test.yml diff --git a/.github/workflows/weekly-patch-test.yml b/.github/workflows/weekly-patch-test.yml new file mode 100644 index 0000000..2b239dd --- /dev/null +++ b/.github/workflows/weekly-patch-test.yml @@ -0,0 +1,110 @@ +name: Test Patches - Weekly + +# Weekly regression test of pve-mod against the latest upstream Proxmox VE files. +# Mods are auto-discovered from the [modules] section of src/pve-mod.conf and +# tested in parallel - adding a mod needs no change here. If a mod fails, an +# issue is opened (or updated) per failed mod explaining why. + +on: + schedule: + - cron: '0 6 * * 1' # Mondays 06:00 UTC + workflow_dispatch: + +permissions: + contents: read + issues: write + +jobs: + discover: + runs-on: ubuntu-latest + outputs: + mods: ${{ steps.list.outputs.mods }} + steps: + - uses: actions/checkout@v4 + + - name: Discover mods from [modules] + id: list + run: | + MODS=$(awk -F= ' + /^\[/ { in_sec = ($0 == "[modules]") } + in_sec && /^[^#=]+=/ { + gsub(/^[[:space:]]+|[[:space:]]+$/, "", $1); print $1 + }' src/pve-mod.conf | jq -R . | jq -cs .) + echo "Discovered mods: $MODS" + echo "mods=$MODS" >> "$GITHUB_OUTPUT" + + test: + needs: discover + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + mod: ${{ fromJSON(needs.discover.outputs.mods) }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # ── Build (mirrors test-release.yml) ─────────────────────────────────── + - name: Install build deps + run: sudo apt-get install -y devscripts debhelper build-essential + + - name: Inject version into PVEMod_Config.pm + run: | + VERSION=$(grep -m1 '(' debian/changelog | sed 's/.*(\(.*\)).*/\1/') + SHORT_SHA=$(git rev-parse --short HEAD) + export BUILD_VERSION="${VERSION}-test-${SHORT_SHA}" + perl -i -pe 'BEGIN { $v = $ENV{BUILD_VERSION} } + s/(our \$VERSION\s*=\s*'"'"')[^'"'"']*'"'"';/$1'"'"'$v'"'"';/ + ' src/PVENodeInfo/PVEMod_Config.pm + + - name: Build package + run: dpkg-buildpackage -us -uc -b + + # ── Test ─────────────────────────────────────────────────────────────── + - name: Fetch upstream Proxmox files + run: bash src/Scripts/test/fetch-proxmox-files.sh + + - name: Install built package + run: sudo apt-get install -y ../pve-mod_*.deb + + - name: Test mod + run: | + set -o pipefail + sudo bash src/Scripts/test/test-mods.sh "${{ matrix.mod }}" 2>&1 | tee test-output.log + + - name: Report failure as issue + if: failure() + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MOD: ${{ matrix.mod }} + run: | + TITLE="[patch-break] ${MOD}" + { + echo "The weekly patch test failed for mod \`${MOD}\` against the latest Proxmox VE files." + echo "" + echo "Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + echo "" + echo "
Test log" + echo "" + echo '```' + tail -n 200 test-output.log 2>/dev/null || echo "(no log captured)" + echo '```' + echo "
" + } > issue-body.md + + # Ensure the label exists (no-op if it already does). + gh label create patch-break --color B60205 \ + --description "pve-mod patch failed against upstream Proxmox" 2>/dev/null || true + + EXISTING=$(gh issue list --state open --label patch-break \ + --search "$TITLE in:title" --json number,title \ + --jq ".[] | select(.title==\"$TITLE\") | .number" | head -n1) + + if [[ -n "$EXISTING" ]]; then + gh issue comment "$EXISTING" --body-file issue-body.md + echo "Commented on existing issue #$EXISTING" + else + gh issue create --title "$TITLE" --label patch-break --body-file issue-body.md + echo "Opened new issue for mod $MOD" + fi