PVE-mods/.github/workflows/weekly-patch-test.yml
2026-08-08 19:21:54 +02:00

118 lines
4.2 KiB
YAML

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@v7
- 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@v7
with:
fetch-depth: 0
# ── Build (mirrors test-release.yml) ───────────────────────────────────
- name: Install build deps
run: |
sudo apt-get update -qq
sudo apt-get install -y devscripts debhelper build-essential
- name: Inject version into 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/node_info/files/Config.pm
- name: Generate dynamic debian rules
run: |
bash src/gen-rules.sh >> debian/rules
bash src/gen-rules.sh conffiles >> debian/pve-mod.conffiles
- 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-patches.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 "<details><summary>Test log</summary>"
echo ""
echo '```'
tail -n 200 test-output.log 2>/dev/null || echo "(no log captured)"
echo '```'
echo "</details>"
} > 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