CI (GitHub Actions) and Tests

This repository uses GitHub Actions for continuous integration (CI). The current workflow runs documentation link checks, JavaScript tests, Python linting, and Python tests on every push and pull request.

Overview

Job What it does Blocks merge?
documentation-links Verifies markdown links in documentation/ and rendered /docs pages Yes
javascript-tests Runs Jest tests, uploads coverage Yes
python-lint Runs flake8 (blocking), black/isort (advisory) flake8 only
python-tests Runs pytest, uploads coverage Yes

Workflow Location

.github/workflows/tests.yml

When CI Runs

The workflow triggers on:

  • push to main, master, or develop
  • pull_request targeting main, master, or develop

Test Structure

stop_sync_osm_atlas/
├── tests/                       # Test suites directory
│   ├── js/                      # JavaScript tests (Jest)
│   │   ├── [setup.js](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/js/setup.js)             # Global mocks (Leaflet, app globals)
│   │   └── *.test.js            # Test files
│   ├── matching_pipeline/       # Matching pipeline tests (pytest)
│   │   ├── [test_matching.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/matching_pipeline/test_matching.py)     # Predicate and unit tests
│   │   ├── [test_small_pipeline.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/matching_pipeline/test_small_pipeline.py) # End-to-end integration
│   │   ├── [test_data_integration.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/matching_pipeline/test_data_integration.py) # Route data logic
│   │   └── [test_validators.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/matching_pipeline/test_validators.py)   # shared validation helpers
│   ├── [test_docs_links.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_docs_links.py)       # Docs route/link checks
│   ├── [test_filter_semantics.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_filter_semantics.py) # Filter algebra/semantics checks
│   ├── [test_async_export_payloads.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_async_export_payloads.py) # Async API endpoint tests
│   ├── [test_global_stats_service.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_global_stats_service.py) # Global stats logic
│   ├── [test_search_security.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_search_security.py)   # Search API security checks
│   └── [conftest.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/conftest.py)              # Shared fixtures
└── .github/workflows/
    └── tests.yml                # CI workflow definition

Coverage

Both test suites generate coverage reports:

Suite Artifact Name Location
JavaScript js-coverage-report coverage/
Python python-coverage-report htmlcov/

Coverage artifacts are available for download from the GitHub Actions run page.

Run Tests Locally

To keep local runs close to CI, use the same commands manually. The test service in docker-compose.yml is configured with all necessary dependencies for both the web app and the matching pipeline.

Run individual test suites:

# Matching pipeline tests
docker compose run --rm --no-deps --entrypoint '' \
    -e DATABASE_URI=sqlite:// \
    test python -m pytest tests/matching_pipeline/ -v

# Documentation link tests
docker compose run --rm --no-deps --entrypoint '' \
    -e DATABASE_URI=sqlite:// \
    test python -m pytest [tests/test_docs_links.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_docs_links.py) -v

# Backend / API tests
docker compose run --rm --no-deps --entrypoint '' \
    -e DATABASE_URI=sqlite:// \
    test python -m pytest [tests/test_async_export_payloads.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_async_export_payloads.py) [tests/test_filter_semantics.py](https://github.com/openTdataCH/stop_sync_osm_atlas/blob/main/tests/test_filter_semantics.py) -v

# JavaScript tests (host)
npm ci
npm test -- --coverage --ci

Optional JavaScript run in a throwaway container:

docker run --rm -v "$PWD":/work -w /work node:20 \
  sh -lc "npm ci && npm test -- --coverage --ci"
Tip

Unified Test Environment: The test service image includes all dependencies (including pandas, geospatial stack, and flask-testing). It is the recommended environment for running any Python test.

Run with Coverage

# JavaScript
npm run test:coverage

# Python (matches CI)
docker compose run --rm --no-deps --entrypoint '' \
    -e DATABASE_URI=sqlite:// \
    -e FLASK_ENV=testing \
    test python -m pytest tests/ --cov=matching_and_import_db --cov=backend --cov-report=html -v

Subpages

Page Content
8.1 Pipeline tests Pipeline test methodology, micro-dataset
8.2 Backend tests API and model logic coverage
8.3 JavaScript tests Jest setup, mocks, adding tests
Data update in progress
Elapsed: -- ETA: -- Phase: idle