-
Notifications
You must be signed in to change notification settings - Fork 45
196 lines (159 loc) · 4.77 KB
/
build.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
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
189
190
191
192
193
194
195
196
name: build
on: [push, pull_request]
jobs:
build-and-test-ubuntu:
name: Ubuntu (python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ libxerces-c-dev
- name: Install package
run: pip install .
- name: Install pytest
run: pip install pytest
- name: Run tests
run: python -m pytest tests
build-and-test-windows:
name: Windows (python ${{ matrix.python-version }})
runs-on: windows-2019
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: pye57
channels: conda-forge
miniconda-version: "latest"
- name: Install Dependencies
shell: pwsh
run: |
conda install -y xerces-c
- name: Configure MSVC console
uses: ilammy/msvc-dev-cmd@v1
- name: Install package
shell: pwsh
run: pip install .
- name: Install pytest
shell: pwsh
run: pip install pytest
- name: Run tests
shell: pwsh
run: python -m pytest tests
build-and-test-macos:
name: macOS (python ${{ matrix.python-version }})
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
working-directory: ./scripts
run: |
bash install_xerces_c.sh
- name: Install package
run: pip install .
- name: Install pytest
run: pip install pytest
- name: Run tests
run: python -m pytest tests
build_wheels:
name: Build wheels
runs-on: ${{ matrix.os }}
needs:
- build-and-test-ubuntu
- build-and-test-windows
- build-and-test-macos
if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
os: ["ubuntu-latest", "windows-2019", "macos-latest"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
python -m cibuildwheel --platform linux --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_LINUX: "bash scripts/install_xerces_c.sh"
- name: Build wheels (Windows)
if: matrix.os == 'windows-2019'
run: |
python -m cibuildwheel --platform windows --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_WINDOWS: "powershell scripts/install_xerces_c.ps1"
- name: Build wheels (macOS)
if: matrix.os == 'macos-latest'
run: |
python -m cibuildwheel --platform macos --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_LINUX: "bash scripts/install_xerces_c.sh"
- uses: actions/upload-artifact@v2
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
make_sdist:
name: Make sdist
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build-and-test-ubuntu
- build-and-test-windows
- build-and-test-macos
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v2
with:
name: sdist
path: dist/*.tar.gz
upload_all:
name: Upload to pypi
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
with:
name: wheels-macos-latest
path: dist
- uses: actions/download-artifact@v2
with:
name: sdist
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}