forked from Chia-Network/bls-signatures
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (101 loc) · 4.95 KB
/
build.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
name: Build
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:
- uses: actions/checkout@v1
with:
fetch-depth: 0
# we need fetch-depth 0 so setuptools_scm can resolve tags
- name: Checkout submodules
uses: snickerbockers/submodules-init@v4
- uses: actions/setup-python@v1
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel==1.3.0
- name: Mac OS build C++ and test
if: startsWith(matrix.os, 'macos')
run: |
brew install pkg-config
mkdir build
cd build
cmake ../
cmake --build . -- -j 6
echo "Running ./src/runtest"
./src/runtest
- name: Lint source with flake8
run: |
pip install flake8
flake8 src/
- name: Lint source with mypy
run: |
pip install mypy
mypy --config-file mypi.ini python-impl python-bindings
- name: Build source distribution with MacOS
if: startsWith(matrix.os, 'mac')
run: |
pip install pep517
python -m pep517.build --source --out-dir dist .
- name: Ubuntu build C++ and test with valgrind
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install valgrind libsodium-dev -y
mkdir 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: Build wheel and test
run: |
python -m cibuildwheel --output-dir dist
env:
# 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_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
CIBW_BEFORE_BUILD_MACOS: python -m pip install --upgrade pip
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.14
CIBW_BUILD_VERBOSITY_MACOS: 0
CIBW_BEFORE_BUILD_WINDOWS: python -m pip install --upgrade pip && pwd && git clone https://github.com/Chia-Network/relic_gmp_64.git && ls -l relic_gmp_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} && pwd && ls -l dist && rm -fr relic_gmp_64 && rm -fr mpir_gc_x64"
CIBW_TEST_COMMAND: python {project}/python-bindings/test.py #the pure python implementation, is not used anywhere and will be replaced - pytest {project}/python-impl/tests.py
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.17.0-Linux-`uname -m`/bin:$PATH BUILD_VDF_CLIENT=N"
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} && ls -l {dest_dir} && pwd && ls -l dist"
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: wheels
path: ./dist
- name: Install twine
run: pip install twine
- name: Publish distribution to Test PyPI
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')
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'