-
Notifications
You must be signed in to change notification settings - Fork 0
226 lines (186 loc) · 6.69 KB
/
Copy pathci.yml
File metadata and controls
226 lines (186 loc) · 6.69 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# TraceSmith - Continuous Integration
# Runs on every push and PR to test compilation and unit tests
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
# ===========================================================================
# Lint & Format Check
# ===========================================================================
lint:
name: Lint & Format
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 linters
run: |
pip install ruff mypy
- name: Run ruff
run: ruff check python/ --ignore E501,F401,F841,E731,E722,N806,N812,B007,B028
- name: Check C++ formatting (clang-format)
run: |
sudo apt-get install -y clang-format
find src include -name "*.cpp" -o -name "*.hpp" | head -20 | xargs clang-format --dry-run --Werror || true
# ===========================================================================
# Build & Test on Linux
# ===========================================================================
test_linux:
name: Test Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
build_type: [Release, Debug]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build libunwind-dev pkg-config
if [ "${{ matrix.compiler }}" = "clang" ]; then
sudo apt-get install -y clang
fi
- name: Configure CMake
env:
CC: ${{ matrix.compiler == 'clang' && 'clang' || 'gcc' }}
CXX: ${{ matrix.compiler == 'clang' && 'clang++' || 'g++' }}
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DTRACESMITH_BUILD_TESTS=ON \
-DTRACESMITH_BUILD_EXAMPLES=ON \
-DTRACESMITH_BUILD_CLI=ON
- name: Build
run: cmake --build build --parallel 4
- name: Run tests
run: |
cd build
ctest --output-on-failure --parallel 4
- name: Test CLI
run: |
echo "=== Build output structure ==="
ls -la build/bin/
echo "=== Running CLI tests ==="
./build/bin/tracesmith --version
./build/bin/tracesmith devices || echo "Note: No GPU detected (expected in CI)"
# ===========================================================================
# Build & Test on macOS
# ===========================================================================
test_macos:
name: Test macOS
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
build_type: [Release]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install cmake ninja
- name: Configure CMake
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DTRACESMITH_BUILD_TESTS=ON \
-DTRACESMITH_BUILD_EXAMPLES=ON \
-DTRACESMITH_BUILD_CLI=ON \
-DTRACESMITH_ENABLE_METAL=ON
- name: Build
run: cmake --build build --parallel 4
- name: Run tests
run: |
cd build
ctest --output-on-failure --parallel 4
- name: Test CLI
run: |
./build/bin/tracesmith --version
# ===========================================================================
# Build & Test on Windows
# ===========================================================================
test_windows:
name: Test Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build_type: [Release]
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTRACESMITH_BUILD_TESTS=ON -DTRACESMITH_BUILD_CLI=ON
- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel 4
- name: Run tests
run: |
cd build
ctest -C ${{ matrix.build_type }} --output-on-failure
# ===========================================================================
# Python Package Test
# ===========================================================================
test_python:
name: Test Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build libunwind-dev pkg-config
pip install --upgrade pip
pip install pytest numpy
- name: Build & Install package
run: |
pip install -e . -v
- name: Test import
run: |
python -c "import tracesmith; print(f'TraceSmith v{tracesmith.__version__}')"
python -c "import tracesmith as ts; print('Platforms:', ts.detect_platform())"
- name: Test CLI
run: |
tracesmith-cli --version
tracesmith-cli devices
# ===========================================================================
# CUDA Build Test (no GPU required)
# ===========================================================================
test_cuda_build:
name: Test CUDA Build
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.1.0-devel-ubuntu22.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y cmake ninja-build libunwind-dev python3 python3-pip git pkg-config
- name: Configure CMake with CUDA
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DTRACESMITH_ENABLE_CUDA=ON \
-DTRACESMITH_BUILD_CLI=ON \
-DTRACESMITH_BUILD_EXAMPLES=ON
- name: Build
run: cmake --build build --parallel 4
- name: Check CUDA support
run: |
ls -la build/bin/ || echo "bin directory not found"
./build/bin/tracesmith --version || echo "CLI test skipped (CUDA container)"
echo "CUDA build successful!"