Translation and Linting Workflow #1100
This file contains 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 6 * * *' | |
push: | |
branches: ['main'] | |
workflow_dispatch: | |
jobs: | |
update-translation: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: styfle/cancel-workflow-action@main | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-python@master | |
with: | |
python-version: 3 | |
- run: sudo apt-get install -y gettext | |
- run: curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | |
working-directory: /usr/local/bin | |
- run: pip install requests cogapp polib transifex-python sphinx-lint sphinx-intl blurb six | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ matrix.version }} | |
- run: .github/scripts/manage_translation.py recreate_config | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
- run: .github/scripts/manage_translation.py fetch_translations | |
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" | |
- run: git add . | |
- run: git commit -m 'Update translation from Transifex' || true | |
- uses: ad-m/github-push-action@master | |
with: | |
branch: ${{ matrix.version }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: peter-evans/repository-dispatch@main | |
with: | |
python-version: 3 | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ matrix.version }} | |
- uses: rffontenelle/[email protected] | |
- run: sphinx-lint | |
build-translation: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
format: [html, latex] | |
needs: ['update-translation'] | |
steps: | |
- uses: actions/setup-python@master | |
with: | |
python-version: 3.12 # pin for Sphinx 3.4.3 in 3.10 branch (see #63) | |
- uses: actions/checkout@master | |
with: | |
repository: python/cpython | |
ref: ${{ matrix.version }} | |
- run: make venv | |
working-directory: ./Doc | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ matrix.version }} | |
path: Doc/locales/uk/LC_MESSAGES | |
- run: git pull | |
working-directory: ./Doc/locales/uk/LC_MESSAGES | |
- uses: sphinx-doc/[email protected] | |
- run: make -e SPHINXOPTS=" -D language='uk' -W --keep-going" ${{ matrix.format }} | |
working-directory: ./Doc | |
- uses: actions/upload-artifact@master | |
with: | |
name: build-${{ matrix.version }}-${{ matrix.format }} | |
path: Doc/build/${{ matrix.format }} | |
output-pdf: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
needs: ['build-translation'] | |
steps: | |
- uses: actions/download-artifact@master | |
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 -i | |
- uses: actions/upload-artifact@master | |
with: | |
name: build-${{ matrix.version }}-pdf | |
path: . |