-
Notifications
You must be signed in to change notification settings - Fork 384
96 lines (80 loc) · 2.53 KB
/
ci.yml
File metadata and controls
96 lines (80 loc) · 2.53 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
name: CI
on:
push:
branches:
- main
- dev
pull_request:
workflow_dispatch:
env:
UV_CACHE_DIR: /tmp/.uv-cache
PROJECT_PATH: "src/memory_profiler"
jobs:
code-quality:
name: Check code quality
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: ⤵️ Checkout repository
uses: actions/checkout@v4
# https://github.com/astral-sh/setup-uv
- name: 🏗 Install uv and Python
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: ${{ env.UV_CACHE_DIR }}
python-version: "3.13"
- name: 🏗 Install the project
run: uv sync --locked --dev
- name: Run mypy
run: uv run --frozen mypy ${{ env.PROJECT_PATH }}/
- name: Pylint review
run: uv run --frozen pylint ${{ env.PROJECT_PATH }}/
- name: Ruff check
run: uv run --frozen ruff check ${{ env.PROJECT_PATH }}/
tests:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
# https://github.com/actions/checkout
- name: ⤵️ Checkout repository
uses: actions/checkout@v4
# https://github.com/astral-sh/setup-uv
- name: 🏗 Install uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: ${{ env.UV_CACHE_DIR }}
python-version: ${{ matrix.python-version }}
- name: 🏗 Install the project
run: uv sync --locked --dev
- name: Run pytest
run: uv run --frozen pytest tests/ --cov=./ --cov-report=xml --junitxml=pytest-report.xml
# https://github.com/actions/upload-artifact
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: pytest-report-${{ matrix.python-version }}
path: pytest-report.xml
# https://github.com/actions/upload-artifact
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-results-${{ matrix.python-version }}
path: coverage.xml
# # https://github.com/codecov/codecov-action
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true