-
Notifications
You must be signed in to change notification settings - Fork 137
123 lines (103 loc) · 3.04 KB
/
lint_build_test.yaml
File metadata and controls
123 lines (103 loc) · 3.04 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Mistral Common CI
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
# we cancel all runs of previous commits in PR. On main we run the CI on all commits
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'no-pr' }}
cancel-in-progress: ${{ github.event.pull_request.number != null }}
jobs:
lint:
if: ${{ github.event.pull_request.draft != true }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
python-version: "3.12"
enable-cache: true
# Install
- name: Install Dependencies
run: |
uv sync --frozen --all-extras --group dev
# Ruff Linter
- name: Ruff Linter
run: |
uv run ruff check .
# Ruff Format
- name: Ruff Format
run: |
uv run ruff format . --check
- name: Check uv lock
run: |
uv lock --check
test:
if: ${{ github.event.pull_request.draft != true }}
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
# Support all LTS versions of Python
python-version: [
"3.10",
"3.11",
"3.12",
"3.13"
]
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
# Install
- name: Install Dependencies
run: |
uv sync --frozen --all-extras --group dev
- name: Mypy Check
run: |
uv run mypy --python-version ${{ matrix.python-version }} .
# PyTest
- name: Tests
run: |
uv run pytest --cov=mistral_common . --cov-report "xml:coverage.xml"
# Save coverage report as artifact so it's not discarded after the job ends
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
# Doctests
- name: Doctests
run: |
uv run pytest --doctest-modules ./src
build_docs:
if: ${{ github.event.pull_request.draft != true }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
python-version: "3.12"
enable-cache: true
- name: Install Dependencies
run: |
uv sync --frozen --all-extras --group docs
- name: Build Docs
run: |
uv run mkdocs build --strict