krz/nfogen

A scene-style ASCII .nfo generator.

clone: git clone https://gitbay.org/krz/nfogen.git

main: .github/workflows/test.yml · raw

 1name: Test
 2
 3# nfogen ships examples/*.toml next to the .nfo each one produces, which makes
 4# them a golden fixture: regenerate and compare. A change to layout, banner or
 5# encoding that was not intended shows up as a diff in a committed file rather
 6# than in someone's release notes.
 7on:
 8  pull_request:
 9  push:
10    branches: [main]
11
12permissions:
13  contents: read
14
15jobs:
16  examples:
17    runs-on: ubuntu-latest
18    steps:
19      - uses: actions/checkout@v7
20
21      # 3.11+ for tomllib, which nfogen needs to read a .toml config at all.
22      - uses: actions/setup-python@v7
23        with:
24          python-version: '3.13'
25
26      - name: Syntax
27        run: python -m compileall -q nfogen.py
28
29      - name: Examples regenerate byte for byte
30        run: |
31          set -euo pipefail
32          fail=0
33          for toml in examples/*.toml; do
34            base="$(basename "$toml" .toml)"
35            [ -f "examples/$base.nfo" ] || continue
36            python nfogen.py -c "$toml" -o "/tmp/$base.nfo" --no-input
37            if ! diff -u "examples/$base.nfo" "/tmp/$base.nfo"; then
38              echo "::error file=examples/$base.nfo::regenerated output differs from the committed example"
39              fail=1
40            fi
41          done
42          exit "$fail"