88 test :
99 name : Unit tests
1010 runs-on : ubuntu-latest
11+ env :
12+ DB_DSN : postgresql://postgres@localhost:5432/postgres
13+ REDIS_DSN : redis://localhost:6379/0
14+
15+ services :
16+ postgres :
17+ image : postgres:15
18+ ports :
19+ - 5432:5432
20+ env :
21+ POSTGRES_HOST_AUTH_METHOD : trust
22+ options : >-
23+ --health-cmd pg_isready
24+ --health-interval 10s
25+ --health-timeout 5s
26+ --health-retries 5
27+
28+ redis :
29+ image : redis
30+ ports :
31+ - 6379:6379
32+ options : >-
33+ --health-cmd "redis-cli ping"
34+ --health-interval 10s
35+ --health-timeout 5s
36+ --health-retries 5
37+
1138 steps :
1239 - name : Checkout
1340 uses : actions/checkout@v4
14- - name : Set up docker
15- uses : docker-practice/actions-setup-docker@master
41+
1642 - uses : actions/setup-python@v4
1743 with :
1844 python-version : ' 3.11'
45+
1946 - name : Install dependencies
2047 run : |
2148 python -m ensurepip
2249 python -m pip install --upgrade pip
2350 pip install -r requirements.txt -r requirements.dev.txt
24- - name : Run postgres
25- run : |
26- make db
51+
2752 - name : Migrate DB
2853 run : |
29- make migrate
30- - name : Run redis
31- run : |
32- make redis
54+ alembic upgrade head
55+
3356 - name : Build coverage file
3457 run : |
35- DB_DSN=postgresql://postgres@localhost:5432/postgres pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=print_service tests/ | tee pytest-coverage.txt
58+ pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=print_service tests/ | tee pytest-coverage.txt
59+
3660 - name : Print report
3761 if : always()
3862 run : |
3963 cat pytest-coverage.txt
64+
4065 - name : Pytest coverage comment
4166 uses : MishaKav/pytest-coverage-comment@main
4267 with :
@@ -51,17 +76,23 @@ jobs:
5176 remove-link-from-badge : false
5277 junitxml-path : ./pytest.xml
5378 junitxml-title : Summary
79+
80+
5481 linting :
5582 runs-on : ubuntu-latest
5683 steps :
5784 - uses : actions/checkout@v4
85+
5886 - uses : actions/setup-python@v2
5987 with :
6088 python-version : 3.11
89+
6190 - uses : isort/isort-action@master
6291 with :
6392 requirementsFiles : " requirements.txt requirements.dev.txt"
93+
6494 - uses : psf/black@stable
95+
6596 - name : Comment if linting failed
6697 if : ${{ failure() }}
6798 uses : thollander/actions-comment-pull-request@v2
0 commit comments