Files
libretro/.github/workflows/validate.yml
T
Abdessamad Derraz b4d725b75e chore: keep pr feedback and release path intact
PR validation keeps its four jobs, its comment and its labels. The two
inline schema heredocs become validate_schemas.py --source-only, the
changed-file list is NUL-separated so a path with a space survives, and
the whole suite runs instead of one module.

The offline pipeline, manifest regeneration and mkdocs build stay out of
the pull-request path: they belong to the site workflow, which only runs
on main, and stacking them on every PR does not fit the free-tier
budget.

Deploy Site gains schema validation and rendered-site validation, and
checks that the committed README and CONTRIBUTING match what the
generator produces. write_if_changed compares with the timestamp line
stripped, so that check reports staleness rather than the clock.
2026-08-10 13:37:09 +02:00

129 lines
3.7 KiB
YAML

name: PR Validation
on:
pull_request:
paths:
- "bios/**"
- "platforms/**"
- "emulators/**"
- "schemas/**"
- "scripts/**"
- "tests/**"
- "install.py"
permissions:
contents: read
pull-requests: write
concurrency:
group: validate-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
validate-bios:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pyyaml
- name: Get changed BIOS files
id: changed
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# NUL-separated and filtered to added/modified/renamed: a deleted
# file has no bytes left to hash, and a path with a space or a
# quote must survive the hand-off to validate_pr.py.
git diff --name-only --diff-filter=AMR -z "$BASE_SHA"..."$HEAD_SHA" \
-- bios/ > changed_files.zlist
- name: Validate BIOS files
id: validate
run: |
if [ -s changed_files.zlist ]; then
xargs -0 python scripts/validate_pr.py --markdown -- \
< changed_files.zlist > report.md 2>&1 || true
else
echo "No BIOS files changed" > report.md
fi
cat report.md
- name: Post validation report
if: always()
run: |
gh pr comment "${{ github.event.pull_request.number }}" --body-file report.md
env:
GH_TOKEN: ${{ github.token }}
validate-configs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pyyaml jsonschema==4.23.0
- name: Validate platform configs and emulator profiles
run: python scripts/validate_schemas.py --source-only
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pyyaml jsonschema==4.23.0
- name: Run test suite
run: python -m unittest discover tests -v
label-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
- name: Auto-label PR
run: |
labels=""
files=$(gh pr diff "${{ github.event.pull_request.number }}" --name-only)
if echo "$files" | grep -q '^bios/'; then
labels="$labels bios"
for sys in $(echo "$files" | grep '^bios/' | cut -d/ -f2 | sort -u); do
labels="$labels system:$(echo "$sys" | tr '[:upper:]' '[:lower:]')"
done
fi
if echo "$files" | grep -q '^platforms/'; then
labels="$labels platform-config"
fi
if echo "$files" | grep -q '^scripts/'; then
labels="$labels automation"
fi
for label in $labels; do
gh pr edit "${{ github.event.pull_request.number }}" --add-label "$label" 2>/dev/null || true
done
env:
GH_TOKEN: ${{ github.token }}