Skip to content

chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.1… #16542

chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.1…

chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.1… #16542

Workflow file for this run

name: Test
on:
push:
pull_request:
jobs:
test:
services:
postgres:
image: postgres:18.4-alpine@sha256:96d56f7f57c6aacd1fcb908bc83b345ec5f83231ee486dd66a1baadce274db88
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: weblate
POSTGRES_DB: weblate
mariadb:
image: mariadb:10.11.18@sha256:5a5c675881ef3fd1c1da9b0a3bfd6ee82edbe39cd9e32e06be18034c37235e0e
env:
MARIADB_ROOT_PASSWORD: weblate
MARIADB_DATABASE: weblate
ports:
- 3306:3306
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version:
- '3.11'
- '3.12'
- '3.13'
database:
- sqlite
- mariadb
- postgresql
name: Python ${{ matrix.python-version }}, ${{ matrix.database }}
env:
CI_DATABASE: ${{ matrix.database }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: true
fetch-depth: 0
- name: Install apt dependencies
# gettext is needed as Django uses msgfmt to compile MO files
run: |
sudo apt update
sudo apt install gettext
- name: Start validation service
env:
# renovate: datasource=github-releases depName=gflohr/e-invoice-eu-validator versioning=loose
VALIDATOR_VERSION: 2.16.4
run: |
curl -L "https://github.com/gflohr/e-invoice-eu-validator/releases/download/v$VALIDATOR_VERSION/validator-$VALIDATOR_VERSION-jar-with-dependencies.jar" > /tmp/validator.jar
PORT=7070 java -jar /tmp/validator.jar > /tmp/validator.log 2>&1 &
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
cache-suffix: test
version: 0.11.19
- name: Install pip dependencies
run: uv pip install --system -r requirements-dev.txt
- name: Compile MO files
run: ./scripts/generate-locales
- name: Collect static files
run: ./manage.py collectstatic
- name: Django checks
run: ./manage.py check
- name: Test with Django
env:
EINVOICE_VALIDATOR_URL: http://localhost:7070/
run: |
pytest --junitxml=junit.xml weblate_web
cp .coverage .coverage.pytest
- name: Migrations
run: |
# First version with database backends tests
git checkout 7ba420b18ec3c7d32fb71823335e068f15b96855
uv pip install --system -r requirements.txt
./manage.py migrate
./manage.py shell -c 'customer = Customer.objects.create(user_id=-1); payment = Payment.objects.create(customer=customer, amount=1); Payment.objects.create(customer=customer, amount=1, repeat=payment)'
EXISTING_PK=$(./manage.py dumpdata payments.Payment | jq '.[].pk' | tr -d - | sort)
EXISTING_REPEAT=$(./manage.py dumpdata payments.Payment | jq '.[].fields.repeat' | tr -d - | sort)
git checkout "$GITHUB_SHA"
uv pip install --system -r requirements-dev.txt
coverage run ./manage.py migrate
NEW_PK=$(./manage.py dumpdata payments.Payment | jq '.[].pk' | tr -d - | sort)
NEW_REPEAT=$(./manage.py dumpdata payments.Payment | jq '.[].fields.repeat' | tr -d - | sort)
if [ "$NEW_PK" != "$EXISTING_PK" ] ; then
echo "Migration failed (pk): $NEW_PK != $EXISTING_PK"
exit 1
fi
if [ "$NEW_REPEAT" != "$EXISTING_REPEAT" ] ; then
echo "Migration failed (repeat): $NEW_REPEAT != $EXISTING_REPEAT"
exit 1
fi
- name: Coverage
run: |
coverage combine
coverage xml
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{secrets.CODECOV_TOKEN}} # zizmor: ignore[secrets-outside-env]
flags: unittests
name: Python ${{ matrix.python-version }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.1
with:
token: ${{ secrets.CODECOV_TOKEN }} # zizmor: ignore[secrets-outside-env]
- name: Show validation logs
if: ${{ !cancelled() }}
run: cat /tmp/validator.log
permissions:
contents: read