Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Update README.md

Update README.md #1

Workflow file for this run

name: Build wheels
on: [push, pull_request]
jobs:
build_wheels:
name: Build wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-18.04, windows-latest]
steps:
- name: Cancel previous runs on the same branch
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
# we need fetch-depth 0 so setuptools_scm can resolve tags
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_SECRET
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
env:
SECRET: "${{ secrets.test_pypi_password }}"
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel==1.5.5
- name: Lint source with flake8
run: |
pip install flake8
flake8 src setup.py python-bindings python-impl
- name: Lint source with mypy
run: |
pip install mypy
mypy --config-file mypi.ini python-bindings python-impl
- name: Build source distribution with MacOS
if: startsWith(matrix.os, 'mac')
run: |
pip install pep517
python -m pep517.build --source --out-dir dist .
- name: Build wheel and test
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD_VERBOSITY_MACOS: 0
CIBW_BUILD_VERBOSITY_LINUX: 0
CIBW_BUILD_VERBOSITY_WINDOWS: 0
# Python 3.7 and 3.8
CIBW_BUILD: cp37-* cp38-*
CIBW_SKIP: '*-manylinux_i686 *-win32'
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_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
&& 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 --with-pic="yes"
&& make && make install && cd .. && rm -rf libsodium-stable
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
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
&& ls -l mpir_gc_x64
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
pip uninstall -y delocate
&& pip install git+https://github.com/Chia-Network/delocate.git
&& delocate-wheel -v -i mpir_gc_x64/mpir.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_gc.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_broadwell.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_broadwell_avx.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_bulldozer.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_haswell.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_piledriver.dll {wheel}
&& 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}
# 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
- name: Mac OS build C++ and test
if: startsWith(matrix.os, 'macos')
run: |
ls -l
export MACOSX_DEPLOYMENT_TARGET=10.14
mkdir -p build
ls -l build
cd build
cmake ../
cmake --build . -- -j 6
echo "Running ./src/runtest"
./src/runtest
- name: Ubuntu build C++ and test with valgrind
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
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 ../
cmake --build . -- -j 6
echo "Running ./src/runtest"
./src/runtest
valgrind --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./src/runtest
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: wheels
path: ./dist
- name: Install twine
run: pip install twine
- name: Publish distribution to Test PyPI
if: steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'
- name: Publish distribution to PyPI
if: startsWith(github.event.ref, 'refs/tags') && steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'