-
Notifications
You must be signed in to change notification settings - Fork 8
139 lines (137 loc) · 4.88 KB
/
python-ci.yml
File metadata and controls
139 lines (137 loc) · 4.88 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
127
128
129
130
131
132
133
134
135
136
137
138
139
name: 🐍 CI - Python Package
on:
push:
branches: [main, feature/*, release/*, hotfix/*]
pull_request:
branches: [main, develop]
repository_dispatch:
types: [create-pull-request]
jobs:
pre-commit:
if: github.repository == 'Anselmoo/spectrafit'
name: 🧹 Pre-commit
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: 🐍 Set up uv for pre-commit
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: 3.11
- name: 💾 Cache pre-commit
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: ✅ Pre-commit run
run: |
uv run pre-commit run --all-files --color=always
build:
if: github.repository == 'Anselmoo/spectrafit'
name: 🏗️ Build & Test Python ${{ matrix.python-version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
needs: pre-commit
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macOS-latest]
arch: [x64]
defaults:
run:
shell: bash
steps:
- name: 🛎️ Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: ${{ matrix.python-version }}
- name: 📦 Install the project
run: uv sync --all-extras --dev
- name: 🧪 Test SpectraFit
run: uv run --group dev --all-extras pytest spectrafit/
- name: 📊 Codecov
if: ${{ success() && !cancelled() }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
name: codecov-umbrella
flags: unittests
verbose: true
env_vars: OS,PYTHON
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
minimal-build:
if: github.repository == 'Anselmoo/spectrafit'
name: 🏗️ Minimal Build
runs-on: ubuntu-latest
needs: build
steps:
- name: 🛎️ Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: 🐍 Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: 📦 Install the project
run: |
uv sync --all-extras
uv run pip install -e .
install-build:
if: github.repository == 'Anselmoo/spectrafit'
name: 🏗️ Install from Wheel
runs-on: ubuntu-latest
needs: build
steps:
- name: 🛎️ Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: 🐍 Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: 🏗️ Setup the project
run: |
uv sync --all-extras
uv build
- name: 📦 Install the wheel
run: |
uv pip install dist/*.whl
uv run spectrafit -v
documentation:
if: github.repository == 'Anselmoo/spectrafit'
name: 📚 Build Documentation
runs-on: ubuntu-latest
needs: build
steps:
- name: 🛎️ Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: 🐍 Install uv and doc dependencies
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: 📦 Install the project
run: uv sync --all-extras --group docs
- name: 🛠️ Set git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: 🏗️ Build documentation
if: ${{ !contains(github.ref, 'refs/heads/main')}}
run: uv run --group docs --all-extras mkdocs build --clean
- name: 🚀 Deploy documentation develops
if: contains(github.ref, 'refs/heads/main')
run: uv run --group docs --all-extras mike deploy --push --update-aliases develop