use uv, ruff, prek; update tests gh-workflow #5019
This file contains hidden or 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: tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [ "3.14" ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup python and uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| uv sync --dev --inexact --all-extras | |
| - name: lint and format check with ruff | |
| run: | | |
| uv run ruff format --check | |
| uv run ruff check | |
| uv run pylint src/ephios # ruff does not have feature parity with pylint yet | |
| - name: Run djhtml | |
| run: uv run djhtml -c src/ephios/ | |
| - name: Make sure we always use trimmed translation strings | |
| run: "! git grep ' blocktranslate ' | grep -v trimmed" | |
| - name: No use of the trans tag | |
| run: "! git grep '{% trans ' | grep -v 'run: git grep'" | |
| - name: There shouldn't be a showbrowser call in the code | |
| run: "! git grep '.showbrowser()' | grep -v 'run: git grep'" | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13", "3.14"] | |
| database: [ sqlite, mysql, postgres ] | |
| include: | |
| - database: sqlite | |
| database_url: "sqlite:///data/db.sqlite3" | |
| - database: mysql | |
| database_url: "mysql://root:root@127.0.0.1:3306/ephios" | |
| - database: postgres | |
| database_url: "psql://pytest:pass@127.0.0.1:5432" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup python and uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install gettext | |
| uv sync --dev --inexact --all-extras | |
| uv run pip install git+https://github.com/ephios-dev/ephios-testplugin | |
| - name: Prepare files for test run | |
| run: | | |
| cp .env.example .env | |
| uv run manage.py build | |
| - name: Setup postgres # postgres 14 on ubuntu 22.04 | |
| run: | | |
| sudo systemctl start postgresql.service | |
| pg_isready | |
| sudo -u postgres psql --command="CREATE USER pytest WITH CREATEDB PASSWORD 'pass'" | |
| if: matrix.database == 'postgres' | |
| - name: Setup mysql | |
| run: | | |
| sudo systemctl start mysql.service | |
| mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -proot -Dmysql | |
| if: matrix.database == 'mysql' | |
| - name: Make sure all migrations are up to date # apps specified explicitly to avoid checking migrations in dependencies | |
| run: uv run manage.py makemigrations --check core extra api complexsignup eventautoqualification federation files guests pages qualification_management simpleresource questionnaires | |
| - name: Test apps | |
| env: | |
| DATABASE_URL: ${{ matrix.database_url }} | |
| run: uv run coverage run -m pytest tests/ | |
| - name: Coveralls | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: uv run coveralls --service=github | |
| if: matrix.python-version == '3.11' && matrix.database == 'sqlite' |