-
Notifications
You must be signed in to change notification settings - Fork 116
81 lines (67 loc) · 2.03 KB
/
python-app.yml
File metadata and controls
81 lines (67 loc) · 2.03 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
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
name: Python package
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | bash
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Setup uv cache
uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/.uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Create virtual environment
run: |
uv venv
- name: Install dependencies with uv
run: |
source .venv/bin/activate
uv pip install pytest==7.4.3 mypy==1.7.1 ruff==0.1.6 pytest-cov
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
- name: Lint with ruff
run: |
source .venv/bin/activate
ruff check --exit-non-zero-on-fix
- name: Format with ruff
run: |
source .venv/bin/activate
ruff format --check
- name: Type check with mypy
run: |
source .venv/bin/activate
mypy . --check-untyped-defs
- name: Run tests with coverage
run: |
source .venv/bin/activate
pytest --cov=. --cov-report=html --cov-report=xml --junitxml=test-results.xml
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results.xml
- name: Upload HTML coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: htmlcov/