Translation and Linting Workflow #42177
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: Translation and Linting Workflow | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' | |
| push: | |
| branches: | |
| - '*' | |
| workflow_dispatch: | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: [3.14, 3.13, 3.12, 3.11, '3.10'] | |
| steps: | |
| - uses: styfle/[email protected] | |
| with: | |
| access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install -y gettext | |
| pip install requests cogapp polib transifex-python sphinx-intl blurb six | |
| curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | |
| working-directory: /usr/local/bin | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ matrix.version }} | |
| fetch-depth: 0 | |
| - name: Recreate Transifex config | |
| run: ./manage_translation.py recreate_tx_config | |
| env: | |
| TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
| - name: Fetch translations | |
| run: ./manage_translation.py fetch | |
| env: | |
| TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
| - name: Update README.md | |
| run: python -Werror -m cogapp -rP README.md | |
| if: ${{ hashFiles('README.md') != '' }} | |
| env: | |
| TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
| - name: Update README.en.md | |
| run: python -Werror -m cogapp -rP README.en.md | |
| if: ${{ hashFiles('README.en.md') != '' }} | |
| env: | |
| TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
| - run: git config --local user.email [email protected] | |
| - run: git config --local user.name "GitHub Action's update-translation job" | |
| - name: Check changes significance | |
| run: > | |
| ! git diff -I'^"POT-Creation-Date: ' -I'^"Language-Team: ' -I'^# ' -I'^"Last-Translator: ' -I'^"Project-Id-Version: ' --exit-code && echo "SIGNIFICANT_CHANGES=1" >> "$GITHUB_ENV" || exit 0 | |
| - run: git add . | |
| - run: git commit -m "$(python manage_translation.py generate_commit_msg)" | |
| if: env.SIGNIFICANT_CHANGES | |
| - name: Push commit | |
| uses: ad-m/[email protected] | |
| if: env.SIGNIFICANT_CHANGES | |
| with: | |
| branch: ${{ matrix.version }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| lint: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: [3.14, 3.13, 3.12, 3.11] | |
| needs: ['update'] | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3 | |
| - run: pip install sphinx-lint | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ matrix.version }} | |
| - uses: rffontenelle/[email protected] | |
| - run: sphinx-lint | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: [3.14, 3.13, 3.12, 3.11, '3.10'] | |
| format: [html, latex, epub] | |
| needs: ['update'] | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.12 # pin for Sphinx 3.4.3 in 3.10 branch (see #63) | |
| - uses: actions/checkout@v5 | |
| with: | |
| repository: python/cpython | |
| ref: ${{ matrix.version }} | |
| - run: make venv | |
| working-directory: ./Doc | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ matrix.version }} | |
| path: Doc/locales/pl/LC_MESSAGES | |
| - run: git pull | |
| working-directory: ./Doc/locales/pl/LC_MESSAGES | |
| - uses: sphinx-doc/[email protected] | |
| - run: make -e SPHINXOPTS="--color -D language='pl' -W --keep-going" ${{ matrix.format }} | |
| working-directory: ./Doc | |
| - uses: actions/[email protected] | |
| if: success() || failure() | |
| with: | |
| name: build-${{ matrix.version }}-${{ matrix.format }} | |
| path: Doc/build/${{ matrix.format }} | |
| output-pdf: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| version: [3.14, 3.13, 3.12, 3.11, '3.10'] | |
| needs: ['build'] | |
| steps: | |
| - uses: actions/[email protected] | |
| with: | |
| name: build-${{ matrix.version }}-latex | |
| - run: sudo apt-get update | |
| - run: sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy | |
| - run: make | |
| - uses: actions/[email protected] | |
| with: | |
| name: build-${{ matrix.version }}-pdf | |
| path: . | |
| lint-epub: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| version: [3.14] | |
| needs: ['build'] | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - uses: astral-sh/setup-uv@v7 | |
| - uses: actions/[email protected] | |
| with: | |
| name: build-${{ matrix.version }}-epub | |
| - run: uvx epubcheck |