feat(game): stream validation for game metadata #395
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: validate-data | |
| # Self-check: every PR runs the bundled lightweight validator. Heavy checks | |
| # (coverage gaps, schema migrations, ingestion smoke tests) live in TechEngine. | |
| on: | |
| pull_request: | |
| paths: | |
| - "data/**" | |
| - "app/validate.py" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "data/**" | |
| - "app/validate.py" | |
| jobs: | |
| self-validate: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| validation_scope: ${{ steps.scope.outputs.scope }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # The committed Pages dump contains over a million generated files. | |
| # Start with the validator and its tests. Data is added only when | |
| # the pull request actually changes a record. | |
| sparse-checkout: | | |
| .github | |
| app | |
| tests | |
| sparse-checkout-cone-mode: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Select validation scope | |
| id: scope | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" ]]; then | |
| echo "scope=full" >> "$GITHUB_OUTPUT" | |
| elif gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files" --jq '.[].filename' | grep -q '^data/'; then | |
| echo "scope=full" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "scope=tests" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Self-check (bundled validator) | |
| shell: bash | |
| run: | | |
| if [[ "${{ steps.scope.outputs.scope }}" == "full" ]]; then | |
| git sparse-checkout add data | |
| python -m app.validate | |
| else | |
| python -m unittest discover -s tests -v | |
| fi | |
| engine-validate: | |
| needs: self-validate | |
| if: needs.self-validate.outputs.validation_scope == 'full' | |
| uses: GetTechAPI/TechEngine/.github/workflows/validate-data.yml@main | |
| with: | |
| data-ref: ${{ github.event.pull_request.head.sha || github.sha }} |