[pre-commit.ci] pre-commit autoupdate #534
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: Compile Card DB | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| compile_card_db: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Resolve PR context | |
| id: resolve-pr | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const payload = context.payload; | |
| const defaultBranch = payload.repository?.default_branch || ''; | |
| const prNumber = String(payload.pull_request?.number || ''); | |
| const baseBranch = String(payload.pull_request?.base?.ref || defaultBranch); | |
| core.setOutput('source_pr_number', prNumber); | |
| core.setOutput('base_branch', baseBranch); | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - uses: astral-sh/setup-uv@v6 | |
| - run: uv sync | |
| - name: Update Languages | |
| run: uv run doit update_languages | |
| - name: Install PyICU | |
| if: ${{ runner.os == 'Linux' }} | |
| run: | | |
| sudo apt update | |
| sudo apt install python3-icu | |
| - name: Test generation with compiled languages | |
| run: uv run pytest -k "test_languages" | |
| - name: Fetch target branch for comparison | |
| if: ${{ steps.resolve-pr.outputs.source_pr_number != '' }} | |
| run: git fetch --no-tags origin "${{ steps.resolve-pr.outputs.base_branch }}" | |
| - name: Compare compiled card DB to target branch | |
| id: compare | |
| shell: bash | |
| run: | | |
| if [ -z "${{ steps.resolve-pr.outputs.source_pr_number }}" ]; then | |
| echo "cardb_target=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if git diff --quiet "origin/${{ steps.resolve-pr.outputs.base_branch }}" -- src/domdiv/card_db/; then | |
| echo "cardb_target=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "cardb_target=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Save PR context artifact | |
| if: ${{ steps.resolve-pr.outputs.source_pr_number != '' }} | |
| shell: bash | |
| run: | | |
| mkdir -p pr_context | |
| printf '%s\n' "${{ steps.resolve-pr.outputs.source_pr_number }}" > pr_context/pr_number | |
| printf '%s\n' "${{ steps.resolve-pr.outputs.base_branch }}" > pr_context/base_branch | |
| - name: Upload PR context artifact | |
| if: ${{ steps.resolve-pr.outputs.source_pr_number != '' }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: pr_context | |
| path: pr_context | |
| - name: Archive compiled card DB | |
| if: ${{ steps.compare.outputs.cardb_target == 'true' }} | |
| run: tar -czf compiled_card_db.tgz src/domdiv/card_db | |
| - name: Upload compiled card DB artifact | |
| if: ${{ steps.compare.outputs.cardb_target == 'true' }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: compiled-card-db | |
| path: compiled_card_db.tgz |