⚡ [#621] add key value search to data #1880
Workflow file for this run
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: ci | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - '**' | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| IMAGE_NAME: maykinmedia/objects-api | |
| jobs: | |
| tests: | |
| strategy: | |
| matrix: | |
| postgres: ['14', '15', '16', '17'] | |
| postgis: ['3.2', '3.5'] | |
| use_pooling: [false] | |
| exclude: | |
| # postgis 3.2 is not compatible with recent postgres versions | |
| - postgres: '17' | |
| postgis: '3.2' | |
| - postgres: '16' | |
| postgis: '3.2' | |
| - postgres: '15' | |
| postgis: '3.2' | |
| include: | |
| - postgres: '17' | |
| postgis: '3.5' | |
| use_pooling: true | |
| name: Run the Django test suite (PG ${{ matrix.postgres }}, postgis ${{ matrix.postgis }}) ${{matrix.use_pooling && 'with connection pooling' || ''}} | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgis/postgis:${{ matrix.postgres }}-${{ matrix.postgis }} | |
| env: | |
| POSTGRES_HOST_AUTH_METHOD: trust | |
| 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 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up backend environment | |
| uses: maykinmedia/[email protected] | |
| with: | |
| apt-packages: 'libgdal-dev gdal-bin' | |
| python-version: '3.12' | |
| setup-node: true | |
| - name: Run tests | |
| run: | | |
| python src/manage.py collectstatic --noinput --link | |
| coverage run src/manage.py test src | |
| env: | |
| DJANGO_SETTINGS_MODULE: objects.conf.ci | |
| SECRET_KEY: dummy | |
| DB_USER: postgres | |
| DB_PASSWORD: '' | |
| DB_POOL_ENABLED: ${{ matrix.use_pooling }} | |
| - name: Publish coverage report | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| performance-tests: | |
| name: Run the performance test suite | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgis/postgis:17-3.5 | |
| env: | |
| POSTGRES_HOST_AUTH_METHOD: trust | |
| 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 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up backend environment | |
| uses: maykinmedia/[email protected] | |
| with: | |
| apt-packages: "libgdal-dev gdal-bin postgresql-client" | |
| python-version: "3.12" | |
| optimize-postgres: "no" | |
| setup-node: "no" | |
| - name: Set up uWSGI and generate data | |
| run: | | |
| createdb -h localhost -U postgres objects | |
| pip install uv | |
| uv pip install --system -r requirements/ci.txt | |
| src/manage.py migrate | |
| SCRIPTPATH=bin UWSGI_PROCESSES=4 UWSGI_THREADS=4 bin/docker_start.sh & | |
| src/manage.py shell < performance_test/create_data.py | |
| env: | |
| RUN_SETUP_CONFIG: false | |
| DB_PASSWORD: "" | |
| DB_USER: postgres | |
| DB_NAME: objects | |
| DB_HOST: localhost | |
| SECRET_KEY: secret | |
| DJANGO_SETTINGS_MODULE: objects.conf.production | |
| SITE_DOMAIN: localhost:8000 | |
| ALLOWED_HOSTS: localhost,127.0.0.1 | |
| FUZZY_PAGINATION: true | |
| DB_CONN_MAX_AGE: 60 | |
| - name: Install dependencies | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh | |
| pip install uv | |
| pkgs=$(cat requirements/performance-tests.in) | |
| grep -E "^($(echo $pkgs | sed 's/ /|/g'))([=<>]|$)" requirements/ci.txt | xargs uv pip install --system | |
| - run: python -m pip install --upgrade pip | |
| - run: python -m pip install locust | |
| - name: Run Locust tests | |
| run: | | |
| python -m locust --config performance_test/locust/locust.conf | |
| - name: Run tests for master branch | |
| if: github.ref == 'refs/heads/master' | |
| run: | | |
| bencher run --adapter python_pytest \ | |
| --project objects-ed2ce35-z71n5gf8t4f40 \ | |
| --token '${{ secrets.BENCHER_API_TOKEN }}' \ | |
| --branch master \ | |
| --testbed ubuntu-latest \ | |
| --average median \ | |
| --start-point-reset \ | |
| --github-actions '${{ secrets.GITHUB_TOKEN }}' \ | |
| --file output.json \ | |
| "pytest performance_test/tests/ --benchmark-json output.json" | |
| - name: Run tests for other branches | |
| if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| bencher run --adapter python_pytest \ | |
| --project objects-ed2ce35-z71n5gf8t4f40 \ | |
| --token '${{ secrets.BENCHER_API_TOKEN }}' \ | |
| --branch "$GITHUB_HEAD_REF" \ | |
| --start-point "$GITHUB_BASE_REF" \ | |
| --start-point-reset \ | |
| --start-point-max-versions 1 \ | |
| --average median \ | |
| --threshold-measure latency \ | |
| --threshold-test percentage \ | |
| --threshold-upper-boundary 0.05 \ | |
| --thresholds-reset \ | |
| --testbed ubuntu-latest \ | |
| --github-actions '${{ secrets.GITHUB_TOKEN }}' \ | |
| --file output.json \ | |
| "pytest performance_test/tests/ --benchmark-json output.json" | |
| docs: | |
| runs-on: ubuntu-latest | |
| name: Documentation build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up backend environment | |
| uses: maykinmedia/[email protected] | |
| with: | |
| apt-packages: 'libgdal-dev gdal-bin' | |
| python-version: '3.12' | |
| setup-node: false | |
| - name: Generate environment variable documentation using OAf and check if it was updated | |
| run: | | |
| bin/generate_envvar_docs.sh | |
| changes=$(git diff docs/installation/config.rst) | |
| if [ ! -z "$changes" ]; then | |
| echo $changes | |
| echo "Please update the environment documentation by running \`bin/generate_envvar_docs.sh\`" | |
| exit 1 | |
| fi | |
| env: | |
| DJANGO_SETTINGS_MODULE: objects.conf.ci | |
| store-reusable-workflow-vars: | |
| name: create values which can be passed through a reusable workflow | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image-name: ${{ steps.image-name.outputs.image-name }} | |
| steps: | |
| - run: echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT | |
| name: 'Store the docker image name' | |
| id: image-name | |
| open-api-ci: | |
| uses: maykinmedia/open-api-workflows/.github/workflows/ci.yml@v6 | |
| needs: | |
| - store-reusable-workflow-vars | |
| with: | |
| main-branch: 'master' | |
| apt-packages: 'libgdal-dev gdal-bin graphviz graphviz-dev' | |
| run-docs: true | |
| django-settings-module: objects.conf.ci | |
| python-version: '3.12' | |
| docker-image-name: ${{ needs.store-reusable-workflow-vars.outputs.image-name }} | |
| open-api-publish: | |
| uses: maykinmedia/open-api-workflows/.github/workflows/publish.yml@v6 | |
| needs: | |
| - store-reusable-workflow-vars | |
| - open-api-ci | |
| - tests | |
| with: | |
| docker-image-name: ${{ needs.store-reusable-workflow-vars.outputs.image-name }} | |
| repository-owner: 'maykinmedia' | |
| secrets: | |
| docker-username: ${{ secrets.DOCKER_USERNAME }} | |
| docker-token: ${{ secrets.DOCKER_TOKEN }} |