-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (96 loc) · 2.87 KB
/
python-package.yml
File metadata and controls
126 lines (96 loc) · 2.87 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
124
125
126
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-native:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -e .[test,build]
python3 -m pip install build
- name: Test with pytest
run: pytest
- name: Build and test with twine
run: |
python3 -m build
twine check --strict dist/*
build-uv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: "Set up Python"
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Lint with black
run: uv run black --check .
- name: Lint with flake8
run: uv run flake8 . --show-source --statistics
- name: Lint with isort
run: uv run isort --check --diff .
- name: Check with mypy
run: uv run mypy src
- name: Test with pytest
run: uv run pytest
- name: Build and test with twine
run: |
uv build
uv run twine check --strict dist/*
- name: Upload built package
uses: actions/upload-artifact@v6
with:
name: Package
path: dist
# - name: Collect coverage
# if: ${{ matrix.python-version == '3.10' }}
# run:
# coverage html
#
# - name: Upload coverage report
# uses: actions/upload-artifact@v6
# if: ${{ matrix.python-version == '3.10' }}
# with:
# name: Coverage
# path: htmlcov
docs:
needs: [ build-native, build-uv ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r docs/requirements.txt
- name: Build documentation
run: |
sphinx-build -b html docs dist/docs
sphinx-build -b linkcheck docs dist/docs
- name: Upload documentation
uses: actions/upload-artifact@v6
with:
name: Docs
path: dist/docs