This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (121 loc) · 4.31 KB
/
build.yaml
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
# Automatically build binary wheels and source packages.
name: cibuildwheel
# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]
# Do not build Python <=2.7, <=3.5, or PyPy.
# Install Linux and MacOS required libraries / tools.
env:
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6"
CIBW_SKIP: "cp27-* cp35-* pp*"
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}"
CIBW_DEPENDENCY_VERSIONS: "pinned"
CIBW_ARCHS: auto
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macOS-10.15]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Prepare Windows x86 builds
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.0"
arch: "x86"
- name: Build Windows x86 wheels
if: runner.os == 'Windows'
uses: pypa/cibuildwheel@v2.11.2
env:
CIBW_BUILD: "*win32"
CIBW_BEFORE_BUILD_WINDOWS: "call xmlstarlet\\setup_msvc.bat"
CIBW_ENVIRONMENT_WINDOWS: >
CIBW_ARCHS_WINDOWS=auto32
PLATFORM_NAME=x86
DISTUTILS_USE_SDK=1
MSSdk=1
with:
package-dir: .
output-dir: wheelhouse
- name: Prepare Windows x64 builds
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.0"
arch: "x64"
- name: Build Windows x86 wheels
if: runner.os == 'Windows'
uses: pypa/cibuildwheel@v2.11.2
env:
CIBW_BUILD: "*win_amd64"
CIBW_BEFORE_BUILD_WINDOWS: "call xmlstarlet\\setup_msvc.bat"
CIBW_ENVIRONMENT_WINDOWS: >
CIBW_ARCHS_WINDOWS=auto64
PLATFORM_NAME=amd64
DISTUTILS_USE_SDK=1
MSSdk=1
with:
package-dir: .
output-dir: wheelhouse
- name: Build Linux and MacOS wheels
if: runner.os != 'Windows'
uses: pypa/cibuildwheel@v2.11.2
env:
CIBW_SKIP: "*win*"
CIBW_BEFORE_ALL_LINUX: >
yum install -y libxslt-devel ||
apt-get -y install libxslt1-dev libxml2-dev ||
apk add libxml2-dev libxslt-dev
CIBW_BEFORE_ALL_MACOS: >
brew uninstall --force --ignore-dependencies libxml2 libxslt libffi &&
brew cleanup -s libxml2 libxslt libffi &&
brew cleanup --prune-prefix &&
brew install libxml2 libxslt automake pkg-config
CIBW_ENVIRONMENT_MACOS: >
ARCHFLAGS="-arch x86_64"
PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/libxslt/lib/pkgconfig"
LDFLAGS="-L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib"
CPPFLAGS="-I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libffi/include"
PATH="/usr/local/opt/libxslt/bin:/usr/local/opt/libxml2/bin:$PATH"
with:
package-dir: .
output-dir: wheelhouse
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist_and_test:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.7'
- name: Build sdist and run tests
run: |
sudo apt-get install -yqq libxslt1-dev libxml2-dev
pip install --upgrade pip setuptools wheel "cibuildwheel>=2.8.1"
pip --disable-pip-version-check install -r requirements.txt
pip --disable-pip-version-check install -r requirements_dev.txt
invoke test coverage
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist_and_test]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}