Skip to content

Merge pull request #702 from Terralego/dependabot/pip/elasticsearch-8… #1688

Merge pull request #702 from Terralego/dependabot/pip/elasticsearch-8…

Merge pull request #702 from Terralego/dependabot/pip/elasticsearch-8… #1688

Workflow file for this run

name: Unit tests
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
jobs:
backend:
name: Python unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
run: |
cp db.env.dist db.env
cp app.env.dist app.env
docker compose build web
- name: Check migrations
run: |
docker compose run --user root --rm web ./manage.py makemigrations --check
- name: Test migrations
run: |
docker compose run --user root --rm web ./manage.py migrate
- name: Verify translation files
run: |
docker compose run --user root --rm web ./manage.py makemessages -a --no-location --no-obsolete
- name: Check initial data
run: |
docker compose run --user root --rm web ./manage.py loaddata project/fixtures/initial.json
- uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: |
**/*.po
- name: Validating translations
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "Translation file(s) changed: ${{ steps.verify-changed-files.outputs.changed_files }}"
git diff
core.setFailed('Please fix your translation files with ./manage.py makemessages -a --no-location --no-obsolete')
- name: Tests
run: |
docker compose run --user root --rm web coverage run ./manage.py test --settings=project.settings.tests
- name: Prepare coverage report
run: |
docker compose run --user root --rm web coverage xml
- uses: codecov/codecov-action@v5
with:
flags: backend-unittests
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml