docs(ogc): describe actively_monitored_wells as all-groups #2299
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
| # This workflow will install Python dependencies, run tests and lint with a single version of Python | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Test Suite | |
| on: | |
| pull_request: | |
| branches: ['production', 'staging', 'transfer'] | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| COVERAGE_FAIL_UNDER: "75" | |
| MODE: development | |
| POSTGRES_HOST: localhost | |
| POSTGRES_PORT: 5432 | |
| POSTGRES_USER: postgres | |
| PYGEOAPI_POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| PYGEOAPI_POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: ocotilloapi_test | |
| PYGEOAPI_POSTGRES_HOST: localhost | |
| PYGEOAPI_POSTGRES_PORT: 5432 | |
| PYGEOAPI_POSTGRES_DB: ocotilloapi_test | |
| DB_DRIVER: postgres | |
| BASE_URL: http://localhost:8000 | |
| AUTHENTIK_DISABLE_AUTHENTICATION: 1 | |
| services: | |
| postgis: | |
| image: postgis/postgis:17-3.5 | |
| # don't test against latest. be explicit in version being tested to avoid breaking changes | |
| # image: postgis/postgis:latest | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_PORT: 5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Check out source repository | |
| uses: actions/checkout@v7.0.1 | |
| - name: Wait for database readiness | |
| run: | | |
| for i in {1..60}; do | |
| if PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c "SELECT 1" >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "Database did not become ready in time" | |
| exit 1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v10.0.1 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: uv.lock | |
| - name: Set up Python | |
| id: setup-python | |
| uses: actions/setup-python@v7.0.0 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Cache project virtualenv | |
| id: cache-venv | |
| uses: actions/cache@v5 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('uv.lock') }} | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev --group cli --group ingestion | |
| - name: Show Alembic heads | |
| run: uv run alembic heads | |
| - name: Create test database and extensions | |
| run: | | |
| PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'ocotilloapi_test'" | grep -q 1 || \ | |
| PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE ocotilloapi_test" | |
| PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d ocotilloapi_test -c "CREATE EXTENSION IF NOT EXISTS postgis" | |
| - name: Run tests | |
| # --cov-fail-under is set here rather than in pyproject so that running a | |
| # single test file locally does not fail on the whole-project total. | |
| # --ignore=tests/transfers excludes the deprecated NM_Aquifer / NM_Wells | |
| # transfer tests; those scripts are frozen and run by hand against SQL | |
| # Server, so they must not gate a pull request. See transfers/README.md. | |
| run: uv run pytest -vv --durations=20 --cov --cov-report=xml --cov-report=html --cov-report=term-missing --cov-fail-under="$COVERAGE_FAIL_UNDER" --junitxml=junit.xml --ignore=tests/transfers | |
| - name: Write coverage summary | |
| # Runs even when the coverage gate above fails, so the job summary shows | |
| # which modules dropped rather than only the failing total. | |
| if: ${{ !cancelled() }} | |
| run: | | |
| { | |
| echo "## Coverage" | |
| echo | |
| echo '```' | |
| uv run coverage report | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Comment coverage summary on the pull request | |
| # A comment failure must not red the build, and the GITHUB_TOKEN is | |
| # read-only for pull requests opened from a fork. | |
| if: ${{ !cancelled() }} | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| gh pr diff "$PR_NUMBER" --name-only > changed-files.txt | |
| uv run python scripts/coverage_pr_comment.py \ | |
| --changed-files changed-files.txt \ | |
| --fail-under "$COVERAGE_FAIL_UNDER" > coverage-comment.md | |
| gh pr comment "$PR_NUMBER" \ | |
| --body-file coverage-comment.md \ | |
| --edit-last --create-if-none | |
| - name: Upload coverage reports | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ github.run_id }} | |
| path: | | |
| coverage.xml | |
| htmlcov/ | |
| junit.xml | |
| retention-days: 14 | |
| bdd-tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| MODE: development | |
| POSTGRES_HOST: localhost | |
| POSTGRES_PORT: 5432 | |
| POSTGRES_USER: postgres | |
| PYGEOAPI_POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| PYGEOAPI_POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: ocotilloapi_test | |
| PYGEOAPI_POSTGRES_HOST: localhost | |
| PYGEOAPI_POSTGRES_PORT: 5432 | |
| PYGEOAPI_POSTGRES_DB: ocotilloapi_test | |
| DB_DRIVER: postgres | |
| BASE_URL: http://localhost:8000 | |
| AUTHENTIK_DISABLE_AUTHENTICATION: 1 | |
| DROP_AND_REBUILD_DB: 1 | |
| services: | |
| postgis: | |
| image: postgis/postgis:17-3.5 | |
| # don't test against latest. be explicit in version being tested to avoid breaking changes | |
| # image: postgis/postgis:latest | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_PORT: 5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Check out source repository | |
| uses: actions/checkout@v7.0.1 | |
| - name: Wait for database readiness | |
| run: | | |
| for i in {1..60}; do | |
| if PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c "SELECT 1" >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "Database did not become ready in time" | |
| exit 1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v10.0.1 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: uv.lock | |
| - name: Set up Python | |
| id: setup-python | |
| uses: actions/setup-python@v7.0.0 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Cache project virtualenv | |
| id: cache-venv | |
| uses: actions/cache@v5 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('uv.lock') }} | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev --group cli --group ingestion | |
| - name: Show Alembic heads | |
| run: uv run alembic heads | |
| - name: Create test database and extensions | |
| run: | | |
| PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'ocotilloapi_test'" | grep -q 1 || \ | |
| PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE ocotilloapi_test" | |
| PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d ocotilloapi_test -c "CREATE EXTENSION IF NOT EXISTS postgis" | |
| - name: Run BDD tests | |
| run: uv run behave tests/features --tags="@backend and @production and not @skip" --no-capture |