-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (74 loc) · 2.63 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Continuous Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
env:
UV_CACHE_DIR: /tmp/uv-cache
jobs:
ci:
name: CI - Python ${{ matrix.python-version }}
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: [3.11, 3.12, 3.13]
fail-fast: true
timeout-minutes: 20
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup UV Environment
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Cache UV Dependencies
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ matrix.python-version }}-${{ runner.os }}
- name: Install and Sync Dependencies
run: uv sync
- name: Run Ruff Formatting
run: uv run ruff format ./
- name: Run Ruff Checks
run: uv run ruff check --fix ./
- name: Run MyPy Static Typing Checks
run: uv run mypy ./
- name: Run Pylint Linting
run: uv run pylint ./
- name: Run Bandit Security Checks
run: uv run bandit -c pyproject.toml -r ./
- name: Run Unit Tests with Pytest
run: uv run pytest ./
- name: Scan Codebase with SonarCloud
if: matrix.python-version == '3.13'
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build Documentation
run: uv run --extra=docs make clean html --directory docs/
- name: Deploy Documentation to GitHub Pages
if: matrix.python-version == '3.13' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
- name: Upload Test Coverage Report to Codecov
if: matrix.python-version == '3.13' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
- name: Upload Test Results to Codecov
if: failure() && matrix.python-version == '3.13' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}