-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (115 loc) · 3.85 KB
/
ci.yml
File metadata and controls
142 lines (115 loc) · 3.85 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
140
141
142
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Require approval for PRs from forks (first-time contributors)
# https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff mypy numpy psutil
- name: Lint with ruff
run: ruff check src tests
- name: Type check with mypy
run: mypy src/pygpukit --ignore-missing-imports --disable-error-code=union-attr --disable-error-code=no-redef --disable-error-code=no-any-return --disable-error-code=attr-defined --disable-error-code=assignment --disable-error-code=arg-type --disable-error-code=index --disable-error-code=misc
test:
runs-on: ${{ matrix.os }}
needs: lint
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov numpy psutil
- name: Run tests
run: pytest tests/ -v --cov=pygpukit --cov-report=xml --cov-report=term-missing
env:
PYTHONPATH: src
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
cmake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1 # Shallow clone for faster checkout
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pybind11
run: pip install pybind11
- name: Install CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.29
id: cuda-toolkit
with:
cuda: "13.0.2"
method: network
use-github-cache: true
use-local-cache: false
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: cuda-build-${{ runner.os }}
max-size: 500M
- name: Configure CMake
run: |
cd native
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_ARCHITECTURES="80;86;89;90;100;120a" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
-Dpybind11_DIR=$(python -c "import pybind11; print(pybind11.get_cmake_dir())")
- name: Build native module
run: |
cd native/build
cmake --build . --config Release -j$(nproc)
build:
runs-on: ubuntu-latest
needs: [test, cmake-check]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build sdist (wheels built in release workflow with CUDA)
run: python -m build --sdist
- name: Check package
run: twine check dist/*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/