Skip to content

Commit a2f98e9

Browse files
committed
Merge commit '4a71f9a45b425bac152847f05ddb7f8158c436ad' as 'src/chiabls'
2 parents 4366be2 + 4a71f9a commit a2f98e9

File tree

757 files changed

+254745
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

757 files changed

+254745
-0
lines changed

src/chiabls/.clang-format

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
BasedOnStyle: Google
2+
UseTab: Never
3+
ColumnLimit: 80
4+
IndentWidth: 4
5+
TabWidth: 4
6+
AllowShortIfStatementsOnASingleLine: false
7+
IndentCaseLabels: false
8+
AccessModifierOffset: -4
9+
BinPackArguments: false
10+
BinPackParameters: false
11+
AlignAfterOpenBracket: AlwaysBreak
12+
IndentCaseLabels: true
13+
AllowAllParametersOfDeclarationOnNextLine: false
14+
BreakBeforeBraces: Custom
15+
BraceWrapping:
16+
AfterFunction: true
17+
PenaltyReturnTypeOnItsOwnLine: 1000

src/chiabls/.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude = ./typings/**/* python-impl/fields.py
4+
ignore = E203,W503,E501
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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+
if: ${{ github.ref != 'refs/heads/main' }}
17+
uses: styfle/cancel-workflow-action@0.7.0
18+
with:
19+
access_token: ${{ github.token }}
20+
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Prepare cibuildwheel
27+
run: |
28+
if [ ! -f "venv" ]; then rm -rf venv; fi
29+
sudo apt-get install python3-venv python3-pip -y
30+
python3 -m venv venv
31+
source venv/bin/activate
32+
python -m pip install --upgrade pip
33+
python -m pip install cibuildwheel==1.10.0
34+
35+
- name: Lint source with flake8
36+
run: |
37+
source venv/bin/activate
38+
pip install flake8
39+
flake8 src setup.py python-bindings python-impl
40+
41+
- name: Lint source with mypy
42+
run: |
43+
source venv/bin/activate
44+
pip install mypy
45+
mypy --config-file mypi.ini python-bindings python-impl
46+
47+
- name: Build wheels and test
48+
run: |
49+
source venv/bin/activate
50+
python -m cibuildwheel --output-dir dist
51+
env:
52+
# build python 3.7 and 3.8
53+
CIBW_BUILD: cp37-* cp38-* cp39-*
54+
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
55+
CIBW_BUILD_VERBOSITY_LINUX: 0
56+
CIBW_BEFORE_BUILD_LINUX: >
57+
python -m pip install --upgrade pip
58+
CIBW_BEFORE_ALL_LINUX: >
59+
yum -y install epel-release
60+
&& yum -y install cmake3 lzip
61+
&& rm -rf /usr/local/bin/cmake
62+
&& ln -s /usr/bin/cmake3 /usr/local/bin/cmake
63+
&& cmake --version
64+
&& curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x
65+
&& cd gmp-6.2.1 && ./configure --enable-fat
66+
&& make && make install && cd .. && rm -rf gmp-6.2.1
67+
&& curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz | tar xz
68+
&& cd libsodium-stable && ./configure --with-pic="yes"
69+
&& make && make install && cd .. && rm -rf libsodium-stable
70+
CIBW_TEST_REQUIRES: pytest
71+
CIBW_TEST_COMMAND: pytest -v {project}/python-bindings/test.py
72+
73+
- name: Create sha256 wheel hashes
74+
run: |
75+
mkdir hashes
76+
cd ./dist
77+
shasum -a 256 *
78+
shasum -a 256 * > ../hashes/blspy-arm64-wheels-sha256.txt
79+
80+
- name: Upload hashes
81+
uses: actions/upload-artifact@v2
82+
with:
83+
name: blspy-arm64-hashes
84+
path: ./hashes
85+
86+
- name: Upload artifacts
87+
uses: actions/upload-artifact@v2
88+
with:
89+
name: wheels
90+
path: ./dist
91+
92+
- name: Test for secrets access
93+
id: check_secrets
94+
shell: bash
95+
run: |
96+
unset HAS_SECRET
97+
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
98+
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
99+
env:
100+
SECRET: "${{ secrets.test_pypi_password }}"
101+
102+
- name: Install twine
103+
run: |
104+
source venv/bin/activate
105+
pip install twine
106+
107+
- name: Publish distribution to PyPI
108+
if: startsWith(github.event.ref, 'refs/tags') && steps.check_secrets.outputs.HAS_SECRET
109+
env:
110+
TWINE_USERNAME: __token__
111+
TWINE_NON_INTERACTIVE: 1
112+
TWINE_PASSWORD: ${{ secrets.pypi_password }}
113+
run: |
114+
source venv/bin/activate
115+
twine upload --non-interactive --skip-existing --verbose 'dist/*'
116+
117+
- name: Publish distribution to Test PyPI
118+
if: steps.check_secrets.outputs.HAS_SECRET
119+
env:
120+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
121+
TWINE_USERNAME: __token__
122+
TWINE_NON_INTERACTIVE: 1
123+
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
124+
run: |
125+
source venv/bin/activate
126+
twine upload --non-interactive --skip-existing --verbose 'dist/*'
127+
128+
- name: Clean up
129+
run: |
130+
rm -rf venv
131+
rm -rf dist
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Autotools build for bls-signatures
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: ${{ matrix.config.name }}
8+
runs-on: ${{ matrix.config.os }}
9+
defaults:
10+
run:
11+
shell: bash
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
config:
16+
- name: ARM 32-bit
17+
os: ubuntu-18.04
18+
host: arm-linux-gnueabihf
19+
arch: armhf
20+
apt_get: gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
21+
arch_packages: libgmp-dev:armhf libsodium-dev:armhf
22+
23+
- name: ARM 64-bit
24+
os: ubuntu-18.04
25+
host: aarch64-linux-gnu
26+
arch: arm64
27+
apt_get: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
28+
arch_packages: libgmp-dev:arm64 libsodium-dev:arm64
29+
30+
#- name: i686 Linux
31+
# os: ubuntu-18.04
32+
# host: i686-pc-linux-gnu
33+
# arch: armhf
34+
# apt_get: gcc-multilib g++-multilib
35+
# arch_packages: libgmp-dev:i386 libsodium-dev:i386
36+
37+
- name: x86_64 Linux
38+
os: ubuntu-18.04
39+
host: x86_64-unknown-linux-gnu
40+
arch: armhf # dummy arch
41+
apt_get: gcc-multilib g++-multilib
42+
arch_packages: libgmp-dev libsodium-dev
43+
unit_tests: true
44+
45+
- name: x86_64 MacOS
46+
os: macos-10.15
47+
host: x86_64-apple-darwin19.6.0
48+
brew_install: autoconf automake libtool gmp libsodium
49+
cc: clang
50+
cxx: clang++
51+
unit_tests: true
52+
53+
steps:
54+
- name: Get Source
55+
uses: actions/checkout@v2
56+
57+
- name: Setup Arches
58+
if: matrix.config.arch
59+
uses: ryankurte/action-apt@v0.3.0
60+
with:
61+
arch: ${{ matrix.config.arch }}
62+
packages: ${{ matrix.config.arch_packages }}
63+
64+
- name: Setup Environment
65+
run: |
66+
if [[ ${{ matrix.config.os }} = ubuntu* ]]; then
67+
sudo apt-get --yes update
68+
sudo apt-get install --no-install-recommends --no-upgrade -qq ${{ matrix.config.apt_get }}
69+
fi
70+
if [[ ${{ matrix.config.os }} = macos* ]]; then
71+
brew install ${{ matrix.config.brew_install }}
72+
fi
73+
74+
- name: Build
75+
run: |
76+
if [[ ${{ matrix.config.os }} = macos* ]]; then
77+
CC=${{ matrix.config.cc }}
78+
CXX=${{ matrix.config.cxx }}
79+
export CC
80+
export CXX
81+
fi
82+
83+
./autogen.sh
84+
./configure --host=${{ matrix.config.host }} || ( cat config.log && false)
85+
make -j2 || ( echo "Build failure. Verbose build follows." && make V=1 ; false )
86+
87+
if [ "${{ matrix.config.unit_tests }}" = "true" ]; then
88+
make -j2 check
89+
fi
90+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Build and Test C++, Javascript, and Python
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build and Test on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [macos-latest, ubuntu-latest]
13+
14+
steps:
15+
- name: Cancel previous runs on the same branch
16+
if: ${{ github.ref != 'refs/heads/main' }}
17+
uses: styfle/cancel-workflow-action@0.7.0
18+
with:
19+
access_token: ${{ github.token }}
20+
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
- uses: actions/setup-python@v2
25+
name: Install Python
26+
with:
27+
python-version: '3.8'
28+
29+
- name: Ubuntu build C++ and test with valgrind
30+
if: startsWith(matrix.os, 'ubuntu')
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install valgrind -y
34+
sudo apt-get install snap -y
35+
sudo apt-get remove --purge cmake -y
36+
sudo snap install cmake --classic
37+
hash -r
38+
cmake --version
39+
echo "attempting to curl"
40+
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz | tar xz
41+
echo "curl complete."
42+
cd libsodium-stable
43+
ls -l
44+
./configure --with-pic="yes"
45+
make
46+
sudo make install
47+
cd ..
48+
echo "Setting libsodium to static compile."
49+
export CIBUILDWHEEL=1
50+
mkdir -p build
51+
cd build
52+
cmake ../
53+
cmake --build . -- -j 6
54+
echo "Running ./src/runtest"
55+
./src/runtest
56+
valgrind --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./src/runtest
57+
58+
- name: Mac OS build C++ and test
59+
if: startsWith(matrix.os, 'macos')
60+
run: |
61+
ls -l
62+
export MACOSX_DEPLOYMENT_TARGET=10.14
63+
mkdir -p build
64+
ls -l build
65+
cd build
66+
cmake ../
67+
cmake --build . -- -j 6
68+
echo "Running ./src/runtest"
69+
./src/runtest
70+
71+
- name: Test pure python implementation
72+
run: |
73+
python python-impl/impl-test.py
74+
75+
- name: Install emsdk
76+
uses: mymindstorm/setup-emsdk@v9
77+
78+
- name: Test javascript bindings
79+
run: |
80+
emcc -v
81+
sh emsdk_build.sh
82+
sh js_test.sh

0 commit comments

Comments
 (0)