-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (45 loc) · 1.32 KB
/
backend.yaml
File metadata and controls
56 lines (45 loc) · 1.32 KB
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
name: Backend CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
jobs:
test:
name: Run backend tests with coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r backend/requirements.txt
pip install flake8 pytest-cov # Install pytest-cov for coverage
- name: Run backend tests with coverage
run: |
source venv/bin/activate
pytest --cov=backend --cov-report=xml --cov-report=term-missing -v
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml # Uploads the coverage report as an artifact
- name: Lint backend code
run: |
source venv/bin/activate
flake8 backend/