Update config.py #69
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: TDD CI Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
# the build job | |
build: | |
# runner | |
runs-on: ubuntu-latest | |
container: python:3.11-slim | |
# required services | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: pgs3cr3t | |
POSTGRES_DB: testdb | |
ports: | |
- 5432:5432 | |
# set health checks to wait until postgress has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# commands for following steps also present in Makefile | |
- name: Install dependencies | |
run: | | |
python -m pip install poetry | |
poetry config virtualenvs.create false | |
poetry lock | |
poetry install | |
- name: Linting | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics | |
# test for complexity. The GitHub editor is 127 chars wide | |
flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics | |
# Run pylint to catch other PEP8 errors | |
pylint service tests --max-line-length=127 | |
- name: Run unit tests with PyTest | |
run: pytest --pspec --cov=service --cov-fail-under=95 | |
env: | |
DATABASE_URI: "postgresql+psycopg://postgres:pgs3cr3t@postgres:5432/testdb" | |
- name: Upload code coverage | |
uses: codecov/[email protected] |