-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (54 loc) · 1.72 KB
/
ci.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
name: Python CI/CD Workflow
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9-slim', '3.10-slim', '3.11-slim']
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage flake8
- name: Set Environment Variables
run: echo "DJANGO_SETTINGS_MODULE=dropship_project.settings" >> $GITHUB_ENV
- name: Run Tests
run: python manage.py test
- name: Generate Coverage Report
run: |
coverage run --source='.' manage.py test
coverage report
coverage xml -o coverage.xml
if: always()
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
if: always()
- name: Lint Code with Flake8
run: flake8 .
- name: Cleanup Pip Cache
run: python -m pip cache purge
if: always()