python-docs-fr/.github/workflows/tests.yml
Jean-Abou-Samra 28f90d0bbd
Pas de -W explicite pour Sphinx (#1680)
CPython ajoute déjà -W dans son Makefile. Depuis le commit
f98c1623ec90508937afc1b58556e38214d70892 ("Doc: -W flag for sphinx-build
can be disabled" par Julien Palard), c'est même configurable à l'aide de
la variable SPHINXERRORHANDLING.

Avec le présent commit, cette variable
fonctionne aussi dans notre traduction, ce qui facilite la traduction
car cela permet d'obtenir tous les avertissements en une fois avec
« make SPHINXERRORHANDLING= » ou bien « make SPHINXERRORHANDLING="-W
--keep-going" », au lieu de voir un nouvel avertissement arrêter la
compilation à chaque fois. Ce serait bien d'avoir --keep-going par
défaut, mais je ne l'ajoute pas ici car il serait sûrement encore mieux
de le mettre dans CPython directement.
2021-09-06 11:11:48 +02:00

95 lines
3.3 KiB
YAML

---
name: Tests
on:
push:
branches:
- '*.*'
pull_request:
branches:
- '*.*'
jobs:
checks:
strategy:
matrix:
tool:
- name: Orthographe
package: pospell
apt_dependencies: hunspell hunspell-fr-comprehensive
command: 'pospell -p dict -l fr_FR $CHANGED_PO_FILES'
- name: Longueur des lignes
package: powrap
apt_dependencies: gettext
command: 'powrap --check --quiet --diff $CHANGED_PO_FILES'
- name: Grammaire
package: padpo
command: 'padpo -i $CHANGED_PO_FILES 2>&1 | grep -v -Ff padpo.ignore'
name: ${{ matrix.tool.name }} (${{ matrix.tool.package }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Register problem matchers
run: echo "::add-matcher::.github/problem-matchers/pospell.json"
- uses: lots0logs/gh-action-get-changed-files@2.1.4
id: changed_files
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install ${{ matrix.tool.package }}
run: |
[ -n "${{ matrix.tool.apt_dependencies }}" ] && sudo apt-get update && sudo apt-get install -y ${{ matrix.tool.apt_dependencies }}
python -m pip install --upgrade pip setuptools wheel
python -m pip install ${{ matrix.tool.package }}
- name: Run ${{ matrix.tool.package }}
env:
ADDED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.added), ' ') }}
MODIFIED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.modified), ' ') }}
run: |
CHANGED_PO_FILES=$(printf "%s %s\n" "$ADDED_FILES" "$MODIFIED_FILES" | tr ' ' '\n' | grep '.po$'; true)
if [ -n "$CHANGED_PO_FILES" ]
then
echo "Running on:" $CHANGED_PO_FILES
${{ matrix.tool.command }}
else
echo "No changed po files, nothing to check."
fi
sphinx:
name: 'Génération de la doc (sphinx)'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '~/cpython/'
key: '1'
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Clone cpython
run: |
if [ ! -d ~/cpython ]; then
git clone https://github.com/python/cpython ~/cpython/
else
git -C ~/cpython fetch
fi
- name: Prepare build hierarchy
run: |
mkdir -p ~/locales/fr/LC_MESSAGES/
cp -uv --parents *.po */*.po ~/locales/fr/LC_MESSAGES/
git -C ~/cpython checkout 895591c1f0bdec5ad357fe6a5fd0875990061357
- name: Prepare venv
run: |
# If the venv exists but is broken, drop it (happens on Python upgrades):
# see https://github.com/actions/setup-python/issues/170
[ -d $HOME/cpython/Doc/venv/bin/ -a ! -e $HOME/cpython/Doc/venv/bin/python ] && rm -fr $HOME/cpython/Doc/venv
make -C $HOME/cpython/Doc venv
- name: sphinx-build
run: make -C $HOME/cpython/Doc SPHINXOPTS="-q -j4 -D locale_dirs=$HOME/locales -D language=fr -D gettext_compact=0" autobuild-dev-html