-
Notifications
You must be signed in to change notification settings - Fork 1
248 lines (214 loc) · 7.83 KB
/
ci.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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Continuous Integration
on:
push:
branches:
- main
tags:
- "*"
pull_request:
schedule:
- cron: '30 2 * * 1,4' # Every Monday and Thursday @ 2h30am UTC
env:
HOST_PYTHON_VERSION: "3.10"
VCPKG_INSTALLED_DIR: /tmp/vcpkg_installed
ARTIFACT_NAME: wheel
jobs:
build-sdist:
name: Build Source Distribution
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Set up Python ${{ env.HOST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.HOST_PYTHON_VERSION }}
- name: Upgrade pip and install build
run: python -m pip install -U pip build
- name: Checkout source
uses: actions/checkout@v4
- name: Build source distribution
run: python -m build --sdist
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-source
path: ./dist/*.tar.gz
cpp-tests:
name: Execute C++ test cases
runs-on: ubuntu-latest
env:
VCPKG_TARGET_TRIPLET: "x64-linux-dynamic-cxx17-abi1-rel"
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python ${{ env.HOST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.HOST_PYTHON_VERSION }}
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: List directory structure
run: tree
- name: Install C++ Compiler and cmake
run: |
sudo apt update
sudo apt install build-essential cmake
python -m pip install -U pip
python -m pip install pyarrow
- name: Build C++ libraries and tests
env:
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
VCPKG_TARGET_TRIPLET: ${{ env.VCPKG_TARGET_TRIPLET }}
run: |
cmake -S . -B build
cmake --build build
- name: Execute C++ tests
run: |
cd build
ctest --verbose
# - name: Debug with tmate on failure
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
build-wheels:
name: Build wheel for ${{ matrix.cpython }}-${{ matrix.os_short }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macos-13", "macos-14"]
# https://peps.python.org/pep-0425
cpython: ["cp310", "cp311", "cp312"]
is_main_or_release:
- ${{ contains(github.ref, 'main') || startsWith(github.ref, 'refs/tags')}}
# Avoid building all wheels in a PR
exclude:
- is_main_or_release: false
cpython: cp310
- is_main_or_release: false
cpython: cp312
include:
- os: ubuntu-22.04
os_short: linux
arch: "x86_64"
triplet: "x64-linux-dynamic-cxx17-abi1-rel"
extra_build: "manylinux_x86_64"
- os: macos-13
os_short: macos
arch: "x86_64"
triplet: "x64-osx-dynamic-cxx17-abi1-rel"
extra_build: "macosx_x86_64"
- os: macos-14
os_short: macos
arch: "arm64"
triplet: "arm64-osx-dynamic-cxx17-abi1-rel"
extra_build: "macosx_arm64"
steps:
- name: Set up Python ${{ env.HOST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.HOST_PYTHON_VERSION }}
- name: Upgrade pip and install virtualenv
run: python -m pip install -U pip virtualenv
- name: Checkout source
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Set Common Build Environment Variable
env:
COMMON_ENV: >
CMAKE_ARGS=-DBUILD_TESTING=OFF
ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }}
ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }}
VCPKG_BINARY_SOURCES="clear;x-gha,readwrite"
VCPKG_TARGET_TRIPLET=${{ matrix.triplet }}
VCPKG_INSTALLED_DIR=${{ env.VCPKG_INSTALLED_DIR }}
LD_LIBRARY_PATH=${{ env.VCPKG_INSTALLED_DIR }}/${{ matrix.triplet }}/lib
run: echo "CIBW_ENVIRONMENT_COMMON=$COMMON_ENV" >> $GITHUB_ENV
- name: Install conda for macos
if: ${{ matrix.os_short == 'macos' }}
run: |
set -ex
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
# Install miniforge
MINIFORGE_PATH=$HOME/miniforge
bash Miniforge3-$(uname)-$(uname -m).sh -b -p $MINIFORGE_PATH
echo "$MINIFORGE_PATH/bin" >> $GITHUB_PATH
echo "CONDA_HOME=$MINIFORGE_PATH" >> $GITHUB_ENV
- name: Run cibuildwheel
env:
CIBW_BUILD: ${{ matrix.cpython }}-${{ matrix.extra_build }}*
CIBW_BUILD_FRONTEND: build
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_ALL_LINUX: yum install -y zip flex bison gcc-gfortran
CIBW_ENVIRONMENT_COMMON: ${{ env.CIBW_ENVIRONMENT_COMMON }}
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64
CIBW_TEST_EXTRAS_LINUX: applications,test
CIBW_TEST_COMMAND_LINUX: py.test -s -vvv --pyargs arcae
CIBW_TEST_COMMAND_MACOS: python -c "from arcae.testing import sanity; sanity()"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
auditwheel repair
-w {dest_dir} {wheel}
--exclude libarrow_python.so
--exclude libarrow.so.1601
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH delocate-listdeps {wheel}
DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH delocate-wheel \
--require-archs {delocate_archs} \
-w {dest_dir} \
-v {wheel} \
--exclude libarrow_python.dylib \
--exclude libarrow.1601.dylib \
--ignore-missing-dependencies
run: bash ci/scripts/run_cibuildwheel.sh
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-${{ matrix.os_short }}-${{ matrix.cpython }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
# - name: Debug with tmate on failure
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
upload-to-test-pypi:
name: Upload release to Test PyPI
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: release-test
permissions:
id-token: write
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{ env.ARTIFACT_NAME }}-*
merge-multiple: true
path: dist
- name: List artifacts
run: ls -lh dist
- name: Publish package distributions to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
continue-on-error: true
upload-to-pypi:
name: Upload release to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{ env.ARTIFACT_NAME }}-*
merge-multiple: true
path: dist
- name: List artifacts
run: ls -lh dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1