FIX: Compressed GTFS Edge Case (#472) #883
This file contains 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: Continuous Integration (Python) | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'pyproject.toml' | |
- 'poetry.lock' | |
- '.github/workflows/ci_python.yaml' | |
- '.github/python_deps/action.yaml' | |
pull_request: | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'pyproject.toml' | |
- 'poetry.lock' | |
- '.github/workflows/ci_python.yaml' | |
- '.github/python_deps/action.yaml' | |
defaults: | |
run: | |
shell: bash | |
working-directory: . | |
concurrency: | |
group: python-ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
name: Python Setup | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/python_deps | |
format: | |
name: Format | |
runs-on: ubuntu-22.04 | |
needs: setup | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/python_deps | |
- run: poetry run black . --check | |
typing: | |
name: Type Check | |
runs-on: ubuntu-22.04 | |
needs: setup | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/python_deps | |
- run: poetry run mypy . | |
lint: | |
name: Lint | |
runs-on: ubuntu-22.04 | |
needs: setup | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/python_deps | |
- run: poetry run pylint src tests --rcfile pyproject.toml | |
test: | |
name: Test | |
runs-on: ubuntu-22.04 | |
needs: setup | |
env: | |
BOOTSTRAPPED: 1 | |
MD_DB_HOST: local_rds | |
MD_DB_PORT: 5433 | |
MD_DB_NAME: metadata | |
MD_DB_USER: postgres | |
MD_DB_PASSWORD: postgres | |
ALEMBIC_MD_DB_NAME: metadata_prod | |
RPM_DB_HOST: local_rds | |
RPM_DB_PORT: 5434 | |
RPM_DB_NAME: performance_manager | |
RPM_DB_USER: postgres | |
RPM_DB_PASSWORD: postgres | |
ALEMBIC_RPM_DB_NAME: performance_manager_prod | |
services: | |
rpm_postgres: | |
image: postgres:14.4 | |
ports: | |
- 5434:5432 | |
env: | |
POSTGRES_PASSWORD: ${{env.RPM_DB_PASSWORD}} | |
POSTGRES_USER: ${{env.RPM_DB_USER}} | |
POSTGRES_DB: ${{env.RPM_DB_NAME}} | |
options: | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
md_postgres: | |
image: postgres:14.4 | |
ports: | |
- 5433:5432 | |
env: | |
POSTGRES_PASSWORD: ${{env.MD_DB_PASSWORD}} | |
POSTGRES_USER: ${{env.MD_DB_USER}} | |
POSTGRES_DB: ${{env.MD_DB_NAME}} | |
options: | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/python_deps | |
# Execute tests and generate coverage report | |
- name: Run pytest With Coverage | |
run: | | |
poetry run pytest \ | |
--cov-report lcov:coverage.info \ | |
--cov-report term-missing \ | |
--cov-branch \ | |
--cov=lamp_py | |
# Upload Coverage as an Artifact for Subsequent Jobs | |
- name: Report code coverage | |
uses: mbta/github-actions-report-lcov@v1 | |
with: | |
coverage-files: coverage.info | |
artifact-name: python-code-coverage | |
github-token: ${{ secrets.GITHUB_TOKEN }} |