-
Notifications
You must be signed in to change notification settings - Fork 11
108 lines (100 loc) · 2.99 KB
/
checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Test packages
on:
push:
branches: ['main']
pull_request:
jobs:
unittest-backend:
name: Unit tests (backend)
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./backend
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
-p 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m ensurepip
python -m pip install --upgrade --no-cache-dir pip
python -m pip install --upgrade --no-cache-dir -r requirements.txt -r requirements.dev.txt
- name: Migrate DB
run: |
DB_DSN=postgresql://postgres@localhost:5432/postgres alembic upgrade head
- name: Build coverage file
run: |
DB_DSN=postgresql://postgres@localhost:5432/postgres pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=my_app_api tests/ | tee pytest-coverage.txt
- name: Print report
if: always()
run: |
cat pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
if: github.event_name == 'pull_request'
with:
pytest-coverage-path: ./pytest-coverage.txt
title: Coverage Report
badge-title: Code Coverage
hide-badge: false
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: false
remove-link-from-badge: false
junitxml-path: ./pytest.xml
junitxml-title: Summary
linting-backend:
name: Style tests (backend)
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./backend
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.11
- uses: isort/isort-action@master
with:
requirementsFiles: "requirements.txt requirements.dev.txt"
- uses: psf/black@stable
- name: Comment if linting failed
if: failure() && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
:poop: Code linting failed, use `black` and `isort` to fix it.
linting-frontend:
name: Style tests (frontend)
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install
run: npm ci
- name: Check
run: npm run check