Skip to content

feat(bus): add remarks for waived records (#709) #1797

feat(bus): add remarks for waived records (#709)

feat(bus): add remarks for waived records (#709) #1797

Workflow file for this run

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
# the test suite is split up into multiple jobs here to speed in running in CI
# the dominant tests are the sequential-required Rail DB tests
# the artifacts are uploaded, and then downloaded by the final codecov job to
# gather and process all of the codecov artifacts for a final report
testraildb:
name: TestRailDatabase
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 tests/performance_manager/test_performance_manager.py \
--cov-report lcov:lamp_codecov/coverage_rail_db.info \
--cov-report term-missing \
--cov-branch \
--cov=lamp_py
- uses: actions/upload-artifact@v4
with:
# name is arbitrary - must not be default becuse otherwise artifact names would conflict
name: upload-codecov-artifact-rail-db
path: lamp_codecov/coverage_rail_db.info
testrail:
name: TestRail
runs-on: ubuntu-22.04
needs: setup
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 -n auto tests/performance_manager \
--ignore=tests/performance_manager/test_performance_manager.py \
--cov-report lcov:lamp_codecov/coverage_rail.info \
--cov-report term-missing \
--cov-branch \
--cov=lamp_py
- uses: actions/upload-artifact@v4
with:
# name is arbitrary - must not be default becuse otherwise artifact names would conflict
name: upload-codecov-artifact-rail
path: lamp_codecov/coverage_rail.info
testbus:
name: TestBus
runs-on: ubuntu-22.04
needs: setup
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 -n auto tests/bus_performance_manager \
--cov-report lcov:lamp_codecov/coverage_bus.info \
--cov-report term-missing \
--cov-branch \
--cov=lamp_py
- uses: actions/upload-artifact@v4
with:
# name is arbitrary - must not be default becuse otherwise artifact names would conflict
name: upload-codecov-artifact-bus
path: lamp_codecov/coverage_bus.info
testother:
name: TestOther
runs-on: ubuntu-22.04
needs: setup
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 -n auto \
--ignore=tests/performance_manager \
--ignore=tests/bus_performance_manager \
--cov-report lcov:lamp_codecov/coverage_other.info \
--cov-report term-missing \
--cov-branch \
--cov=lamp_py
- uses: actions/upload-artifact@v4
with:
# name is arbitrary - must not be default becuse otherwise artifact names would conflict
name: upload-codecov-artifact-other
path: lamp_codecov/coverage_other.info
uploadcodedov:
name: CodeCov
runs-on: ubuntu-22.04
needs:
- setup
- testraildb
- testrail
- testbus
- testother
steps:
- uses: actions/checkout@v3
- name: download-artifact
uses: actions/download-artifact@v4
with:
path: lamp_codecov/
- name: Display structure of downloaded files
run: ls -R lamp_codecov/
# Upload Coverage as an Artifact for Subsequent Jobs
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- name: Report code coverage
uses: mbta/github-actions-report-lcov@v4
with:
coverage-files: lamp_codecov/*/coverage_*.info
artifact-name: python-code-coverage
github-token: ${{ secrets.GITHUB_TOKEN }}