Add information to chart source #12096
Workflow file for this run
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: backend | |
on: | |
workflow_dispatch: | |
paths: | |
- '**.py' | |
- 'requirements/**.txt' | |
- '**.html' | |
- '**.mo' | |
- '**.po' | |
pull_request: | |
paths: | |
- '**.py' | |
- 'requirements/**.txt' | |
- '**.html' | |
- '**.mo' | |
- '**.po' | |
merge_group: | |
paths: | |
- '**.py' | |
- 'requirements/**.txt' | |
- '**.html' | |
- '**.mo' | |
- '**.po' | |
jobs: | |
backend: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toxenv: | |
- lint | |
- validate-migrations | |
- validate-assets | |
- validate-translations | |
- unittest | |
services: | |
postgres: | |
# https://help.github.com/en/actions/configuring-and-managing-workflows/creating-postgresql-service-containers | |
# https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml | |
image: postgres:13 | |
env: | |
POSTGRES_USER: cfpb | |
POSTGRES_PASSWORD: cfpb | |
POSTGRES_DB: cfgov | |
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 | |
elasticsearch: | |
image: elasticsearch:7.10.1 | |
ports: | |
- 9200/tcp | |
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install gettext for translation validation | |
if: matrix.toxenv == 'validate-translations' | |
run: sudo apt-get install gettext | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements/ci.txt | |
- name: Run tox -e ${{ matrix.toxenv }} | |
run: | | |
tox -e ${{ matrix.toxenv }} | |
env: | |
TEST_RUNNER: core.testutils.runners.StdoutCapturingTestRunner | |
ES_PORT: ${{ job.services.elasticsearch.ports[9200] }} | |
- name: Prepare test coverage | |
if: matrix.toxenv == 'unittest' | |
run: coverage xml | |
- name: Store test coverage | |
# Submit coverage from our prefered tox run only | |
if: matrix.toxenv == 'unittest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: backend_coverage | |
path: ./coverage.xml | |
coverage: | |
runs-on: ubuntu-latest | |
needs: | |
- backend | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements/ci.txt | |
- name: Retrieve backend coverage | |
uses: actions/download-artifact@v4 | |
with: | |
name: backend_coverage | |
path: backend_coverage | |
- name: Check backend test coverage | |
run: | | |
diff-cover backend_coverage/coverage.xml --compare-branch=origin/main --fail-under=100 |