-
Notifications
You must be signed in to change notification settings - Fork 14
188 lines (151 loc) · 5.55 KB
/
python.yml
File metadata and controls
188 lines (151 loc) · 5.55 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
name: 🐍 Bindings
on:
release:
types:
- published
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
publish:
type: boolean
description: Publish on PyPi
jobs:
test-bindings:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
container: ghcr.io/viennatools/vienna-builder:cuda-suite-python-nocuda
- os: windows-latest
- os: macos-latest
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/.vcpkg-bincache
name: "🐍 Test Bindings on ${{ matrix.os }}"
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 🖥️ Setup Environment
uses: ./.github/actions/setup
with:
os: ${{ matrix.os }}
- name: 📋 Install MacOS Dependencies
if: ${{ matrix.os == 'macos-latest' }}
run: brew install vtk
- name: Create vcpkg binary cache dir
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"
- name: 🦥 Cache VTK vcpkg build
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: vcpkg-${{ matrix.os }}-Release
- name: 🛠️ Build VTK (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
./vcpkg/vcpkg install vtk
- name: 🛠️ Disable IPO
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sed -i 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DUSE_IPO=off"/g' pyproject.toml
cat pyproject.toml
- name: 🐍 Build and check Python Module (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
python -m venv venv
$toolchain = "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake".Replace('\', '/')
.\venv\Scripts\python -m pip install --upgrade pip
.\venv\Scripts\python -m pip install . --config-settings=cmake.args="-DCMAKE_TOOLCHAIN_FILE=$toolchain"
.\venv\Scripts\python -c "import viennals; print(viennals.__doc__)"
- name: 🐍 Build and check Python Module (Other)
if: ${{ matrix.os != 'windows-latest' }}
run: |
python -m venv venv
CMAKE_ARGS=-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF ./venv/bin/pip install .
./venv/bin/python -c "import viennals; print(viennals.__doc__)"
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Pre-Built (${{ matrix.os }})
path: venv
package:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
skip: "cp36-* cp37-* cp38-* cp39-* pp37-* pp38-* pp39-* *-manylinux_i686 *-musllinux_*"
- os: windows-latest
skip: "cp36-* cp37-* cp38-* cp39-* pp37-* pp38-* pp39-*"
- os: macos-latest
skip: "cp36-* cp37-* cp38-* cp39-* cp310-* pp37-* pp38-* pp39-*"
runs-on: ${{ matrix.os }}
name: "🐍 Package Bindings on ${{ matrix.os }}"
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 🖥️ Setup Environment
uses: ./.github/actions/setup
with:
os: ${{ matrix.os }}
- name: 🛞 CIBuildWheel
run: pip install cibuildwheel==3.4.0 --break-system-packages
- name: 🛠️ Package Config (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
sed -i 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_PACKAGE_PYTHON=ON","-DVIENNALS_IS_CI=ON"/g' pyproject.toml
type pyproject.toml
- name: 🛠️ Package Config (MacOs)
if: ${{ matrix.os == 'macos-latest' }}
run: |
sed -i .bak 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_PACKAGE_PYTHON=ON","-DVIENNALS_IS_CI=ON"/g' pyproject.toml
cat pyproject.toml
- name: 🛠️ Package Config (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sed -i 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_PACKAGE_PYTHON=ON","-DVIENNALS_IS_CI=ON"/g' pyproject.toml
cat pyproject.toml
- name: 🏗️ Build Wheels (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: ${{ matrix.skip }}
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/viennatools/vienna-builder:cuda-python-nocuda
- name: 🏗️ Build Wheels (Other)
if: ${{ matrix.os != 'ubuntu-latest' }}
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: ${{ matrix.skip }}
CIBW_ARCHS_WINDOWS: auto64
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
deploy:
if: ${{ github.event_name == 'release' || github.event.inputs.publish == 'true' }}
needs: [package]
permissions:
id-token: write
runs-on: ubuntu-latest
name: "🐍 Publish Bindings"
steps:
- name: 📦 Download Wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: 🚀 Publish Wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true