|
| 1 | +name: Regenerate Generated Sources |
| 2 | + |
| 3 | +# Rebuilds the committed generated-code seeds when their inputs change: |
| 4 | +# - src/Engine/Components/generated/ (from src/Engine/Components/*.pgcomp |
| 5 | +# via tools/component_generator.pg, snapshotted by SnapshotComponents) |
| 6 | +# - src/Engine/Compiler/generated/ (from tools/vm_ops_def.pg via |
| 7 | +# tools/gen_vm_ops.pg, regenerated in place by the stage-0 bootstrap) |
| 8 | +# Any drift is committed back with [skip ci]. |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: [main, dev] |
| 13 | + paths: |
| 14 | + - 'src/Engine/Components/*.pgcomp' |
| 15 | + - 'tools/component_generator.pg' |
| 16 | + - 'tools/gen_vm_ops.pg' |
| 17 | + - 'tools/vm_ops_def.pg' |
| 18 | + - '.github/workflows/regen_generated.yml' |
| 19 | + workflow_dispatch: # Allow manual trigger |
| 20 | + |
| 21 | +jobs: |
| 22 | + regenerate: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + contents: write # Required for pushing commits |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + |
| 33 | + - name: Install prerequisites |
| 34 | + run: | |
| 35 | + sudo apt-get update |
| 36 | + sudo apt-get install -y \ |
| 37 | + build-essential cmake ccache git \ |
| 38 | + libgl1-mesa-dev libglu1-mesa-dev \ |
| 39 | + libx11-dev libxrandr-dev libxi-dev libxinerama-dev libxcursor-dev libxss-dev libxxf86vm-dev \ |
| 40 | + libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev \ |
| 41 | + libglew-dev libfreetype6-dev |
| 42 | +
|
| 43 | + - name: Configure with CMake |
| 44 | + run: | |
| 45 | + mkdir -p build |
| 46 | + cd build |
| 47 | + cmake -DCMAKE_BUILD_TYPE=Release .. |
| 48 | +
|
| 49 | + - name: Regenerate components |
| 50 | + run: | |
| 51 | + cd build |
| 52 | + # SnapshotComponents chains: ColumbaEngineMinimal -> PgCompilerBootstrap |
| 53 | + # -> component generation -> seed snapshot |
| 54 | + cmake --build . --target SnapshotComponents -- -j$(nproc || echo 2) |
| 55 | +
|
| 56 | + - name: Regenerate VM ops |
| 57 | + run: | |
| 58 | + cd build |
| 59 | + # On a fresh build dir AutoGenVmOps has no stage-0 bootstrap and keeps |
| 60 | + # the committed .inc files; GenerateVmOps regenerates them for real |
| 61 | + # with the bootstrap that was just built. |
| 62 | + cmake --build . --target GenerateVmOps -- -j$(nproc || echo 2) |
| 63 | +
|
| 64 | + - name: Check for drift |
| 65 | + id: check_changes |
| 66 | + run: | |
| 67 | + git add -N src/Engine/Components/generated src/Engine/Compiler/generated |
| 68 | + git diff --exit-code --stat \ |
| 69 | + src/Engine/Components/generated \ |
| 70 | + src/Engine/Compiler/generated || echo "changed=true" >> $GITHUB_OUTPUT |
| 71 | +
|
| 72 | + - name: Commit and push if changed |
| 73 | + if: steps.check_changes.outputs.changed == 'true' |
| 74 | + run: | |
| 75 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 76 | + git config --local user.name "github-actions[bot]" |
| 77 | + git add src/Engine/Components/generated src/Engine/Compiler/generated |
| 78 | + git commit -m "chore: Regenerate component and VM op seeds [skip ci]" || exit 0 |
| 79 | + git push |
0 commit comments