👷 [CI] Add job to check translations #3265
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: Linting | |
on: | |
pull_request: | |
paths: | |
- 'geotrek/**' # if geotrek code change | |
- '.github/workflows/lint.yml' # if lint workflow change | |
- 'dev-requirements.txt' # if dev-requirements.txt change | |
- 'setup.cfg' # if lint tools configuration change | |
env: | |
VAR_DIR: /home/runner/work/Geotrek-admin/Geotrek-admin/var | |
ENV: dev | |
jobs: | |
migrations: | |
name: Checking SRID in migrations files | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
test $(ls geotrek/*/migrations/*.py | xargs grep -l srid | xargs grep -L SRID | wc -l) -eq 0 | |
flake8: | |
name: Checking Flake8 rules | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/python-cache-requirements | |
with: | |
requirements: dev-requirements.txt | |
- name: Install dependencies | |
run: | | |
pip3 install -c dev-requirements.txt flake8 | |
- name: Flake8 | |
run: | | |
flake8 geotrek | |
translations: | |
name: Checking translations files are up-to-date | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/python-cache-requirements | |
with: | |
requirements: requirements.txt | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y gettext | |
pip3 install -r dev-requirements.txt | |
mkdir -p var/static var/conf/extra_static var/media/upload var/cache/sessions var/cache/api_v2 var/cache/fat var/log var/conf/extra_templates var/conf/extra_locale var/tmp | |
- name: Check translations | |
run: | | |
./manage.py makemessages -a --no-location --no-obsolete -v 3 | |
./manage.py compilemessages | |
ls -als | |
- uses: tj-actions/verify-changed-files@v20 | |
id: verify-changed-files | |
with: | |
files: | | |
**/*.po | |
- name: Verify translation files changed | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
env: | |
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }} | |
run: | | |
echo "Changed files: $CHANGED_FILES" | |
git diff | |
core.setFailed('Please fix your translation files with ./manage.py makemessages -a --no-location --no-obsolete') |