Improve performance of the table trim to max_records #1311
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: pytest | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.13'] | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_PASSWORD: postgres_password | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| python-version-file: .python-version | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Install prerequisites | |
| run: | | |
| sudo apt update | |
| sudo apt install -y libpq-dev postgresql postgresql-client | |
| - name: Install Daiquiri | |
| run: | | |
| uv venv --python ${{ matrix.python-version }} && uv pip install -e .[ci] | |
| - name: Prepare testing app | |
| run: | | |
| mkdir -p testing/log testing/download/user | |
| - name: Prepare PostgreSQL database | |
| run: | | |
| psql postgresql://postgres:postgres_password@localhost:5432 -f testing/sql/postgres/setup.sql | |
| psql postgresql://postgres:postgres_password@localhost:5432/test_daiquiri_data -c 'VACUUM ANALYSE;' | |
| - name: Grant schema privileges | |
| run: | | |
| psql postgresql://postgres:postgres_password@localhost:5432 -c "GRANT ALL PRIVILEGES ON SCHEMA public TO daiquiri_app;" | |
| psql postgresql://postgres:postgres_password@localhost:5432 -c "GRANT ALL PRIVILEGES ON SCHEMA public TO daiquiri_data;" | |
| psql postgresql://postgres:postgres_password@localhost:5432 -c "ALTER DATABASE test_daiquiri_app OWNER TO daiquiri_app;" | |
| psql postgresql://postgres:postgres_password@localhost:5432 -c "ALTER DATABASE test_daiquiri_data OWNER TO daiquiri_data;" | |
| - name: Run Django migrations | |
| run: | | |
| export PYTHONPATH=$(pwd) | |
| uv run django-admin migrate --noinput --settings=testing.config.settings | |
| uv run django-admin migrate --database=tap --noinput --settings=testing.config.settings | |
| uv run django-admin migrate --database=oai --noinput --settings=testing.config.settings | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=$(pwd) | |
| uv run pytest --reuse-db --migrations --cov=daiquiri --cov-report=xml | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COVERALLS_FLAG_NAME: 'postgres: ${{ matrix.python-version }}' | |
| DJANGO_SETTINGS_MODULE: testing.config.settings | |
| - name: Publish to coveralls.io | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| path-to-lcov: coverage.xml | |
| fail-on-error: false | |
| parallel: false |