-
Notifications
You must be signed in to change notification settings - Fork 11
130 lines (105 loc) · 3.77 KB
/
python.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
124
125
126
127
128
129
130
name: 🐍 Bindings
on:
push:
pull_request:
workflow_dispatch:
jobs:
test-bindings:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
container: ghcr.io/viennatools/vienna-builder:stock
- os: windows-latest
- os: macos-latest
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
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: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: 🦥 Cache Dependencies
uses: actions/cache@v4
with:
key: python-${{ matrix.os }}
path: build
- name: 🐍 Build and check Python Module (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
python -m venv venv
./venv/Scripts/activate.bat
pip install .
python -c "import viennals2d; print(viennals2d.__doc__)"
- name: 🐍 Build and check Python Module (Other)
if: ${{ matrix.os != 'windows-latest' }}
run: |
python -m venv venv
./venv/bin/pip install .
./venv/bin/python -c "import viennals2d; print(viennals2d.__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
container: ghcr.io/viennatools/vienna-builder:stock
- os: windows-latest
- os: macos-latest
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
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: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: 🛞 CIBuildWheel
run: python -m pip install cibuildwheel==2.17.0
- name: 🛠️ Build VTK (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
# sed -i 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_PACKAGE_PYTHON=ON"/g' pyproject.toml
sed -i 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_PACKAGE_PYTHON=ON","-DVIENNALS_IS_CI=ON"/g' pyproject.toml
type pyproject.toml
- name: 🛠️ Build VTK (MacOs)
if: ${{ matrix.os == 'macos-latest' }}
run: |
# sed -i .bak 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_PACKAGE_PYTHON=ON"/g' pyproject.toml
sed -i .bak 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_PACKAGE_PYTHON=ON","-DVIENNALS_IS_CI=ON"/g' pyproject.toml
cat pyproject.toml
- name: 🛠️ Use VTK-Python Libs
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
# sed -i 's/\(DVIENNALS_BUILD_PYTHON=ON"\)/\1,"-DVIENNALS_VTK_PYTHON_LIBS=ON"/g' pyproject.toml
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
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-*"
CIBW_ARCHS_WINDOWS: auto64
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl