-
Notifications
You must be signed in to change notification settings - Fork 257
106 lines (86 loc) · 2.87 KB
/
main.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
name: CI
on:
push:
branches: [ main ]
tags: [ "*" ]
pull_request:
branches: [ main ]
jobs:
build_wheels:
runs-on: ${{ matrix.target[0] }}
strategy:
fail-fast: false
matrix:
target: # [ os, cibuildwheel-platform ]
- [ macos-latest, macosx_x86_64 ]
- [ macos-latest, macosx_arm64 ]
- [ ubuntu-latest, manylinux_aarch64 ]
- [ ubuntu-latest, manylinux_x86_64 ]
- [ windows-latest, win_amd64 ]
python-version: [ "cp38-", "cp39-", "cp310-", "cp311-", "cp312-" ]
steps:
- uses: actions/checkout@v4
- name: Build CMake targets
run: |
mkdir cmake-build-release
cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install twine
- if: matrix.target[0] == 'ubuntu-latest'
name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheel
uses: pypa/[email protected]
env:
CIBW_ARCHS: all
CIBW_BUILD: ${{ matrix.python-version }}${{ matrix.target[1] }}
CIBW_BEFORE_TEST: pip install matplotlib
CIBW_TEST_COMMAND: cd {project}/Python && python advanced_example.py no_block && python simple_example.py no_block
CIBW_TEST_COMMAND_WINDOWS: cd /D {project}/Python && python advanced_example.py no_block && python simple_example.py no_block
CIBW_TEST_SKIP: "*-macosx_arm64" # fix CI warning
- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.python-version }}${{ matrix.target[1] }}
path: wheelhouse/*
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install numpy
python -m pip install twine
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*
publish:
runs-on: ubuntu-latest
needs: [ build_wheels, build_sdist ]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install twine
- name: Publish package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TOKEN }}
run: python -m twine upload --verbose --repository pypi artifacts/* --skip-existing