PVE-mods/.github/workflows/weekly-patch-test.yml
2026-08-17 20:46:26 +02:00

139 lines
5.0 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
container:
image: debian:trixie
strategy:
fail-fast: false
matrix:
mod: ${{ fromJSON(needs.discover.outputs.mods) }}
steps:
# ── Base tools (mirrors validate-mods.yml) ──────────────────────────────
- name: Install base tools
run: |
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates git sudo wget xz-utils dpkg nodejs perl
- uses: actions/checkout@v7
with:
fetch-depth: 0
# ── Build (mirrors test-release.yml) ───────────────────────────────────
- name: Install build deps
run: |
apt-get update -qq
apt-get install -y devscripts debhelper build-essential
- name: Compute build version
id: version
run: |
BASE_VERSION=$(grep -m1 '(' debian/changelog | sed 's/.*(\(.*\)).*/\1/')
SHORT_SHA=$(git rev-parse --short HEAD)
BUILD_VERSION="${BASE_VERSION}+weekly.${SHORT_SHA}"
echo "build_version=$BUILD_VERSION" >> "$GITHUB_OUTPUT"
echo "Building version: $BUILD_VERSION"
- name: Inject version into Config.pm
run: |
BUILD_VERSION="${{ steps.version.outputs.build_version }}"
sed -i -E "s/^our \\\$VERSION\s*=.*/our \\\$VERSION = '${BUILD_VERSION}';/" \
src/modules/node_info/files/Config.pm
- name: Set package version in changelog
run: |
BUILD_VERSION="${{ steps.version.outputs.build_version }}"
sed -i -E "0,/\(([^)]*)\)/s//(${BUILD_VERSION})/" debian/changelog
- name: Generate dynamic debian rules
run: |
bash build/gen-rules.sh >> debian/rules
- name: Build package
run: dpkg-buildpackage -us -uc -b
# ── Test ───────────────────────────────────────────────────────────────
- name: Fetch upstream Proxmox files
run: bash build/test/fetch-proxmox-files.sh
- name: Install built package
run: apt-get install -y ../pve-mod_*.deb
- name: Test mod
run: |
set -o pipefail
bash build/test/test-patches.sh "${{ matrix.mod }}" 2>&1 | tee test-output.log
- name: Validate source syntax
run: bash build/test/test-syntax.sh "${{ matrix.mod }}"
- 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