Merge pull request #723 from drnlm/feature/improve_translation_checks #394
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: Django CI | |
on: [push, pull_request] | |
jobs: | |
non-selenium-tests: | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
django-version: ['3.2.0', '4.0.0', '4.1.0', '4.2.0', '5.0.0', 'main'] | |
exclude: | |
- django-version: '4.2.0' | |
python-version: '3.8' | |
- django-version: 'main' | |
python-version: '3.8' | |
- django-version: 'main' | |
python-version: '3.9' | |
- django-version: '5.0.0' | |
python-version: '3.8' | |
- django-version: '5.0.0' | |
python-version: '3.9' | |
- django-version: '3.2.0' | |
python-version: '3.11' | |
- django-version: '4.0.0' | |
python-version: '3.11' | |
- django-version: '3.2.0' | |
python-version: '3.12' | |
- django-version: '4.0.0' | |
python-version: '3.12' | |
- django-version: '4.1.0' | |
python-version: '3.12' | |
uses: ./.github/workflows/run_tests.yml | |
with: | |
python-version: ${{ matrix.python-version }} | |
django-version: ${{ matrix.django-version }} | |
translations: | |
runs-on: ubuntu-latest | |
name: Check translation inforamtion is up to date | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt -r requirements-dev.txt | |
- name: Install gettext | |
run: | | |
sudo apt-get -y install gettext | |
- name: Check makemessages doesn't pick up significant changes | |
run: | | |
python ./manage.py makemessages --all --keep-pot | |
# Output the diff for visual comparison | |
# We filter the results to just changed or new/remove entries | |
git diff | grep --color '^[+-]msg' || echo "No diff" | |
# Asset that the filtered diff is empty | |
COUNT=$(git diff wafer/locale/ | grep --color '^[+-]msg' | wc -l) | |
if [ $COUNT -gt 0 ]; then | |
echo "Non-empty diff for django.pot - Regenerate file" | |
exit 1 | |
fi | |
- name: Compile Translations | |
run: | | |
# Check that the compile messages step doesn't fail due to bad formatting, etc. | |
cd wafer | |
python ../manage.py compilemessages | |
selenium: | |
runs-on: ubuntu-latest | |
name: Selenium - Browser ${{ matrix.browser }} | |
strategy: | |
max-parallel: 2 | |
matrix: | |
browser: ['chrome', 'firefox'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt -r requirements-dev.txt | |
pip install selenium | |
- name: Install node | |
uses: actions/setup-node@v4 | |
- name: Install javascript dependencies | |
run: | | |
npm install | |
- name: Setup Chrome | |
uses: browser-actions/setup-chrome@v1 | |
if: matrix.browser == 'chrome' | |
- name: Setup firefox | |
run: | | |
wget -O firefox.tar.bz2 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US' | |
tar xaf firefox.tar.bz2 | |
export PATH=$PATH:${PWD}/firefox | |
if: matrix.browser == 'firefox' | |
- name: Run Tests | |
run: | | |
python manage.py test --tag ${{ matrix.browser }} |