-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitcher-requirements-progress.yml
More file actions
95 lines (80 loc) · 2.62 KB
/
switcher-requirements-progress.yml
File metadata and controls
95 lines (80 loc) · 2.62 KB
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
name: Check switcher requirements
on:
workflow_dispatch:
inputs:
language_code:
description: 'Language code'
required: true
type: string
jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
language_code: [ "${{ inputs.language_code }}" ]
steps:
- name: Checkout current repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext
python -m pip install --upgrade pip
pip install blurb potodo
- name: Determine /3/ version and clone CPython
run: |
PYTHON_VERSION=$(curl -s https://docs.python.org/3/ | grep -oP 'Python \K\d+\.\d+' | head -1)
echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV
git clone --branch "$PYTHON_VERSION" --single-branch --depth 1 https://github.com/python/cpython.git
- name: Clone translation
run: |
git clone https://github.com/python/python-docs-${{ matrix.language_code }}.git translation-repo
cd translation-repo
git switch "$PYTHON_VERSION" || echo "No translation branch $PYTHON_VERSION"
- name: Generate POT files
run: |
cd cpython/Doc
make venv
make gettext
mkdir -p ../../pot-files
cp -r build/gettext/*.pot ../../pot-files/
- name: msgmerge PO files
run: |
cd translation-repo
find . -name "*.po" -type f | while read po_file; do
rel_path=${po_file#./}
pot_file="../pot-files/${rel_path%.po}.pot"
if [ -f "$pot_file" ]; then
echo "Merging $po_file with $pot_file"
msgmerge --update "$po_file" "$pot_file"
fi
done
- name: Run potodo
run: |
cd translation-repo
potodo | tee ../potodo-results.txt
- name: Verify requirements are met
run: |
if grep -q "functions.po" potodo-results.txt; then
echo "library/functions.po is not fully translated"
exit 1
fi
if grep -q "bugs.po" potodo-results.txt; then
echo "bugs.po is not fully translated"
exit 1
fi
if ! grep -q "# tutorial (100.00% done)" potodo-results.txt; then
echo "tutorial/* is not fully translated"
exit 1
fi
- name: Upload potodo results
if: always()
uses: actions/upload-artifact@v4
with:
name: potodo-results-${{ inputs.language_code }}
path: potodo-results.txt
retention-days: 30