-
Notifications
You must be signed in to change notification settings - Fork 13
137 lines (132 loc) · 4.38 KB
/
update-lint-and-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Translation and Linting Workflow
on:
schedule:
- cron: '0 * * * *'
push:
branches:
- '*'
workflow_dispatch:
jobs:
update-translation:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [3.13, 3.12, 3.11, '3.10', 3.9]
steps:
- uses: styfle/cancel-workflow-action@main
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@master
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@master
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
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 for changes in README.md
run: >
! git diff -I'^"POT-Creation-Date: ' -I'^"Language-Team: ' -I'^# ' -I'^"Last-Translator: ' --exit-code && echo "SIGNIFICANT_CHANGES=1" >> $GITHUB_ENV || exit 0
- name: Commit changes
run: |
git add .
git commit -m 'Update translation from Transifex'
if: env.SIGNIFICANT_CHANGES
- name: Push commit
uses: ad-m/github-push-action@master
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.13, 3.12, 3.11]
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/[email protected]
- run: sphinx-lint
build-translation:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [3.13, 3.12, 3.11, '3.10', 3.9, 3.8]
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/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/upload-artifact@master
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.13, 3.12, 3.11, '3.10', 3.9, 3.8]
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
- uses: actions/upload-artifact@master
with:
name: build-${{ matrix.version }}-pdf
path: .