forked from solvespace/solvespace
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (177 loc) · 5.81 KB
/
python.yml
File metadata and controls
179 lines (177 loc) · 5.81 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
name: Python
on:
push:
branches: [ master ]
tags: [ v* ]
workflow_dispatch:
jobs:
python-sdist:
name: python sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git submodule update --init extlib/mimalloc extlib/eigen
- uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Pack
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
mkdir empty-build
cd empty-build
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
source version.env
cd ..
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
fi
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
python -m pip install -U setuptools build
python -m build --sdist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
python-wheel:
name: ${{ matrix.os_short }} python ${{ matrix.architecture }} cp${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os_arch: [
"windows-ia32",
"windows-x64",
# "windows-arm64",
"macos-x86_64",
"macos-arm64",
"linux-x86_64",
"linux-aarch64",
]
python_version: [
"37",
"38",
"39",
"310",
"311",
"312",
"313",
]
exclude:
- os_arch: "macos-arm64"
python_version: "37"
include:
- os_arch: "windows-ia32"
os: "windows-2022"
os_short: "windows"
architecture: "ia32"
cibuildwheel_architecture: "x86"
cmake_generator_platform: "Win32"
- os_arch: "windows-x64"
os: "windows-2022"
os_short: "windows"
architecture: "x64"
cibuildwheel_architecture: "AMD64"
cmake_generator_platform: "x64"
# - os_arch: "windows-arm64"
# os: "windows-2022"
# os_short: "windows"
# architecture: "arm64"
# cibuildwheel_architecture: "ARM64"
# cmake_generator_platform: "ARM64"
- os_arch: "macos-x86_64"
os: "macos-latest"
os_short: "macos"
cibuildwheel_architecture: "x86_64"
architecture: "x86_64"
- os_arch: "macos-arm64"
os: "macos-latest"
os_short: "macos"
cibuildwheel_architecture: "arm64"
architecture: "arm64"
- os_arch: linux-x86_64
os: "ubuntu-22.04"
os_short: "linux"
cibuildwheel_architecture: "x86_64"
architecture: "x86_64"
- os_arch: linux-aarch64
os: "ubuntu-22.04"
os_short: "linux"
cibuildwheel_architecture: "aarch64"
architecture: "aarch64"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git submodule update --init extlib/mimalloc extlib/eigen
- name: Set version
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
mkdir empty-build
cd empty-build
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
source version.env
cd ..
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
fi
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.architecture == 'aarch64'
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_BUILD: "cp${{ matrix.python_version }}-*"
CIBW_PLATFORM: "${{ matrix.os_short }}"
CIBW_BUILD_VERBOSITY: "1"
CIBW_ARCHS: "${{ matrix.cibuildwheel_architecture }}"
CIBW_ENVIRONMENT_WINDOWS: >
CMAKE_GENERATOR="Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}"
CIBW_ENVIRONMENT_PASS_WINDOWS: "CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM"
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.12
- uses: actions/upload-artifact@v4
with:
name: wheel-cp${{ matrix.python_version }}-${{ matrix.os_short }}-${{ matrix.architecture }}
path: |
./wheelhouse/*.whl
publish-pypi:
name: publish to PyPi
needs: [
python-sdist,
python-wheel,
]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
path: prebuilds
- name: prepare
shell: bash
run: |
mkdir dist
ls prebuilds
mv prebuilds/*/* dist
ls dist
- name: Publish wheels to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
attestations: false
verbose: true
- name: Publish wheels to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
attestations: false
verbose: true