Skip to content

Commit f4ffccd

Browse files
authored
Add Arm64/aarch64 linux binary wheels - move cibuildwheel to 1.5.1 (dashpay#118)
* First attempt - aarch 64 wheel * Fix pytest call * Update Readme
1 parent fcc10ef commit f4ffccd

File tree

3 files changed

+125
-7
lines changed

3 files changed

+125
-7
lines changed

.github/workflows/build-aarch64.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Build ARM64 wheel
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheel on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ARM64]
13+
14+
steps:
15+
- name: Cancel previous runs on the same branch
16+
uses: styfle/[email protected]
17+
with:
18+
access_token: ${{ github.token }}
19+
20+
- name: Checkout code
21+
uses: actions/checkout@v1
22+
with:
23+
fetch-depth: 0
24+
# we need fetch-depth 0 so setuptools_scm can resolve tags
25+
26+
- name: Test for secrets access
27+
id: check_secrets
28+
shell: bash
29+
run: |
30+
unset HAS_SECRET
31+
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
32+
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
33+
env:
34+
SECRET: "${{ secrets.test_pypi_password }}"
35+
36+
- name: Prepare cibuildwheel
37+
run: |
38+
if [ ! -f "venv" ]; then rm -rf venv; fi
39+
sudo apt-get install python3-venv python3-pip -y
40+
python3 -m venv venv
41+
source venv/bin/activate
42+
python -m pip install --upgrade pip
43+
pip install wheel
44+
pip install cibuildwheel==1.5.1
45+
46+
- name: Lint source with flake8
47+
run: |
48+
source venv/bin/activate
49+
pip install flake8
50+
flake8 src setup.py
51+
52+
- name: Lint source with mypy
53+
run: |
54+
source venv/bin/activate
55+
pip install mypy
56+
mypy --config-file mypi.ini python-impl python-bindings
57+
58+
- name: Build wheel and test
59+
run: |
60+
source venv/bin/activate
61+
python -m cibuildwheel --output-dir dist
62+
env:
63+
# build python 3.7 and 3.8
64+
CIBW_BUILD: cp38-*
65+
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
66+
# we need boost
67+
CIBW_BEFORE_BUILD_LINUX: >
68+
yum -y install epel-release
69+
&& yum -y install cmake3
70+
&& ln -s /usr/bin/cmake3 /usr/local/bin/cmake
71+
&& python -m pip install --upgrade pip
72+
&& cmake --version
73+
&& uname -a
74+
CIBW_BUILD_VERBOSITY_LINUX: 0
75+
CIBW_TEST_REQUIRES: pytest
76+
CIBW_TEST_COMMAND: python {project}/python-bindings/test.py
77+
78+
- name: Upload artifacts
79+
uses: actions/upload-artifact@v1
80+
with:
81+
name: wheels
82+
path: ./dist
83+
84+
- name: Install twine
85+
run: |
86+
source venv/bin/activate
87+
pip install twine
88+
89+
- name: Publish distribution to Test PyPI
90+
if: steps.check_secrets.outputs.HAS_SECRET
91+
env:
92+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
93+
TWINE_USERNAME: __token__
94+
TWINE_NON_INTERACTIVE: 1
95+
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
96+
run: |
97+
source venv/bin/activate
98+
twine upload --non-interactive --skip-existing --verbose 'dist/*'
99+
100+
- name: Publish distribution to PyPI
101+
if: startsWith(github.event.ref, 'refs/tags') && steps.check_secrets.outputs.HAS_SECRET
102+
env:
103+
TWINE_USERNAME: __token__
104+
TWINE_NON_INTERACTIVE: 1
105+
TWINE_PASSWORD: ${{ secrets.pypi_password }}
106+
run: |
107+
source venv/bin/activate
108+
twine upload --non-interactive --skip-existing --verbose 'dist/*'
109+
110+
- name: Clean up venv
111+
run: |
112+
rm -rf venv

.github/workflows/build.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: Build wheels
22

33
on: [push, pull_request]
44

@@ -22,7 +22,7 @@ jobs:
2222
fetch-depth: 0
2323
# we need fetch-depth 0 so setuptools_scm can resolve tags
2424

25-
- uses: actions/setup-python@v1
25+
- uses: actions/setup-python@v2
2626
name: Install Python
2727
with:
2828
python-version: '3.7'
@@ -40,7 +40,7 @@ jobs:
4040
- name: Install cibuildwheel
4141
run: |
4242
python -m pip install --upgrade pip
43-
python -m pip install cibuildwheel==1.3.0
43+
python -m pip install cibuildwheel==1.5.1
4444
4545
- name: Lint source with flake8
4646
run: |
@@ -69,7 +69,13 @@ jobs:
6969
# we need boost
7070
CIBW_TEST_REQUIRES: pytest
7171
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
72-
CIBW_BEFORE_BUILD_LINUX: curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-`uname -m`.sh > cmake.sh && yes | sh cmake.sh | cat && rm -f /usr/bin/cmake && python -m pip install --upgrade pip && which cmake && cmake --version
72+
CIBW_BEFORE_BUILD_LINUX: >
73+
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-`uname -m`.sh > cmake.sh
74+
&& yes | sh cmake.sh | cat
75+
&& rm -f /usr/bin/cmake
76+
&& python -m pip install --upgrade pip
77+
&& which cmake
78+
&& cmake --version
7379
CIBW_BEFORE_BUILD_MACOS: python -m pip install --upgrade pip
7480
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.14
7581
CIBW_BUILD_VERBOSITY_MACOS: 0
@@ -97,7 +103,7 @@ jobs:
97103
# The pure python implementation, is not used anywhere and will be replaced
98104
# pytest {project}/python-impl/tests.py
99105
CIBW_TEST_COMMAND: python {project}/python-bindings/test.py
100-
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.17.0-Linux-`uname -m`/bin:$PATH BUILD_VDF_CLIENT=N"
106+
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.17.0-Linux-`uname -m`/bin:$PATH"
101107
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
102108
pip uninstall -y delocate
103109
&& pip install git+https://github.com/Chia-Network/delocate.git

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ PrependSignatures, which prepend public keys to messages, making them secure.
292292

293293
### ci Building
294294
The primary build process for this repository is to use GitHub Actions to
295-
build binary wheels for MacOS, Linux, and Windows and publish them with
296-
a source wheel on PyPi. See `.github/workflows/build.yml`. CMake uses
295+
build binary wheels for MacOS, Linux (x64 and aarch64), and Windows and publish
296+
them with a source wheel on PyPi. See `.github/workflows/build.yml`. CMake uses
297297
[FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html)
298298
to download [pybind11](https://github.com/pybind/pybind11) for the Python
299299
bindings. Building is then managed by

0 commit comments

Comments
 (0)