Skip to content

Commit

Permalink
Up cibuildwheel (Chia-Network#123)
Browse files Browse the repository at this point in the history
* Try new cibuildwheel releases and find significant upstream issues
* Move lot of logic to CIBW_BEFORE_ALL_LINUX and other platforms
* Windows shouldn't rm the mpir dlls. Reuse in cp38
* CIBW_BEFORE_ALL on ARM64 for future wheels
* Add python 3.7 and 3.8 on ARM64
* Fix bug that doesn't allow python 3.7.0
* Resolve js bindings security issues - NOTE bindings point at old lib
* Add windows libsodium
* Update README for ISC license - correct cmake version
* One last cmake, add gmp license
* compile libsodium --with-pic="yes"
* Actually get all four wheels building with sodium
* valgrind the hard way - sodium wise that is
* 1.5.2 but work around the bashlex mess until cibuildwheel 1.5.5
  • Loading branch information
hoffmang9 authored Jul 22, 2020
1 parent 33c59d9 commit d0f8a9a
Show file tree
Hide file tree
Showing 12 changed files with 2,076 additions and 1,998 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/build-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:
source venv/bin/activate
python -m pip install --upgrade pip
pip install wheel
pip install cibuildwheel==1.5.1
python -m pip install cibuildwheel==1.5.2
# python -m pip install git+https://github.com/YannickJadoul/cibuildwheel.git@fix-pwd-linux-docker
# python -m pip install git+https://github.com/joerick/cibuildwheel.git@726bcdf372daa2ad2ae9a67fd090ebadcbd964db

- name: Lint source with flake8
run: |
Expand All @@ -61,28 +63,27 @@ jobs:
python -m cibuildwheel --output-dir dist
env:
# build python 3.7 and 3.8
CIBW_BUILD: cp38-*
CIBW_BUILD: cp37-* cp38-*
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
# we need boost
CIBW_BUILD_VERBOSITY_LINUX: 0
CIBW_BEFORE_BUILD_LINUX: >
python -m pip install --upgrade pip
CIBW_BEFORE_ALL_LINUX: >
yum -y install epel-release
&& yum -y install cmake3 lzip
&& ln -s /usr/bin/cmake3 /usr/local/bin/cmake
&& python -m pip install --upgrade pip
&& cmake --version
&& uname -a
&& curl -L https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz | lzip -dc | tar x
&& cd gmp-6.1.2 && ./configure --enable-fat
&& make && make install && cd .. && rm -rf gmp-6.1.2
&& curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz | tar xz
&& cd libsodium-stable && ./configure
&& cd libsodium-stable && ./configure --with-pic="yes"
&& make && make install && cd .. && rm -rf libsodium-stable
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest -v {project}/python-bindings/test.py

- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: wheels
path: ./dist
Expand Down
53 changes: 32 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel==1.5.1
python -m pip install cibuildwheel==1.5.2
# python -m pip install git+https://github.com/YannickJadoul/cibuildwheel.git@fix-pwd-linux-docker
# python -m pip install git+https://github.com/joerick/cibuildwheel.git@726bcdf372daa2ad2ae9a67fd090ebadcbd964db

- name: Lint source with flake8
run: |
Expand All @@ -65,36 +67,44 @@ jobs:
env:
CIBW_BUILD_VERBOSITY_MACOS: 0
CIBW_BUILD_VERBOSITY_LINUX: 0
CIBW_BUILD_VERBOSITY_WINDOWS: 1
CIBW_BUILD_VERBOSITY_WINDOWS: 0
# Python 3.7 and 3.8
CIBW_BUILD: cp37-* cp38-*
# don't build i686 targets, can't seem to find cmake for these
CIBW_SKIP: '*-manylinux_i686 *-win32'
# we need boost
CIBW_TEST_REQUIRES: pytest
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.17.3-Linux-`uname -m`/bin:$PATH"
CIBW_BEFORE_BUILD_LINUX: >
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.17.3-Linux-`uname -m`/bin:/cmake-3.17.3-Linux-`uname -m`/bin:$PATH"
CIBW_BEFORE_ALL_LINUX: >
yum -y install lzip
&& curl -L https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3-Linux-`uname -m`.sh > cmake.sh
&& yes | sh cmake.sh | cat
&& rm -f /usr/bin/cmake && hash -r
&& python -m pip install --upgrade pip
&& which cmake
&& cmake --version
&& curl -L https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz | lzip -dc | tar x
&& cd gmp-6.1.2 && ./configure --enable-fat
&& make && make install && cd .. && rm -rf gmp-6.1.2
&& curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz | tar xz
&& cd libsodium-stable && ./configure
&& cd libsodium-stable && ./configure --with-pic="yes"
&& make && make install && cd .. && rm -rf libsodium-stable
# GH hosted runner has gmp and libsodium natively
CIBW_BEFORE_BUILD_MACOS: >
CIBW_BEFORE_BUID_LINUX: >
python -m pip install --upgrade pip
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.14
# GH hosted MacOS runner has gmp and libsodium natively
CIBW_BEFORE_BUILD_MACOS: >
python -m pip install --upgrade pip
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
pip uninstall -y delocate
&& pip install git+https://github.com/Chia-Network/delocate.git
&& delocate-listdeps {wheel}
&& delocate-wheel -v {wheel}
&& cp {wheel} {dest_dir}
CIBW_ENVIRONMENT_WINDOWS: BLSALLOC_SODIUM=1
CIBW_BEFORE_BUILD_WINDOWS: >
python -m pip install --upgrade pip
&& pwd
CIBW_BEFORE_ALL_WINDOWS: >
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip > libsodium-1.0.18-stable-msvc.zip
&& 7z x libsodium-1.0.18-stable-msvc.zip
&& git clone https://github.com/Chia-Network/relic_ietf_64.git
&& ls -l relic_ietf_64
&& git clone https://github.com/Chia-Network/mpir_gc_x64.git
Expand All @@ -112,17 +122,9 @@ jobs:
&& delocate-wheel -v -i mpir_gc_x64/mpir_skylake.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_skylake_avx.dll {wheel}
&& cp {wheel} {dest_dir} && ls -l {dest_dir}
&& rm -fr relic_ietf_64
&& rm -fr mpir_gc_x64
# The pure python implementation, is not used anywhere and will be replaced
# pytest {project}/python-impl/tests.py
CIBW_TEST_COMMAND: pytest -v {project}/python-bindings/test.py
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
pip uninstall -y delocate
&& pip install git+https://github.com/Chia-Network/delocate.git
&& delocate-listdeps {wheel}
&& delocate-wheel -v {wheel}
&& cp {wheel} {dest_dir}

- name: Mac OS build C++ and test
if: startsWith(matrix.os, 'macos')
Expand All @@ -141,12 +143,21 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install valgrind libsodium-dev -y
sudo apt-get install valgrind -y
sudo apt-get install snap -y
sudo apt-get remove --purge cmake -y
sudo snap install cmake --classic
hash -r
cmake --version
echo "attempting to curl"
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz | tar xz
echo "curl complete?"
cd libsodium-stable
ls -l
./configure --with-pic="yes"
make
sudo make install
cd ..
mkdir -p build
cd build
cmake ../
Expand All @@ -156,7 +167,7 @@ jobs:
valgrind --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./src/runtest
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: wheels
path: ./dist
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 3.14.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand All @@ -20,6 +20,7 @@ if (SODIUM_FOUND)
message(STATUS "Found libsodium")
message(STATUS "Sodium include dir = ${sodium_INCLUDE_DIR}")
set(BLSALLOC_SODIUM "1" CACHE STRING "")
set(SODIUM_STATIC "1" CACHE STRING "")
include_directories(${sodium_INCLUDE_DIR})
endif()

Expand Down
Loading

0 comments on commit d0f8a9a

Please sign in to comment.