Update CI/CD #1137
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 6 * * *' | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| branches: ['main'] | |
| workflow_dispatch: | |
| jobs: | |
| update-translation: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| 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 rsync | |
| - run: pip install transifex-python six sphinx-intl blurb | |
| - run: curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | |
| working-directory: /usr/local/bin | |
| - uses: actions/checkout@master | |
| with: | |
| repository: python/cpython | |
| ref: main | |
| path: cpython | |
| - run: make gettext | |
| working-directory: cpython/Doc | |
| - run: sphinx-intl create-txconfig | |
| working-directory: cpython/Doc/build | |
| - run: sphinx-intl update-txconfig-resources --transifex-organization-name python-doc --transifex-project-name python-newest -d . -p gettext | |
| working-directory: cpython/Doc/build | |
| env: | |
| TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
| - run: tx pull -l uk --force --skip | |
| working-directory: cpython/Doc/build | |
| env: | |
| TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
| - run: find -name "*.po" -exec msgcat --no-location -o {} {} \; | |
| working-directory: cpython/Doc/build | |
| - uses: actions/checkout@master | |
| with: | |
| ref: ${{ matrix.version }} | |
| path: python-docs-uk | |
| - run: rsync -r --delete cpython/Doc/build/uk/LC_MESSAGES/ . | |
| working-directory: python-docs-uk | |
| - run: | | |
| git config --local user.email github-actions@github.com | |
| git config --local user.name "GitHub Action's update-translation job" | |
| git add . | |
| git commit -m 'Update translation from Transifex' || true | |
| working-directory: python-docs-uk | |
| - uses: ad-m/github-push-action@master | |
| with: | |
| branch: ${{ matrix.version }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| directory: python-docs-uk | |
| lint-translation: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| needs: ['update-translation'] | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/setup-python@master | |
| with: | |
| python-version: 3 | |
| - run: pip install sphinx-lint | |
| - uses: actions/checkout@master | |
| with: | |
| ref: ${{ matrix.version }} | |
| - uses: rffontenelle/sphinx-lint-problem-matcher@v1.0.0 | |
| - run: sphinx-lint | |
| build-translation: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| 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/github-problem-matcher@v1.1 | |
| - run: make -e SPHINXOPTS=" -D language='uk' -W --keep-going" ${{ matrix.format }} | |
| working-directory: ./Doc | |
| - run: make sphinx-lint | |
| - uses: actions/upload-artifact@master | |
| with: | |
| name: build-${{ matrix.version }}-${{ matrix.format }} | |
| path: Doc/build/${{ matrix.format }} | |
| output-pdf: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| 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: . |