-
Notifications
You must be signed in to change notification settings - Fork 86
187 lines (170 loc) · 6.23 KB
/
Copy pathci_mainline_only.yml
File metadata and controls
187 lines (170 loc) · 6.23 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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: mainline-only
on:
workflow_dispatch:
push:
branches:
- main
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Detect skip ci and docs changes
id: detect
uses: ./.github/actions/detect-skip-ci
with:
github_event_name: ${{ github.event_name }}
pr_base_ref: ${{ github.event.pull_request.base.ref || '' }}
pr_head_sha: ${{ github.event.pull_request.head.sha || '' }}
clang-tidy:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Set up uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- uses: ./.github/actions/detect-env-vars
id: env_vars
- name: Run clang-tidy
run: |
uv run --no-project --with "clang-tidy==21.1.1" \
python tests/lint/clang_tidy_precommit.py \
--build-dir=build-pre-commit \
--jobs=${{ steps.env_vars.outputs.cpu_count }} \
./src/ ./include ./tests
build-wheels:
name: Build wheels
needs: [prepare]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, arch: x86_64, linux_image: manylinux2014, build_sdist: "true"}
- {os: ubuntu-latest, arch: x86_64, linux_image: manylinux_2_28, build_sdist: "false"}
- {os: ubuntu-24.04-arm, arch: aarch64, linux_image: manylinux2014, build_sdist: "false"}
- {os: ubuntu-24.04-arm, arch: aarch64, linux_image: manylinux_2_28, build_sdist: "false"}
- {os: windows-latest, arch: AMD64, linux_image: "", build_sdist: "false"}
- {os: macos-14, arch: arm64, linux_image: "", build_sdist: "false"}
steps:
- name: Checkout repository (for local composite action)
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Build wheel
uses: ./.github/actions/build-wheel-for-publish
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
linux_image: ${{ matrix.linux_image }}
checkout_ref: ${{ github.sha }}
build_sdist: ${{ matrix.build_sdist }}
examples:
name: Run examples
needs: [prepare]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, python_version: "3.14"}
- {os: macos-14, python_version: "3.13"}
- {os: windows-latest, python_version: "3.12"}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Set up uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: ${{ matrix.python_version }}
activate-environment: true
- uses: ./.github/actions/detect-env-vars
id: env_vars
- name: Install dependencies for examples
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
uv pip install --reinstall --verbose --group torch -e .
uv pip install --reinstall --verbose numpy scikit-build-core torch-c-dlpack-ext
- name: Run example/quickstart (CPU) [posix]
if: ${{ runner.os != 'Windows' }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
pushd examples/quickstart
rm -rf build
bash run_all_cpu.sh
popd
- name: Run example/quickstart (CPU) [windows]
if: ${{ runner.os == 'Windows' }}
shell: cmd
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
cd examples\quickstart
call run_all_cpu.bat
- name: Run example/stable_c_abi [posix]
if: ${{ runner.os != 'Windows' }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
pushd examples/stable_c_abi
rm -rf build
bash run_all.sh
popd
- name: Run example/stable_c_abi [windows]
if: ${{ runner.os == 'Windows' }}
shell: cmd
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
cd examples\stable_c_abi
call run_all.bat
- name: Run example/python_packaging [posix]
if: ${{ runner.os != 'Windows' }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
pushd examples/python_packaging
# This directory will be auto-generated in `CMakeLists.txt` by setting `STUB_INIT ON`
rm -rf python/my_ffi_extension
uv pip install --verbose . --no-build-isolation
python run_example.py
popd
- name: Run example/python_packaging [windows]
if: ${{ runner.os == 'Windows' }}
shell: pwsh
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
Set-Location examples/python_packaging
Remove-Item -Recurse -Force python/my_ffi_extension
uv pip install --verbose . --no-build-isolation
python run_example.py