Skip to content

Commit aaa23e8

Browse files
odidevwjsi
andauthored
Add cibuildwheel with Linux AArch64 wheel build support (#2672)
Co-authored-by: wjsi <[email protected]>
1 parent 61c8eac commit aaa23e8

File tree

5 files changed

+60
-146
lines changed

5 files changed

+60
-146
lines changed

.github/workflows/build-wheels.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/pypi-cd.yml

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,72 @@ on:
77

88
jobs:
99
build:
10+
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
1011
runs-on: ${{ matrix.os }}
1112
strategy:
1213
fail-fast: false
1314
matrix:
14-
os: [ubuntu-latest, macOS-latest, windows-latest]
15-
python-version: ["3.7", "3.8", "3.9", "3.10"]
16-
node-version: ["14.x"]
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
arch: [auto]
1717
include:
18-
- { os: ubuntu-latest, python-version: "3.7", python-abis: "cp37-cp37m" }
19-
- { os: ubuntu-latest, python-version: "3.8", python-abis: "cp38-cp38" }
20-
- { os: ubuntu-latest, python-version: "3.9", python-abis: "cp39-cp39" }
21-
- { os: ubuntu-latest, python-version: "3.10", python-abis: "cp310-cp310" }
22-
- { os: windows-latest, python-version: "3.10", build-static: 1 }
18+
- os: ubuntu-latest
19+
arch: aarch64
20+
- os: macos-latest
21+
arch: universal2
2322

2423
steps:
2524
- name: Check out code
2625
uses: actions/checkout@v2
2726

28-
- name: Use Node.js ${{ matrix.node-version }}
29-
uses: actions/setup-node@v2
30-
with:
31-
node-version: ${{ matrix.node-version }}
27+
- name: Set up QEMU
28+
if: ${{ matrix.arch == 'aarch64' }}
29+
uses: docker/setup-qemu-action@v1
3230

33-
- name: Set up conda ${{ matrix.python-version }}
31+
- name: Build wheels
32+
uses: pypa/[email protected]
3433
env:
35-
PYTHON: ${{ matrix.python-version }}
36-
shell: bash
37-
run: |
38-
source ./ci/install-conda.sh
39-
python -m pip install --upgrade pip setuptools wheel coverage;
34+
CIBW_BEFORE_BUILD: pip install -r ci/requirements-wheel.txt
35+
CIBW_ARCHS: ${{ matrix.arch }}
36+
CIBW_SKIP: pp* *-musllinux* cp36-* cp310-win32 *i686 cp310-manylinux_x86_64
37+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
38+
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
4039

41-
- name: Install dependencies
40+
- name: Build wheels (Python 3.10 x86_64)
41+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'auto'}}
42+
uses: pypa/[email protected]
4243
env:
43-
WITH_HADOOP: ${{ matrix.with-hadoop }}
44-
WITH_KUBERNETES: ${{ matrix.with-kubernetes }}
45-
NO_COMMON_TESTS: ${{ matrix.no-common-tests }}
46-
shell: bash
47-
run: |
48-
source ./ci/reload-env.sh
49-
export DEFAULT_VENV=$VIRTUAL_ENV
44+
CIBW_BEFORE_BUILD: pip install -r ci/requirements-wheel.txt
45+
CIBW_BUILD: cp310-manylinux_x86_64
46+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
5047

51-
if [[ "$PYTHON" =~ "3.9" ]]; then
52-
conda install -n test --quiet --yes -c conda-forge python=$PYTHON pyarrow
53-
fi
54-
55-
pip install numpy scipy cython
56-
pip install -e ".[dev,extra]"
57-
conda list -n test
48+
- name: Build source
49+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'auto'}}
50+
run: |
51+
pip install -r ci/requirements-wheel.txt
52+
python setup.py sdist --formats=gztar --dist-dir=./wheelhouse
5853
59-
- name: Deploy packages
60-
if: startsWith(github.ref, 'refs/tags/') && matrix.no-deploy != '1'
54+
- name: Release to pypi
6155
shell: bash
6256
env:
63-
PYABI: ${{ matrix.python-abis }}
64-
BUILD_STATIC: ${{ matrix.build-static }}
6557
PYPI_PWD: ${{ secrets.PYPI_PASSWORD }}
6658
run: |
67-
source ./ci/reload-env.sh
68-
if [[ "$PYTHON" =~ "3.10" ]]; then
69-
export DOCKER_IMAGE="quay.io/pypa/manylinux2014_x86_64"
59+
if [[ "$GITHUB_REPOSITORY" == "mars-project/mars" ]]; then
60+
PYPI_REPO="https://upload.pypi.org/legacy/"
7061
else
71-
export DOCKER_IMAGE="quay.io/pypa/manylinux1_x86_64"
62+
PYPI_REPO="https://test.pypi.org/legacy/"
7263
fi
73-
source ./.github/workflows/upload-packages.sh
64+
echo "[distutils]" > ~/.pypirc
65+
echo "index-servers =" >> ~/.pypirc
66+
echo " pypi" >> ~/.pypirc
67+
echo "[pypi]" >> ~/.pypirc
68+
echo "repository=$PYPI_REPO" >> ~/.pypirc
69+
echo "username=pyodps" >> ~/.pypirc
70+
echo "password=$PYPI_PWD" >> ~/.pypirc
71+
python -m pip install twine
72+
python -m twine upload -r pypi --skip-existing wheelhouse/*
73+
74+
- name: Upload artifacts to github
75+
uses: actions/upload-artifact@v1
76+
with:
77+
name: wheels
78+
path: ./wheelhouse

.github/workflows/upload-packages.sh

Lines changed: 0 additions & 74 deletions
This file was deleted.

ci/requirements-wheel.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
numpy==1.14.5; python_version<'3.9'
2-
numpy==1.19.3; python_version>='3.9' and python_version<'3.10'
3-
numpy==1.21.4; python_version>='3.10'
1+
oldest-supported-numpy
42

5-
pandas==1.0.4; python_version<'3.9'
6-
pandas==1.1.3; python_version>='3.9' and python_version<'3.10'
3+
pandas==1.0.4; python_version<'3.9' and platform_machine!='aarch64'
4+
pandas==1.1.3; python_version<'3.9' and platform_machine=='aarch64'
5+
pandas==1.2.2; python_version>='3.9' and python_version<'3.10'
76
pandas==1.3.4; python_version>='3.10'
87

9-
scipy==1.4.1; python_version<'3.9'
8+
scipy==1.4.1; python_version<'3.9' and platform_machine!='aarch64'
9+
scipy==1.5.3; python_version<'3.9' and platform_machine=='aarch64'
1010
scipy==1.5.4; python_version>='3.9' and python_version<'3.10'
1111
scipy==1.7.2; python_version>='3.10'
1212

13-
cython==0.29.21
13+
cython==0.29.26
1414
requests>=2.4.0
1515
cloudpickle>=1.5.0

mars/serialization/numpy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ def deserialize(self, header: Dict, buffers: List, context: Dict):
6161
if header["pickle"]:
6262
return unpickle_buffers(buffers)
6363

64-
dtype = np.lib.format.descr_to_dtype(header["descr"])
64+
try:
65+
dtype = np.lib.format.descr_to_dtype(header["descr"])
66+
except AttributeError: # pragma: no cover
67+
# for older numpy versions, descr_to_dtype is not implemented
68+
dtype = np.dtype(header["descr"])
69+
6570
dtype_new_order = header["dtype_new_order"]
6671
if dtype_new_order:
6772
dtype = dtype[dtype_new_order]

0 commit comments

Comments
 (0)