-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (102 loc) · 3.47 KB
/
wheels.yml
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
name: Build Wheels
defaults:
run:
working-directory: .
on:
push:
branches:
- main
workflow_dispatch:
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-12]
steps:
- uses: actions/checkout@v4
with:
submodules: true
# Used to host cibuildwheel
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Upgrade pip to the latest version
run: |
if [[ "${{ matrix.os }}" == "macos-12" ]]; then
python3.8 -m pip install --upgrade pip
else
python -m pip install --upgrade pip
fi
shell: bash
- name: Clean previous builds
run: |
rm -rf build/
rm -rf dist/
rm -rf stubs/
rm -rf wheelhouse/
rm -rf *.egg-info
rm -rf /tmp/cibuildwheel/
rm -rf /project/build/
rm -rf /home/runner/work/maialib/maialib/build/
find . -name "CMakeCache.txt" -delete
shell: bash
- name: Install pybind11-stubgen and mypy
run: python -m pip install pybind11-stubgen==2.5.1 mypy setuptools
- name: Install maialib
run: python -m pip install .
- name: Generate stubs from Maiacore
run: pybind11-stubgen maialib.maiacore '--output-dir=./stubs/' --ignore-all-errors
- name: Generate stubs from Maiapy
run: stubgen --no-analysis ./maialib/maiapy/ -o ./stubs/ --include-docstrings --ignore-errors
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.18.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_MACOS: universal2
MACOSX_DEPLOYMENT_TARGET: 10.15
CIBW_BEFORE_ALL_LINUX: |
if [ -d ./stubs ]; then cp -rf ./stubs/* .; fi
rm -rf build/ *.egg-info /tmp/cibuildwheel/ /project/build/ /home/runner/work/maialib/maialib/build/
find . -name "CMakeCache.txt" -delete
find . -name "CMakeFiles" -exec rm -rf {} +
find . -name "cmake_install.cmake" -delete
find . -name "Makefile" -delete
CIBW_BEFORE_ALL_MACOS: |
if [ -d ./stubs ]; then cp -rf ./stubs/* .; fi
CIBW_BEFORE_ALL_WINDOWS: |
if exist .\stubs\ (xcopy /e /k /y .\stubs\* .)
CIBW_SKIP: cp36-* cp37-* pp37-* *-win32 *-manylinux_i686 *-manylinux_ppc64le *-manylinux_s390x *-musllinux_s390x
CIBW_ENVIRONMENT: |
CMAKE_ARGS="-DMAIALIB_VERSION_INFO=${{ steps.version.outputs.version }}"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
retention-days: 3
upload_all:
name: Upload All
needs: build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
path: dist
merge-multiple: true
- name: Verify downloaded wheels
run: ls -l dist
- name: Verify files
run: sha256sum dist/*.whl
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
env:
TWINE_VERBOSE: 1