File tree Expand file tree Collapse file tree 2 files changed +29
-22
lines changed
Expand file tree Collapse file tree 2 files changed +29
-22
lines changed Original file line number Diff line number Diff line change 1- name : Python package
1+ name : Python tests
22
33on :
44 pull_request :
55
6-
76jobs :
87 test :
98 name : Unit tests
109 runs-on : ubuntu-latest
11- continue-on-error : true
10+ services :
11+ postgres :
12+ image : postgres:15
13+ env :
14+ POSTGRES_HOST_AUTH_METHOD : trust
15+ options : >-
16+ --health-cmd pg_isready
17+ --health-interval 10s
18+ --health-timeout 5s
19+ --health-retries 5
20+ -p 5432:5432
1221 steps :
1322 - name : Checkout
1423 uses : actions/checkout@v4
15- - name : Set up docker
16- uses : docker-practice/actions-setup-docker@master
17- - name : Run postgres
18- run : |
19- docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name db-test postgres:15-alpine
2024 - uses : actions/setup-python@v4
2125 with :
22- python-version : ' 3.11'
26+ python-version : " 3.11"
2327 - name : Install dependencies
2428 run : |
2529 python -m ensurepip
2933 run : |
3034 DB_DSN=postgresql://postgres@localhost:5432/postgres alembic upgrade head
3135 - name : Build coverage file
36+ id : pytest
3237 run : |
3338 DB_DSN=postgresql://postgres@localhost:5432/postgres pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=userdata_api tests/ | tee pytest-coverage.txt
39+ exit ${PIPESTATUS[0]}
3440 - name : Print report
3541 if : always()
3642 run : |
5056 unique-id-for-comment : python3.11
5157 junitxml-path : ./pytest.xml
5258 junitxml-title : Summary
59+ - name : Fail on pytest errors
60+ if : steps.pytest.outcome == 'failure'
61+ run : exit 1
62+
5363 linting :
5464 runs-on : ubuntu-latest
5565 steps :
6272 requirementsFiles : " requirements.txt requirements.dev.txt"
6373 - uses : psf/black@stable
6474 - name : Comment if linting failed
65- if : ${{ failure() }}
75+ if : failure()
6676 uses : thollander/actions-comment-pull-request@v2
6777 with :
6878 message : |
Original file line number Diff line number Diff line change 88 python3.11 -m venv venv
99
1010format :
11- autoflake -r --in-place --remove-all-unused-imports ./userdata_api
12- isort ./userdata_api
13- black ./userdata_api
14-
15- dev-format : format
16- autoflake -r --in-place --remove-all-unused-imports ./tests
17- isort ./tests
18- black ./tests
19- autoflake -r --in-place --remove-all-unused-imports ./migrations
20- isort ./migrations
21- black ./migrations
22-
11+ source ./venv/bin/activate && autoflake -r --in-place --remove-all-unused-imports ./userdata_api
12+ source ./venv/bin/activate && isort ./userdata_api
13+ source ./venv/bin/activate && black ./userdata_api
14+ source ./venv/bin/activate && autoflake -r --in-place --remove-all-unused-imports ./tests
15+ source ./venv/bin/activate && isort ./tests
16+ source ./venv/bin/activate && black ./tests
17+ source ./venv/bin/activate && autoflake -r --in-place --remove-all-unused-imports ./migrations
18+ source ./venv/bin/activate && isort ./migrations
19+ source ./venv/bin/activate && black ./migrations
2320
2421db :
2522 docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name db-userdata_api postgres:15
You can’t perform that action at this time.
0 commit comments