forked from openPMD/openPMD-api
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (128 loc) · 5.51 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
name: wheels
on: [push, pull_request]
jobs:
build_wheels:
name: Build ${{ matrix.arch }} wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
arch: "x86_64"
- os: ubuntu-20.04
arch: "i686"
# builds faster on Travis-CI:
#- os: ubuntu-20.04
# arch: "aarch64"
# builds faster on Travis-CI:
#- os: ubuntu-20.04
# arch: "ppc64le"
# builds faster on Travis-CI:
# blocked by https://github.com/GTkorvo/dill/issues/15
#- os: ubuntu-20.04
# arch: "s390x"
# x86-64 (64bit)
- os: windows-2019
arch: "AMD64"
# x86 (32bit)
- os: windows-2019
arch: "x86"
env:
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_GENERATOR_PLATFORM: "Win32"
- os: macos-11
arch: "x86_64"
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
# Apple Silicon M1/arm64/aarch64 builds:
# https://cibuildwheel.readthedocs.io/en/stable/faq/#apple-silicon
# https://github.com/pypa/cibuildwheel/pull/704
- os: macos-11
arch: "arm64"
env:
CMAKE_OSX_ARCHITECTURES: "arm64"
MACOSX_DEPLOYMENT_TARGET: 11.0
# Apple universal builds that contain x86-64 and arm64 binary code
# Needs extra treatment of all librarys that are not CMake
# controlled the dependencies:
# https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
# ADIOS1 tricky to build and HDF5 even with CMake as well (as of 1.12)
# We could build them twice and use `lipo` to combine the lib artifacts.
#- os: macos-11
# arch: "universal2"
# env:
# CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
# MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- uses: actions/checkout@v2
with:
path: 'src'
ref: '0.15.2'
- uses: actions/checkout@v2
with:
path: 'src/.github/'
- uses: actions/setup-python@v1
name: Install Python
with:
python-version: '3.8'
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install cibuildwheel==2.16.2
# Hack: cmake --trace-expand
#- name: Download Patch 2/2
# uses: suisei-cn/actions-download-file@v1
# id: setupversion
# with:
# url: "https://gist.githubusercontent.com/ax3l/9b15c5bc73d7f3c1c66784187a016474/raw/e31dd54498c9c8fc465a7cbb6f900f768b9d0c0b/0001-Hack-setup.py-CMake-trace-expand.patch"
# target: src/.patch/
#- name: Apply Patches
# run: |
# python -m pip install patch
# cd src
# python -m patch .patch/0001-Hack-setup.py-CMake-trace-expand.patch
- name: Build wheel
env:
# (1) Disable PyPy (manylinux image: yum repo issues)
# https://github.com/pypa/manylinux/issues/899
CIBW_SKIP: "pp*-manylinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
# Install dependencies
CIBW_BEFORE_BUILD_LINUX: bash -x .github/library_builders.sh
CIBW_BEFORE_BUILD_MACOS: bash -x .github/library_builders.sh
CIBW_BEFORE_BUILD_WINDOWS: 'cmd /E:ON /V:ON /C .github\library_builders.bat'
# for the openPMD-api build, CMake shall search for
# static dependencies of HDF5 and ADIOS1 (see setup.py)
CIBW_ENVIRONMENT: HDF5_USE_STATIC_LIBRARIES='ON' ZLIB_USE_STATIC_LIBS='ON' ADIOS_USE_STATIC_LIBS='ON' openPMD_CMAKE_openPMD_USE_HDF5='ON' openPMD_CMAKE_openPMD_USE_ADIOS2='ON'
CIBW_ENVIRONMENT_WINDOWS: HDF5_USE_STATIC_LIBRARIES='ON' ZLIB_USE_STATIC_LIBS='ON' openPMD_CMAKE_openPMD_USE_HDF5='ON' openPMD_CMAKE_openPMD_USE_ADIOS2='ON' CMAKE_PREFIX_PATH='C:/Program Files (x86)/ADIOS2;C:/Program Files (x86)/blosc2;C:/Program Files (x86)/HDF5;C:/Program Files (x86)/ZFP;C:/Program Files (x86)/zlib'
# C++17 support in macOS 10.13+ (partial) and 10.14+ (std::visit) and 10.15+ (std::filesystem::path)
# https://cibuildwheel.readthedocs.io/en/stable/cpp_standards/#macos-and-deployment-target-versions
# arm64/aarch64 (M1/M2) requires 11.0+
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.env.MACOSX_DEPLOYMENT_TARGET }}"
CMAKE_OSX_ARCHITECTURES: "${{ matrix.env.CMAKE_OSX_ARCHITECTURES }}"
# Windows cross-compilation
CMAKE_GENERATOR: "${{ matrix.env.CMAKE_GENERATOR }}"
CMAKE_GENERATOR_PLATFORM: "${{ matrix.env.CMAKE_GENERATOR_PLATFORM }}"
# Show a bit more output (pip -v)
CIBW_BUILD_VERBOSITY: 1
run: |
cd src
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade cmake
python setup.py sdist --dist-dir ../wheelhouse
python -m cibuildwheel --output-dir ../wheelhouse
- uses: actions/upload-artifact@v1
name: Publish as GitHub artifact
with:
name: wheels
path: ./wheelhouse
- name: Publish on pypi.org
if: github.event_name == 'push' && github.repository == 'openPMD/openPMD-api' && github.ref == 'refs/heads/wheels'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypa_gh_action_upload }}
run: |
python -m pip install -U twine
python -m twine upload --skip-existing wheelhouse/*