From 43a61678cc2ef121ed477052af8e81eee399c9ea Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 17:20:01 +0200 Subject: [PATCH 01/18] build improvements, switched to g++9 --- .github/workflows/nightly.yml | 143 ++++++------- .github/workflows/publish.yml | 182 +++++++++-------- .github/workflows/test.yml | 368 ++++++++++++++++++---------------- deps/build.sh | 102 +++++----- 4 files changed, 408 insertions(+), 387 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3365e2f2..efef941e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,74 +13,83 @@ jobs: NIGHTLY_BUILD_FLAGS: "valgrind --leak-check=yes" steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python 3.6 - uses: actions/setup-python@v1 - with: - python-version: 3.6 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install g++-7 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison libc6-dbg gcc-multilib - sudo snap install valgrind --classic - python -m pip install --upgrade pip - pip install coincurve + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python 3.6 + uses: actions/setup-python@v1 + with: + python-version: 3.6 - - name: Build dependencies - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - cd deps - ./build.sh + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update + - name: Install packages + run: | + sudo apt-get install software-properties-common + sudo apt-get install gcc-9 g++-9 + - name: use g++-9 by default + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 - - name: Configure all - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - mkdir -p build && cd build - cmake .. - - - name: Build all - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - cd build - make -j$(nproc) + - name: Install more packages + run: | + sudo apt-get install clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison libc6-dbg gcc-multilib + sudo snap install valgrind --classic + python -m pip install --upgrade pip + pip install coincurve - - name: Run tests - run: | - cp scripts/parameters.json build/ - cd build - $NIGHTLY_BUILD_FLAGS ./bls_unit_test - $NIGHTLY_BUILD_FLAGS ./dkg_unit_test - $NIGHTLY_BUILD_FLAGS ./utils_unit_test - $NIGHTLY_BUILD_FLAGS ./bls_test - $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_unit_test - $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_test - $NIGHTLY_BUILD_FLAGS ./dkg_attack + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd deps + ./build.sh - # - name: Run python test - # run: | - # cd python - # ./setup.sh - # ./test.sh - # cd .. + - name: Configure all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + mkdir -p build && cd build + cmake .. + + - name: Build all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd build + make -j$(nproc) - - name: Run tools tests - run: | - ./scripts/run_tools_test.sh + - name: Run tests + run: | + cp scripts/parameters.json build/ + cd build + $NIGHTLY_BUILD_FLAGS ./bls_unit_test + $NIGHTLY_BUILD_FLAGS ./dkg_unit_test + $NIGHTLY_BUILD_FLAGS ./utils_unit_test + $NIGHTLY_BUILD_FLAGS ./bls_test + $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_unit_test + $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_test + $NIGHTLY_BUILD_FLAGS ./dkg_attack + + # - name: Run python test + # run: | + # cd python + # ./setup.sh + # ./test.sh + # cd .. + + - name: Run tools tests + run: | + ./scripts/run_tools_test.sh linux_build_with_emscripten: runs-on: ubuntu-18.04 @@ -102,7 +111,7 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install g++-7 clang-format-6.0 gawk sed shtool \ + sudo apt-get install gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison \ python3.6 lcov gcc-multilib sudo apt-get update -qq @@ -120,8 +129,8 @@ jobs: - name: Build dependencies run: | - export CC=gcc-7 - export CXX=g++-7 + export CC=gcc-9 + export CXX=g++-9 export TARGET=all export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" cd deps @@ -152,4 +161,4 @@ jobs: MESSAGE=`cat message.txt` PUBLIC_BLS_KEY=`cat bls_public_key.txt` node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt - ./decrypt_message \ No newline at end of file + ./decrypt_message diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b432c499..592fd0ab 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,94 +14,104 @@ jobs: runs-on: ubuntu-18.04 steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install g++-7 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison gcc-multilib - - name: Build dependencies - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - cd deps - ./build.sh + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 - - name: Configure all - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - mkdir -p build && cd build - cmake .. - - - name: Build all - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - cd build - make -j$(nproc) - - - name: Calculate version - run: | - export BRANCH=${GITHUB_REF##*/} - echo "Branch $BRANCH" - export VERSION=$(cat VERSION.txt) - export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION) - echo "::set-env name=VERSION::$VERSION" - echo "Version $VERSION" - export RELEASE=true - echo "::set-env name=RELEASE::$RELEASE" - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update + - name: Install packages + run: | + sudo apt-get install software-properties-common + sudo apt-get install gcc-9 g++-9 + - name: use g++-9 by default + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 - - name: Create Release - id: create_release - uses: actions/create-release@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - draft: false - prerelease: true + - name: Install more packages + run: | + sudo apt-get update + sudo apt-get install clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison gcc-multilib + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd deps + ./build.sh - - name: Upload bls_glue to Release - uses: actions/upload-release-asset@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/bls_glue - asset_name: bls_glue - asset_content_type: application/octet-stream + - name: Configure all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + mkdir -p build && cd build + cmake .. + + - name: Build all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd build + make -j$(nproc) + + - name: Calculate version + run: | + export BRANCH=${GITHUB_REF##*/} + echo "Branch $BRANCH" + export VERSION=$(cat VERSION.txt) + export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION) + echo "::set-env name=VERSION::$VERSION" + echo "Version $VERSION" + export RELEASE=true + echo "::set-env name=RELEASE::$RELEASE" + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Upload hash_g1 to Release - uses: actions/upload-release-asset@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/hash_g1 - asset_name: hash_g1 - asset_content_type: application/octet-stream + - name: Create Release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} + draft: false + prerelease: true - - name: Upload verify_bls to Release - uses: actions/upload-release-asset@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/verify_bls - asset_name: verify_bls - asset_content_type: application/octet-stream \ No newline at end of file + - name: Upload bls_glue to Release + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/bls_glue + asset_name: bls_glue + asset_content_type: application/octet-stream + + - name: Upload hash_g1 to Release + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/hash_g1 + asset_name: hash_g1 + asset_content_type: application/octet-stream + + - name: Upload verify_bls to Release + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/verify_bls + asset_name: verify_bls + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 738b5c0a..13c55450 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,188 +14,200 @@ jobs: runs-on: ubuntu-18.04 steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install g++-7 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib - sudo apt-get update -qq - sudo apt install python3-pip - pip3 install --upgrade pip - sudo python3.6 -m pip install --upgrade pip - sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 - sudo python3.6 -m pip install requests[security] - sudo python3.6 -m pip install codecov --ignore-installed - - - name: Build dependencies - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd deps - ./build.sh - - - name: Configure all - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - mkdir -p build && cd build - cmake $CMAKE_BUILD_FLAGS .. - - - name: Run format check - run: | - cd build - make bls-format-check - - - name: Build all - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd build - make -j$(nproc) - - - name: Run tests - run: | - cp scripts/parameters.json build/ - cd build - ./bls_unit_test - ./dkg_unit_test - ./utils_unit_test - ./bls_test - ./threshold_encryption/te_unit_test - ./threshold_encryption/te_test - ./dkg_attack - - - name: Upload coverage - run: | - cd build - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files - lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files - - # Uploading report to CodeCov - bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + + - name: update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update + - name: install packages + run: | + sudo apt-get install software-properties-common + sudo apt-get install gcc-9 g++-9 + - name: use g++-9 by default + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 + + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison \ + python3.6 lcov gcc-multilib + sudo apt-get update -qq + sudo apt install python3-pip + pip3 install --upgrade pip + sudo python3.6 -m pip install --upgrade pip + sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 + sudo python3.6 -m pip install requests[security] + sudo python3.6 -m pip install codecov --ignore-installed + + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd deps + ./build.sh + + - name: Configure all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + mkdir -p build && cd build + cmake $CMAKE_BUILD_FLAGS .. + + - name: Run format check + run: | + cd build + make bls-format-check + + - name: Build all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd build + make -j$(nproc) + + - name: Run tests + run: | + cp scripts/parameters.json build/ + cd build + ./bls_unit_test + ./dkg_unit_test + ./utils_unit_test + ./bls_test + ./threshold_encryption/te_unit_test + ./threshold_encryption/te_test + ./dkg_attack + + - name: Upload coverage + run: | + cd build + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files + lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files + + # Uploading report to CodeCov + bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" osx_build_and_test: runs-on: macos-11 steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Install packages - run: | - brew install yasm texinfo shtool libtool coreutils - - name: Build dependencies - run: | - cd deps - ./build.sh - - name: Configure all - run: | - mkdir -p build && cd build - cmake .. - - name: Build all - run: | - cd build - make -j$(sysctl -n hw.ncpu) - - name: Run tests - run: | - cp scripts/parameters.json build/ - cd build - ./bls_unit_test - ./dkg_unit_test - ./bls_test - ./threshold_encryption/te_unit_test - ./threshold_encryption/te_test - ./dkg_attack - - linux_build_with_emscripten: - runs-on: ubuntu-18.04 + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Install packages + run: | + brew install yasm texinfo shtool libtool coreutils + - name: Build dependencies + run: | + cd deps + ./build.sh + - name: Configure all + run: | + mkdir -p build && cd build + cmake .. + - name: Build all + run: | + cd build + make -j$(sysctl -n hw.ncpu) + - name: Run tests + run: | + cp scripts/parameters.json build/ + cd build + ./bls_unit_test + ./dkg_unit_test + ./bls_test + ./threshold_encryption/te_unit_test + ./threshold_encryption/te_test + ./dkg_attack - strategy: - matrix: - node-version: [14.x] + linux_build_with_emscripten: + runs-on: ubuntu-18.04 - steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install g++-7 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib - sudo apt-get update -qq - sudo apt install python3-pip - pip3 install --upgrade pip - sudo python3.6 -m pip install --upgrade pip - sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 - sudo python3.6 -m pip install requests[security] - sudo python3.6 -m pip install codecov --ignore-installed - - - name: Install NODE JS - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - name: Build dependencies - run: | - export CC=gcc-7 - export CXX=g++-7 - export TARGET=all - export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd deps - ./build.sh WITH_EMSCRIPTEN=1 - cd .. - - - name: Build all - run: | - cd deps/emsdk - ./emsdk install latest - ./emsdk activate latest - source ./emsdk_env.sh - cd ../.. - mkdir -p build_em - cd build_em - export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib - emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a - emmake make -j$(nproc) - cd .. - - - name: Run tests - run: | - cp tools/generate_bls_keys build_em/ - cp tools/decrypt_message build_em/ - cd build_em/ - cp threshold_encryption/encrypt_message.* . - ./generate_bls_keys - MESSAGE=`cat message.txt` - PUBLIC_BLS_KEY=`cat bls_public_key.txt` - node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt - ./decrypt_message + strategy: + matrix: + node-version: [14.x] + + steps: + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison \ + python3.6 lcov gcc-multilib + sudo apt-get update -qq + sudo apt install python3-pip + pip3 install --upgrade pip + sudo python3.6 -m pip install --upgrade pip + sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 + sudo python3.6 -m pip install requests[security] + sudo python3.6 -m pip install codecov --ignore-installed + + - name: Install NODE JS + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd deps + ./build.sh WITH_EMSCRIPTEN=1 + cd .. + + - name: Build all + run: | + cd deps/emsdk + ./emsdk install latest + ./emsdk activate latest + source ./emsdk_env.sh + cd ../.. + mkdir -p build_em + cd build_em + export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib + emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a + emmake make -j$(nproc) + cd .. + + - name: Run tests + run: | + cp tools/generate_bls_keys build_em/ + cp tools/decrypt_message build_em/ + cd build_em/ + cp threshold_encryption/encrypt_message.* . + ./generate_bls_keys + MESSAGE=`cat message.txt` + PUBLIC_BLS_KEY=`cat bls_public_key.txt` + node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt + ./decrypt_message diff --git a/deps/build.sh b/deps/build.sh index cf3c7b7a..85d4313a 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -118,15 +118,6 @@ simple_find_tool_program () { # program_name, var_name_to_export_full_path, is_o echo -e "....${COLOR_SUCCESS}SUCCESS: $2 found as $TMP_VAL" "${COLOR_RESET}" return 0 fi - #TMP_CMD="export $2=/opt/local/bin/$1" - #$TMP_CMD - #TMP_CMD="echo ${!2}" - #TMP_VAL="$($TMP_CMD)" - #if [ -f "$TMP_VAL" ]; - #then - # #echo -e "${COLOR_SUCCESS}SUCCESS: $2 found as $TMP_VAL" "${COLOR_RESET}" - # return 0 - #fi fi if [ -f "$TMP_VAL" ]; then @@ -320,12 +311,12 @@ then else if [ "$UNIX_SYSTEM_NAME" = "Linux" ]; then - export CC=$(which gcc-7) + export CC=$(which gcc-9) if [ -z "${CC}" ]; then export CC=$(which gcc) fi - export CXX=$(which g++-7) + export CXX=$(which g++-9) if [ -z "${CXX}" ]; then export CXX=$(which g++) @@ -577,14 +568,14 @@ then if [ ! -d "emsdk" ]; then echo -e "${COLOR_INFO}downloading it${COLOR_DOTS}...${COLOR_RESET}" - git clone https://github.com/emscripten-core/emsdk.git + eval git clone https://github.com/emscripten-core/emsdk.git fi cd emsdk echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" - git pull - git checkout 2.0.31 - ./emsdk install latest - ./emsdk activate latest + eval git pull + eval git checkout 2.0.31 + eval ./emsdk install latest + eval ./emsdk activate latest source ./emsdk_env.sh cd .. fi @@ -600,9 +591,8 @@ then then if [ ! -f "boost_1_68_0.tar.bz2" ]; then - echo -e "${COLOR_INFO}downloading it${COLOR_DOTS}...${COLOR_RESET}" - # $WGET https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz - $WGET https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.bz2 + eval echo -e "${COLOR_INFO}downloading it${COLOR_DOTS}...${COLOR_RESET}" + eval $WGET https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.bz2 fi echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}" tar -xf boost_1_68_0.tar.bz2 @@ -615,25 +605,25 @@ then else BOOST_LIBRARIES="system,thread,filesystem,regex,atomic,program_options" fi - ./bootstrap.sh --prefix="$INSTALL_ROOT" --with-libraries="$BOOST_LIBRARIES" + eval ./bootstrap.sh --prefix="$INSTALL_ROOT" --with-libraries="$BOOST_LIBRARIES" if [ ${ARCH} = "arm" ] then sed -i -e 's#using gcc ;#using gcc : arm : /usr/local/toolchains/gcc7.2-arm/bin/arm-linux-gnueabihf-g++ ;#g' project-config.jam - ./b2 "${CONF_CROSSCOMPILING_OPTS_BOOST}" cxxflags=-fPIC cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 "${CONF_CROSSCOMPILING_OPTS_BOOST}" cxxflags=-fPIC cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install else if [ "$UNIX_SYSTEM_NAME" = "Darwin" ]; then - ./b2 cxxflags=-fPIC toolset=clang cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 cxxflags=-fPIC toolset=clang cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install else if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then - ./b2 toolset=emscripten cxxflags=-fPIC cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --disable-icu --layout=system variant=debug link=static install + eval ./b2 toolset=emscripten cxxflags=-fPIC cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --disable-icu --layout=system variant=debug link=static install cd bin.v2/libs/program_options/build/emscripten-2.0.31/debug/cxxstd-14-iso/link-static/threading-multi/ - emar q libboost_program_options.a *.bc - cp libboost_program_options.a "${LIBRARIES_ROOT}" + eval emar q libboost_program_options.a *.bc + eval cp libboost_program_options.a "${LIBRARIES_ROOT}" else - ./b2 cxxflags=-fPIC cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 cxxflags=-fPIC cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install fi fi fi @@ -660,17 +650,17 @@ then if [ ! -f "openssl-from-git.tar.gz" ]; then echo -e "${COLOR_INFO}getting it from git${COLOR_DOTS}...${COLOR_RESET}" - git clone https://github.com/openssl/openssl.git + eval git clone https://github.com/openssl/openssl.git echo -e "${COLOR_INFO}archiving it${COLOR_DOTS}...${COLOR_RESET}" - tar -czf openssl-from-git.tar.gz ./openssl + eval tar -czf openssl-from-git.tar.gz ./openssl else echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}" - tar -xzf openssl-from-git.tar.gz + eval tar -xzf openssl-from-git.tar.gz fi echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" cd openssl - git fetch - git checkout OpenSSL_1_1_1-stable + eval git fetch + eval git checkout OpenSSL_1_1_1-stable if [ "$ARCH" = "x86_or_x64" ]; then if [ "$UNIX_SYSTEM_NAME" = "Darwin" ]; @@ -680,14 +670,14 @@ then else if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then - emconfigure ./config -fPIC -no-asm -no-shared -no-threads --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" + eval emconfigure ./config -fPIC -no-asm -no-shared -no-threads --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" sed -i 's/CROSS_COMPILE=.*/CROSS_COMPILE=/' Makefile else - ./config -fPIC --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" + eval ./config -fPIC --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" fi fi else - ./Configure linux-armv4 --prefix="$INSTALL_ROOT" "${ADDITIONAL_INCLUDES}" "${ADDITIONAL_LIBRARIES}" no-shared no-tests no-dso + eval ./Configure linux-armv4 --prefix="$INSTALL_ROOT" "${ADDITIONAL_INCLUDES}" "${ADDITIONAL_LIBRARIES}" no-shared no-tests no-dso fi cd .. fi @@ -695,13 +685,13 @@ then cd openssl if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then - emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" depend - emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" + eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" depend + eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - $MAKE ${PARALLEL_MAKE_OPTIONS} depend - $MAKE ${PARALLEL_MAKE_OPTIONS} + eval $MAKE ${PARALLEL_MAKE_OPTIONS} depend + eval $MAKE ${PARALLEL_MAKE_OPTIONS} fi - $MAKE ${PARALLEL_MAKE_OPTIONS} install_sw + eval $MAKE ${PARALLEL_MAKE_OPTIONS} install_sw cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" @@ -721,32 +711,32 @@ then if [ ! -f "gmp-6.1.2.tar.xz" ]; then echo -e "${COLOR_INFO}getting it from gmp website${COLOR_DOTS}...${COLOR_RESET}" - $WGET https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz + eval $WGET https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz fi echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}" - tar -xf gmp-6.1.2.tar.xz + eval tar -xf gmp-6.1.2.tar.xz fi cd gmp-6.1.2 echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" if [ "$UNIX_SYSTEM_NAME" = "Darwin" ]; then - ./configure ${CONF_CROSSCOMPILING_OPTS_GENERIC} ${CONF_DEBUG_OPTIONS} --enable-cxx --enable-static --disable-shared --build=x86_64-apple-darwin#{OS.kernel_version.major} --prefix="$INSTALL_ROOT" + eval ./configure ${CONF_CROSSCOMPILING_OPTS_GENERIC} ${CONF_DEBUG_OPTIONS} --enable-cxx --enable-static --disable-shared --build=x86_64-apple-darwin#{OS.kernel_version.major} --prefix="$INSTALL_ROOT" else if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then - emconfigure ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" "${CONF_CROSSCOMPILING_OPTS_GMP}" "${CONF_DEBUG_OPTIONS}" --disable-assembly --host none --enable-cxx --prefix="$INSTALL_ROOT" + eval emconfigure ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" "${CONF_CROSSCOMPILING_OPTS_GMP}" "${CONF_DEBUG_OPTIONS}" --disable-assembly --host none --enable-cxx --prefix="$INSTALL_ROOT" else - ./configure ${CONF_CROSSCOMPILING_OPTS_GENERIC} ${CONF_CROSSCOMPILING_OPTS_GMP} ${CONF_DEBUG_OPTIONS} --enable-cxx --enable-static --disable-shared --prefix="$INSTALL_ROOT" + eval ./configure ${CONF_CROSSCOMPILING_OPTS_GENERIC} ${CONF_CROSSCOMPILING_OPTS_GMP} ${CONF_DEBUG_OPTIONS} --enable-cxx --enable-static --disable-shared --prefix="$INSTALL_ROOT" fi fi echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then - emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" + eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - $MAKE ${PARALLEL_MAKE_OPTIONS} + eval $MAKE ${PARALLEL_MAKE_OPTIONS} fi - $MAKE ${PARALLEL_MAKE_OPTIONS} install + eval $MAKE ${PARALLEL_MAKE_OPTIONS} install cd .. cd "$SOURCES_ROOT" else @@ -764,25 +754,25 @@ then if [ ! -d "libff" ]; then echo -e "${COLOR_INFO}getting it from git${COLOR_DOTS}...${COLOR_RESET}" - git clone https://github.com/scipr-lab/libff.git --recursive # libff + eval git clone https://github.com/scipr-lab/libff.git --recursive # libff fi cd libff echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" - git fetch - git checkout 03b719a7c81757071f99fc60be1f7f7694e51390 - mkdir -p build + eval git fetch + eval git checkout 03b719a7c81757071f99fc60be1f7f7694e51390 + eval mkdir -p build cd build echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then simple_find_tool_program "cmake" "CMAKE" "no" - emcmake "$CMAKE" "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" -DGMP_INCLUDE_DIR="$INCLUDE_ROOT" -DGMP_LIBRARY="$LIBRARIES_ROOT" -DWITH_PROCPS=OFF -DCURVE=ALT_BN128 -DUSE_ASM=OFF .. - emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" + eval emcmake "$CMAKE" "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" -DGMP_INCLUDE_DIR="$INCLUDE_ROOT" -DGMP_LIBRARY="$LIBRARIES_ROOT" -DWITH_PROCPS=OFF -DCURVE=ALT_BN128 -DUSE_ASM=OFF .. + eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - $CMAKE "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" .. -DWITH_PROCPS=OFF - $MAKE ${PARALLEL_MAKE_OPTIONS} + eval $CMAKE "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" .. -DWITH_PROCPS=OFF + eval $MAKE ${PARALLEL_MAKE_OPTIONS} fi - $MAKE ${PARALLEL_MAKE_OPTIONS} install + eval $MAKE ${PARALLEL_MAKE_OPTIONS} install cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" From ac3c5c4ba696cb5e5364c719b5049f3c29541ee1 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 17:40:54 +0200 Subject: [PATCH 02/18] codacy-related sh script fixes --- deps/build.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/deps/build.sh b/deps/build.sh index 85d4313a..27731104 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -592,7 +592,7 @@ then if [ ! -f "boost_1_68_0.tar.bz2" ]; then eval echo -e "${COLOR_INFO}downloading it${COLOR_DOTS}...${COLOR_RESET}" - eval $WGET https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.bz2 + eval "$WGET" https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.bz2 fi echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}" tar -xf boost_1_68_0.tar.bz2 @@ -610,20 +610,20 @@ then if [ ${ARCH} = "arm" ] then sed -i -e 's#using gcc ;#using gcc : arm : /usr/local/toolchains/gcc7.2-arm/bin/arm-linux-gnueabihf-g++ ;#g' project-config.jam - eval ./b2 "${CONF_CROSSCOMPILING_OPTS_BOOST}" cxxflags=-fPIC cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 "${CONF_CROSSCOMPILING_OPTS_BOOST}" cxxflags=-fPIC cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install else if [ "$UNIX_SYSTEM_NAME" = "Darwin" ]; then - eval ./b2 cxxflags=-fPIC toolset=clang cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 cxxflags=-fPIC toolset=clang cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install else if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then - eval ./b2 toolset=emscripten cxxflags=-fPIC cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --disable-icu --layout=system variant=debug link=static install + eval ./b2 toolset=emscripten cxxflags=-fPIC cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --disable-icu --layout=system variant=debug link=static install cd bin.v2/libs/program_options/build/emscripten-2.0.31/debug/cxxstd-14-iso/link-static/threading-multi/ - eval emar q libboost_program_options.a *.bc - eval cp libboost_program_options.a "${LIBRARIES_ROOT}" + eval emar q "libboost_program_options.a" *.bc + eval cp "libboost_program_options.a" "${LIBRARIES_ROOT}" else - eval ./b2 cxxflags=-fPIC cxxstd=14 cflags=-fPIC ${PARALLEL_MAKE_OPTIONS} --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 cxxflags=-fPIC cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install fi fi fi @@ -688,10 +688,10 @@ then eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" depend eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - eval $MAKE ${PARALLEL_MAKE_OPTIONS} depend - eval $MAKE ${PARALLEL_MAKE_OPTIONS} + eval $MAKE "${PARALLEL_MAKE_OPTIONS}" depend + eval $MAKE "${PARALLEL_MAKE_OPTIONS}" fi - eval $MAKE ${PARALLEL_MAKE_OPTIONS} install_sw + eval $MAKE "${PARALLEL_MAKE_OPTIONS}" install_sw cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" @@ -711,7 +711,7 @@ then if [ ! -f "gmp-6.1.2.tar.xz" ]; then echo -e "${COLOR_INFO}getting it from gmp website${COLOR_DOTS}...${COLOR_RESET}" - eval $WGET https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz + eval "$WGET" https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz fi echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}" eval tar -xf gmp-6.1.2.tar.xz @@ -720,13 +720,13 @@ then echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" if [ "$UNIX_SYSTEM_NAME" = "Darwin" ]; then - eval ./configure ${CONF_CROSSCOMPILING_OPTS_GENERIC} ${CONF_DEBUG_OPTIONS} --enable-cxx --enable-static --disable-shared --build=x86_64-apple-darwin#{OS.kernel_version.major} --prefix="$INSTALL_ROOT" + eval ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" "${CONF_DEBUG_OPTIONS}" --enable-cxx --enable-static --disable-shared --build=x86_64-apple-darwin#{OS.kernel_version.major} --prefix="$INSTALL_ROOT" else if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]]; then eval emconfigure ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" "${CONF_CROSSCOMPILING_OPTS_GMP}" "${CONF_DEBUG_OPTIONS}" --disable-assembly --host none --enable-cxx --prefix="$INSTALL_ROOT" else - eval ./configure ${CONF_CROSSCOMPILING_OPTS_GENERIC} ${CONF_CROSSCOMPILING_OPTS_GMP} ${CONF_DEBUG_OPTIONS} --enable-cxx --enable-static --disable-shared --prefix="$INSTALL_ROOT" + eval ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" "${CONF_CROSSCOMPILING_OPTS_GMP}" "${CONF_DEBUG_OPTIONS}" --enable-cxx --enable-static --disable-shared --prefix="$INSTALL_ROOT" fi fi echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" @@ -734,9 +734,9 @@ then then eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - eval $MAKE ${PARALLEL_MAKE_OPTIONS} + eval $MAKE "${PARALLEL_MAKE_OPTIONS}" fi - eval $MAKE ${PARALLEL_MAKE_OPTIONS} install + eval $MAKE "${PARALLEL_MAKE_OPTIONS}" install cd .. cd "$SOURCES_ROOT" else @@ -769,10 +769,10 @@ then eval emcmake "$CMAKE" "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" -DGMP_INCLUDE_DIR="$INCLUDE_ROOT" -DGMP_LIBRARY="$LIBRARIES_ROOT" -DWITH_PROCPS=OFF -DCURVE=ALT_BN128 -DUSE_ASM=OFF .. eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - eval $CMAKE "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" .. -DWITH_PROCPS=OFF - eval $MAKE ${PARALLEL_MAKE_OPTIONS} + eval "$CMAKE" "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" .. -DWITH_PROCPS=OFF + eval $MAKE "${PARALLEL_MAKE_OPTIONS}" fi - eval $MAKE ${PARALLEL_MAKE_OPTIONS} install + eval $MAKE "${PARALLEL_MAKE_OPTIONS}" install cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" From 5d432e426f38772ee26aaf9a35422d16554abfdc Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 17:48:25 +0200 Subject: [PATCH 03/18] codacy-related sh script fixes --- deps/build.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/deps/build.sh b/deps/build.sh index 27731104..9e1b75e6 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -688,10 +688,10 @@ then eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" depend eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - eval $MAKE "${PARALLEL_MAKE_OPTIONS}" depend - eval $MAKE "${PARALLEL_MAKE_OPTIONS}" + eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" depend + eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" fi - eval $MAKE "${PARALLEL_MAKE_OPTIONS}" install_sw + eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" install_sw cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" @@ -734,9 +734,9 @@ then then eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else - eval $MAKE "${PARALLEL_MAKE_OPTIONS}" + eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" fi - eval $MAKE "${PARALLEL_MAKE_OPTIONS}" install + eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" install cd .. cd "$SOURCES_ROOT" else @@ -770,9 +770,9 @@ then eval emmake "$MAKE" "${PARALLEL_MAKE_OPTIONS}" else eval "$CMAKE" "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" .. -DWITH_PROCPS=OFF - eval $MAKE "${PARALLEL_MAKE_OPTIONS}" + eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" fi - eval $MAKE "${PARALLEL_MAKE_OPTIONS}" install + eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" install cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" From 12959ff0fed7ee8665edc0cb41e3169784553f1c Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 17:59:47 +0200 Subject: [PATCH 04/18] codacy-related sh script fixes --- deps/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/build.sh b/deps/build.sh index 9e1b75e6..70d4f1e9 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -620,7 +620,7 @@ then then eval ./b2 toolset=emscripten cxxflags=-fPIC cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --disable-icu --layout=system variant=debug link=static install cd bin.v2/libs/program_options/build/emscripten-2.0.31/debug/cxxstd-14-iso/link-static/threading-multi/ - eval emar q "libboost_program_options.a" *.bc + emar q "libboost_program_options.a" *.bc eval cp "libboost_program_options.a" "${LIBRARIES_ROOT}" else eval ./b2 cxxflags=-fPIC cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install From 32fff9e9f035ee40b44b2eec3dbf1ec96e14ac48 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 18:07:08 +0200 Subject: [PATCH 05/18] codacy-related sh script fixes --- deps/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/build.sh b/deps/build.sh index 70d4f1e9..4cf7f3df 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -620,7 +620,7 @@ then then eval ./b2 toolset=emscripten cxxflags=-fPIC cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --disable-icu --layout=system variant=debug link=static install cd bin.v2/libs/program_options/build/emscripten-2.0.31/debug/cxxstd-14-iso/link-static/threading-multi/ - emar q "libboost_program_options.a" *.bc + eval emar q "libboost_program_options.a" ./*.bc eval cp "libboost_program_options.a" "${LIBRARIES_ROOT}" else eval ./b2 cxxflags=-fPIC cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install From 98677eeca46ac11e4b89a183379a392cf7d74590 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 18:23:31 +0200 Subject: [PATCH 06/18] yml build script fixes --- .github/workflows/nightly.yml | 10 +++++----- .github/workflows/publish.yml | 6 +++--- .github/workflows/test.yml | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index efef941e..6040023c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -29,8 +29,8 @@ jobs: run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - name: Install packages run: | - sudo apt-get install software-properties-common - sudo apt-get install gcc-9 g++-9 + sudo apt-get install -y software-properties-common + sudo apt-get install -y gcc-9 g++-9 - name: use g++-9 by default run: | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 @@ -38,7 +38,7 @@ jobs: - name: Install more packages run: | - sudo apt-get install clang-format-6.0 gawk sed shtool \ + sudo apt-get install -y clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison libc6-dbg gcc-multilib sudo snap install valgrind --classic python -m pip install --upgrade pip @@ -111,11 +111,11 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison \ python3.6 lcov gcc-multilib sudo apt-get update -qq - sudo apt install python3-pip + sudo apt-get install -y python3-pip pip3 install --upgrade pip sudo python3.6 -m pip install --upgrade pip sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 592fd0ab..5a37bda4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,8 +26,8 @@ jobs: run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - name: Install packages run: | - sudo apt-get install software-properties-common - sudo apt-get install gcc-9 g++-9 + sudo apt-get install -y software-properties-common + sudo apt-get install -y gcc-9 g++-9 - name: use g++-9 by default run: | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 @@ -36,7 +36,7 @@ jobs: - name: Install more packages run: | sudo apt-get update - sudo apt-get install clang-format-6.0 gawk sed shtool \ + sudo apt-get install -y clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison gcc-multilib - name: Build dependencies run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 13c55450..9dbd3de6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,8 +26,8 @@ jobs: run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - name: install packages run: | - sudo apt-get install software-properties-common - sudo apt-get install gcc-9 g++-9 + sudo apt-get install -y software-properties-common + sudo apt-get install -y gcc-9 g++-9 - name: use g++-9 by default run: | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 @@ -38,11 +38,11 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison \ python3.6 lcov gcc-multilib sudo apt-get update -qq - sudo apt install python3-pip + sudo apt-get install -y python3-pip pip3 install --upgrade pip sudo python3.6 -m pip install --upgrade pip sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 @@ -160,11 +160,11 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison \ python3.6 lcov gcc-multilib sudo apt-get update -qq - sudo apt install python3-pip + sudo apt-get install -y python3-pip pip3 install --upgrade pip sudo python3.6 -m pip install --upgrade pip sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 From 385bb620f308fa180961fac42758dfe0fb3b1ddc Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 19:47:25 +0200 Subject: [PATCH 07/18] yml build script fixes --- .github/workflows/nightly.yml | 142 ++++++++++---------- .github/workflows/publish.yml | 188 +++++++++++++------------- .github/workflows/test.yml | 240 +++++++++++++++++----------------- 3 files changed, 285 insertions(+), 285 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 6040023c..fc4e2ffa 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,83 +13,83 @@ jobs: NIGHTLY_BUILD_FLAGS: "valgrind --leak-check=yes" steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python 3.6 - uses: actions/setup-python@v1 - with: - python-version: 3.6 + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python 3.6 + uses: actions/setup-python@v1 + with: + python-version: 3.6 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - - name: Install packages - run: | - sudo apt-get install -y software-properties-common - sudo apt-get install -y gcc-9 g++-9 - - name: use g++-9 by default - run: | - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update + - name: Install packages + run: | + sudo apt-get install -y software-properties-common + sudo apt-get install -y gcc-9 g++-9 + - name: use g++-9 by default + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 - - name: Install more packages - run: | - sudo apt-get install -y clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison libc6-dbg gcc-multilib - sudo snap install valgrind --classic - python -m pip install --upgrade pip - pip install coincurve + - name: Install more packages + run: | + sudo apt-get install -y clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison libc6-dbg gcc-multilib + sudo snap install valgrind --classic + python -m pip install --upgrade pip + pip install coincurve - - name: Build dependencies - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - cd deps - ./build.sh + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd deps + ./build.sh - - name: Configure all - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - mkdir -p build && cd build - cmake .. - - - name: Build all - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - cd build - make -j$(nproc) + - name: Configure all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + mkdir -p build && cd build + cmake .. + + - name: Build all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd build + make -j$(nproc) - - name: Run tests - run: | - cp scripts/parameters.json build/ - cd build - $NIGHTLY_BUILD_FLAGS ./bls_unit_test - $NIGHTLY_BUILD_FLAGS ./dkg_unit_test - $NIGHTLY_BUILD_FLAGS ./utils_unit_test - $NIGHTLY_BUILD_FLAGS ./bls_test - $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_unit_test - $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_test - $NIGHTLY_BUILD_FLAGS ./dkg_attack + - name: Run tests + run: | + cp scripts/parameters.json build/ + cd build + $NIGHTLY_BUILD_FLAGS ./bls_unit_test + $NIGHTLY_BUILD_FLAGS ./dkg_unit_test + $NIGHTLY_BUILD_FLAGS ./utils_unit_test + $NIGHTLY_BUILD_FLAGS ./bls_test + $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_unit_test + $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_test + $NIGHTLY_BUILD_FLAGS ./dkg_attack - # - name: Run python test - # run: | - # cd python - # ./setup.sh - # ./test.sh - # cd .. + # - name: Run python test + # run: | + # cd python + # ./setup.sh + # ./test.sh + # cd .. - - name: Run tools tests - run: | - ./scripts/run_tools_test.sh + - name: Run tools tests + run: | + ./scripts/run_tools_test.sh linux_build_with_emscripten: runs-on: ubuntu-18.04 @@ -161,4 +161,4 @@ jobs: MESSAGE=`cat message.txt` PUBLIC_BLS_KEY=`cat bls_public_key.txt` node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt - ./decrypt_message + ./decrypt_message \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5a37bda4..fda55889 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,104 +14,104 @@ jobs: runs-on: ubuntu-18.04 steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - - name: Install packages - run: | - sudo apt-get install -y software-properties-common - sudo apt-get install -y gcc-9 g++-9 - - name: use g++-9 by default - run: | - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update + - name: Install packages + run: | + sudo apt-get install -y software-properties-common + sudo apt-get install -y gcc-9 g++-9 + - name: use g++-9 by default + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 - - name: Install more packages - run: | - sudo apt-get update - sudo apt-get install -y clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison gcc-multilib - - name: Build dependencies - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - cd deps - ./build.sh + - name: Install more packages + run: | + sudo apt-get update + sudo apt-get install -y clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison gcc-multilib + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd deps + ./build.sh - - name: Configure all - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - mkdir -p build && cd build - cmake .. - - - name: Build all - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - cd build - make -j$(nproc) - - - name: Calculate version - run: | - export BRANCH=${GITHUB_REF##*/} - echo "Branch $BRANCH" - export VERSION=$(cat VERSION.txt) - export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION) - echo "::set-env name=VERSION::$VERSION" - echo "Version $VERSION" - export RELEASE=true - echo "::set-env name=RELEASE::$RELEASE" - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Configure all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + mkdir -p build && cd build + cmake .. + + - name: Build all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + cd build + make -j$(nproc) + + - name: Calculate version + run: | + export BRANCH=${GITHUB_REF##*/} + echo "Branch $BRANCH" + export VERSION=$(cat VERSION.txt) + export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION) + echo "::set-env name=VERSION::$VERSION" + echo "Version $VERSION" + export RELEASE=true + echo "::set-env name=RELEASE::$RELEASE" + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Create Release - id: create_release - uses: actions/create-release@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - draft: false - prerelease: true + - name: Create Release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} + draft: false + prerelease: true - - name: Upload bls_glue to Release - uses: actions/upload-release-asset@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/bls_glue - asset_name: bls_glue - asset_content_type: application/octet-stream + - name: Upload bls_glue to Release + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/bls_glue + asset_name: bls_glue + asset_content_type: application/octet-stream - - name: Upload hash_g1 to Release - uses: actions/upload-release-asset@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/hash_g1 - asset_name: hash_g1 - asset_content_type: application/octet-stream + - name: Upload hash_g1 to Release + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/hash_g1 + asset_name: hash_g1 + asset_content_type: application/octet-stream - - name: Upload verify_bls to Release - uses: actions/upload-release-asset@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/verify_bls - asset_name: verify_bls - asset_content_type: application/octet-stream \ No newline at end of file + - name: Upload verify_bls to Release + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/verify_bls + asset_name: verify_bls + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9dbd3de6..b49c0db6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,131 +14,131 @@ jobs: runs-on: ubuntu-18.04 steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - - name: update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - - name: install packages - run: | - sudo apt-get install -y software-properties-common - sudo apt-get install -y gcc-9 g++-9 - - name: use g++-9 by default - run: | - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 - - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib - sudo apt-get update -qq - sudo apt-get install -y python3-pip - pip3 install --upgrade pip - sudo python3.6 -m pip install --upgrade pip - sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 - sudo python3.6 -m pip install requests[security] - sudo python3.6 -m pip install codecov --ignore-installed - - - name: Build dependencies - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd deps - ./build.sh - - - name: Configure all - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - mkdir -p build && cd build - cmake $CMAKE_BUILD_FLAGS .. - - - name: Run format check - run: | - cd build - make bls-format-check - - - name: Build all - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd build - make -j$(nproc) - - - name: Run tests - run: | - cp scripts/parameters.json build/ - cd build - ./bls_unit_test - ./dkg_unit_test - ./utils_unit_test - ./bls_test - ./threshold_encryption/te_unit_test - ./threshold_encryption/te_test - ./dkg_attack - - - name: Upload coverage - run: | - cd build - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files - lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files - - # Uploading report to CodeCov - bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + + - name: update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update + - name: install packages + run: | + sudo apt-get install -y software-properties-common + sudo apt-get install -y gcc-9 g++-9 + - name: use g++-9 by default + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 + + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison \ + python3.6 lcov gcc-multilib + sudo apt-get update -qq + sudo apt-get install -y python3-pip + pip3 install --upgrade pip + sudo python3.6 -m pip install --upgrade pip + sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 + sudo python3.6 -m pip install requests[security] + sudo python3.6 -m pip install codecov --ignore-installed + + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd deps + ./build.sh + + - name: Configure all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + mkdir -p build && cd build + cmake $CMAKE_BUILD_FLAGS .. + + - name: Run format check + run: | + cd build + make bls-format-check + + - name: Build all + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd build + make -j$(nproc) + + - name: Run tests + run: | + cp scripts/parameters.json build/ + cd build + ./bls_unit_test + ./dkg_unit_test + ./utils_unit_test + ./bls_test + ./threshold_encryption/te_unit_test + ./threshold_encryption/te_test + ./dkg_attack + + - name: Upload coverage + run: | + cd build + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files + lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files + + # Uploading report to CodeCov + bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" osx_build_and_test: runs-on: macos-11 steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Install packages - run: | - brew install yasm texinfo shtool libtool coreutils - - name: Build dependencies - run: | - cd deps - ./build.sh - - name: Configure all - run: | - mkdir -p build && cd build - cmake .. - - name: Build all - run: | - cd build - make -j$(sysctl -n hw.ncpu) - - name: Run tests - run: | - cp scripts/parameters.json build/ - cd build - ./bls_unit_test - ./dkg_unit_test - ./bls_test - ./threshold_encryption/te_unit_test - ./threshold_encryption/te_test - ./dkg_attack + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Install packages + run: | + brew install yasm texinfo shtool libtool coreutils + - name: Build dependencies + run: | + cd deps + ./build.sh + - name: Configure all + run: | + mkdir -p build && cd build + cmake .. + - name: Build all + run: | + cd build + make -j$(sysctl -n hw.ncpu) + - name: Run tests + run: | + cp scripts/parameters.json build/ + cd build + ./bls_unit_test + ./dkg_unit_test + ./bls_test + ./threshold_encryption/te_unit_test + ./threshold_encryption/te_test + ./dkg_attack linux_build_with_emscripten: runs-on: ubuntu-18.04 From 27cfe46eee796d229f0f6cf026cb621a22775718 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 19:56:47 +0200 Subject: [PATCH 08/18] yml build script fixes --- .github/workflows/nightly.yml | 20 ++--- .github/workflows/publish.yml | 3 +- .github/workflows/test.yml | 134 +++++++++++++++++----------------- 3 files changed, 77 insertions(+), 80 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index fc4e2ffa..750e5990 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -24,9 +24,10 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.6 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update - name: Install packages run: | sudo apt-get install -y software-properties-common @@ -35,7 +36,6 @@ jobs: run: | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 - - name: Install more packages run: | sudo apt-get install -y clang-format-6.0 gawk sed shtool \ @@ -80,12 +80,12 @@ jobs: $NIGHTLY_BUILD_FLAGS ./threshold_encryption/te_test $NIGHTLY_BUILD_FLAGS ./dkg_attack - # - name: Run python test - # run: | - # cd python - # ./setup.sh - # ./test.sh - # cd .. + # - name: Run python test + # run: | + # cd python + # ./setup.sh + # ./test.sh + # cd .. - name: Run tools tests run: | @@ -161,4 +161,4 @@ jobs: MESSAGE=`cat message.txt` PUBLIC_BLS_KEY=`cat bls_public_key.txt` node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt - ./decrypt_message \ No newline at end of file + ./decrypt_message diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fda55889..17e06d11 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,6 @@ jobs: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: Checkout uses: actions/checkout@v2 - - name: Update apt run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - name: Install packages @@ -114,4 +113,4 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./build/verify_bls asset_name: verify_bls - asset_content_type: application/octet-stream \ No newline at end of file + asset_content_type: application/octet-stream diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b49c0db6..66bd3ebf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,6 @@ jobs: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: Checkout uses: actions/checkout@v2 - - name: update apt run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update - name: install packages @@ -32,7 +31,6 @@ jobs: run: | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 - - name: Update apt run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - name: Install packages @@ -140,74 +138,74 @@ jobs: ./threshold_encryption/te_test ./dkg_attack - linux_build_with_emscripten: - runs-on: ubuntu-18.04 + linux_build_with_emscripten: + runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: [14.x] + strategy: + matrix: + node-version: [14.x] - steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib - sudo apt-get update -qq - sudo apt-get install -y python3-pip - pip3 install --upgrade pip - sudo python3.6 -m pip install --upgrade pip - sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 - sudo python3.6 -m pip install requests[security] - sudo python3.6 -m pip install codecov --ignore-installed + steps: + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison \ + python3.6 lcov gcc-multilib + sudo apt-get update -qq + sudo apt-get install -y python3-pip + pip3 install --upgrade pip + sudo python3.6 -m pip install --upgrade pip + sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 + sudo python3.6 -m pip install requests[security] + sudo python3.6 -m pip install codecov --ignore-installed - - name: Install NODE JS - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - name: Build dependencies - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd deps - ./build.sh WITH_EMSCRIPTEN=1 - cd .. + - name: Install NODE JS + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd deps + ./build.sh WITH_EMSCRIPTEN=1 + cd .. - - name: Build all - run: | - cd deps/emsdk - ./emsdk install latest - ./emsdk activate latest - source ./emsdk_env.sh - cd ../.. - mkdir -p build_em - cd build_em - export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib - emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a - emmake make -j$(nproc) - cd .. + - name: Build all + run: | + cd deps/emsdk + ./emsdk install latest + ./emsdk activate latest + source ./emsdk_env.sh + cd ../.. + mkdir -p build_em + cd build_em + export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib + emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a + emmake make -j$(nproc) + cd .. - - name: Run tests - run: | - cp tools/generate_bls_keys build_em/ - cp tools/decrypt_message build_em/ - cd build_em/ - cp threshold_encryption/encrypt_message.* . - ./generate_bls_keys - MESSAGE=`cat message.txt` - PUBLIC_BLS_KEY=`cat bls_public_key.txt` - node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt - ./decrypt_message + - name: Run tests + run: | + cp tools/generate_bls_keys build_em/ + cp tools/decrypt_message build_em/ + cd build_em/ + cp threshold_encryption/encrypt_message.* . + ./generate_bls_keys + MESSAGE=`cat message.txt` + PUBLIC_BLS_KEY=`cat bls_public_key.txt` + node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt + ./decrypt_message From 8f62e78ec1e02a828b79197fad47848bd903fd3e Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 21:00:38 +0200 Subject: [PATCH 09/18] yml build script fixes --- .github/workflows/test.yml | 145 ++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 67 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66bd3ebf..7562bd19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: sudo apt-get update sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib + python3.6 gcc-multilib sudo apt-get update -qq sudo apt-get install -y python3-pip pip3 install --upgrade pip @@ -46,6 +46,17 @@ jobs: sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 sudo python3.6 -m pip install requests[security] sudo python3.6 -m pip install codecov --ignore-installed + - name: get newest lcov + run: | + rm -rf newer_lcov || true + mkdir newer_lcov + cd newer_lcov + git clone https://github.com/linux-test-project/lcov --recursive --recurse-submodules + cd lcov + make install + cd .. + cd .. + lcov --version - name: Build dependencies run: | @@ -138,74 +149,74 @@ jobs: ./threshold_encryption/te_test ./dkg_attack - linux_build_with_emscripten: - runs-on: ubuntu-18.04 + linux_build_with_emscripten: + runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: [14.x] + strategy: + matrix: + node-version: [14.x] - steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib - sudo apt-get update -qq - sudo apt-get install -y python3-pip - pip3 install --upgrade pip - sudo python3.6 -m pip install --upgrade pip - sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 - sudo python3.6 -m pip install requests[security] - sudo python3.6 -m pip install codecov --ignore-installed + steps: + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison \ + python3.6 lcov gcc-multilib + sudo apt-get update -qq + sudo apt-get install -y python3-pip + pip3 install --upgrade pip + sudo python3.6 -m pip install --upgrade pip + sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 + sudo python3.6 -m pip install requests[security] + sudo python3.6 -m pip install codecov --ignore-installed - - name: Install NODE JS - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - name: Build dependencies - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd deps - ./build.sh WITH_EMSCRIPTEN=1 - cd .. + - name: Install NODE JS + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd deps + ./build.sh WITH_EMSCRIPTEN=1 + cd .. - - name: Build all - run: | - cd deps/emsdk - ./emsdk install latest - ./emsdk activate latest - source ./emsdk_env.sh - cd ../.. - mkdir -p build_em - cd build_em - export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib - emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a - emmake make -j$(nproc) - cd .. + - name: Build all + run: | + cd deps/emsdk + ./emsdk install latest + ./emsdk activate latest + source ./emsdk_env.sh + cd ../.. + mkdir -p build_em + cd build_em + export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib + emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a + emmake make -j$(nproc) + cd .. - - name: Run tests - run: | - cp tools/generate_bls_keys build_em/ - cp tools/decrypt_message build_em/ - cd build_em/ - cp threshold_encryption/encrypt_message.* . - ./generate_bls_keys - MESSAGE=`cat message.txt` - PUBLIC_BLS_KEY=`cat bls_public_key.txt` - node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt - ./decrypt_message + - name: Run tests + run: | + cp tools/generate_bls_keys build_em/ + cp tools/decrypt_message build_em/ + cd build_em/ + cp threshold_encryption/encrypt_message.* . + ./generate_bls_keys + MESSAGE=`cat message.txt` + PUBLIC_BLS_KEY=`cat bls_public_key.txt` + node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt + ./decrypt_message From dbf06b13a43c86c2f83cbcb2e4e5020245ae1f12 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 21:18:28 +0200 Subject: [PATCH 10/18] yml build script fixes --- .github/workflows/test.yml | 138 ++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7562bd19..04625826 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: sudo apt-get update sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison \ - python3.6 gcc-multilib + python3.6 gcc-multilib git sudo apt-get update -qq sudo apt-get install -y python3-pip pip3 install --upgrade pip @@ -46,9 +46,9 @@ jobs: sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 sudo python3.6 -m pip install requests[security] sudo python3.6 -m pip install codecov --ignore-installed - - name: get newest lcov + - name: Get newest lcov run: | - rm -rf newer_lcov || true + rm -rf newer_lcov || true mkdir newer_lcov cd newer_lcov git clone https://github.com/linux-test-project/lcov --recursive --recurse-submodules @@ -149,74 +149,74 @@ jobs: ./threshold_encryption/te_test ./dkg_attack - linux_build_with_emscripten: - runs-on: ubuntu-18.04 + linux_build_with_emscripten: + runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: [14.x] + strategy: + matrix: + node-version: [14.x] - steps: - - name: Extract repo name - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') - shell: bash - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Checkout - uses: actions/checkout@v2 - - name: Update apt - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ - libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib - sudo apt-get update -qq - sudo apt-get install -y python3-pip - pip3 install --upgrade pip - sudo python3.6 -m pip install --upgrade pip - sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 - sudo python3.6 -m pip install requests[security] - sudo python3.6 -m pip install codecov --ignore-installed + steps: + - name: Extract repo name + run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Checkout + uses: actions/checkout@v2 + - name: Update apt + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ + libffi-dev yasm texinfo flex bison \ + python3.6 lcov gcc-multilib + sudo apt-get update -qq + sudo apt-get install -y python3-pip + pip3 install --upgrade pip + sudo python3.6 -m pip install --upgrade pip + sudo python3.6 -m pip install pyopenssl ndg-httpsclient pyasn1 + sudo python3.6 -m pip install requests[security] + sudo python3.6 -m pip install codecov --ignore-installed - - name: Install NODE JS - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - name: Build dependencies - run: | - export CC=gcc-9 - export CXX=g++-9 - export TARGET=all - export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" - cd deps - ./build.sh WITH_EMSCRIPTEN=1 - cd .. + - name: Install NODE JS + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Build dependencies + run: | + export CC=gcc-9 + export CXX=g++-9 + export TARGET=all + export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON" + cd deps + ./build.sh WITH_EMSCRIPTEN=1 + cd .. - - name: Build all - run: | - cd deps/emsdk - ./emsdk install latest - ./emsdk activate latest - source ./emsdk_env.sh - cd ../.. - mkdir -p build_em - cd build_em - export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib - emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a - emmake make -j$(nproc) - cd .. + - name: Build all + run: | + cd deps/emsdk + ./emsdk install latest + ./emsdk activate latest + source ./emsdk_env.sh + cd ../.. + mkdir -p build_em + cd build_em + export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib + emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a + emmake make -j$(nproc) + cd .. - - name: Run tests - run: | - cp tools/generate_bls_keys build_em/ - cp tools/decrypt_message build_em/ - cd build_em/ - cp threshold_encryption/encrypt_message.* . - ./generate_bls_keys - MESSAGE=`cat message.txt` - PUBLIC_BLS_KEY=`cat bls_public_key.txt` - node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt - ./decrypt_message + - name: Run tests + run: | + cp tools/generate_bls_keys build_em/ + cp tools/decrypt_message build_em/ + cd build_em/ + cp threshold_encryption/encrypt_message.* . + ./generate_bls_keys + MESSAGE=`cat message.txt` + PUBLIC_BLS_KEY=`cat bls_public_key.txt` + node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt + ./decrypt_message From 8191f0371d4ac895bfb76da873d3fe170315b400 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 21:20:43 +0200 Subject: [PATCH 11/18] yml build script fixes --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 04625826..975cd7ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,7 @@ jobs: cd newer_lcov git clone https://github.com/linux-test-project/lcov --recursive --recurse-submodules cd lcov - make install + sudo make install cd .. cd .. lcov --version From 31c1eb46aa21f17e4a702751e671c7e6cbbb4b35 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 21:45:49 +0200 Subject: [PATCH 12/18] yml build script fixes --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 975cd7ff..6600eb60 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,7 +79,7 @@ jobs: - name: Run format check run: | cd build - make bls-format-check + #make bls-format-check - name: Build all run: | From 7e6a3463ebeb2e33eca522f9e6da3fbc34cb3e00 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 22:22:33 +0200 Subject: [PATCH 13/18] build fixes --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 972a8c0c..bfc89c1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,16 +136,16 @@ set(headers_bls set(PROJECT_VERSION 0.2.0) add_definitions(-DBLS_VERSION=${PROJECT_VERSION}) if ( APPLE ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wparentheses -Wunused -Wunreachable-code -Wextra -fPIC -std=c++17") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wparentheses -Wunused -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wunreachable-code -Wextra -fPIC -std=c++17") else() if (EMSCRIPTEN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++17")#-Werror -Wall -Wparentheses -Wunused -Wunreachable-code -Wextra -Wno-error=int-in-bool-context + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++17")#-Werror -Wall -Wparentheses -Wunused -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wunreachable-code -Wextra -Wno-error=int-in-bool-context else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wunreachable-code -Wextra -Wno-error=int-in-bool-context -fPIC -std=c++17") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wunreachable-code -Wextra -Wno-error=deprecated-copy -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wno-error=int-in-bool-context -fPIC -std=c++17") if( CMAKE_BUILD_TYPE STREQUAL "Debug" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wparentheses -Wunused" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wparentheses -Wunused -Wno-error=deprecated-copy -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized" ) else() - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-variable -Wno-error=maybe-uninitialized" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-copy -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized" ) endif() endif() endif() From 48ba2124b7542db598763f184a5b4a3aae4be9a3 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 22:44:21 +0200 Subject: [PATCH 14/18] build fixes --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfc89c1b..08845156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,10 +136,10 @@ set(headers_bls set(PROJECT_VERSION 0.2.0) add_definitions(-DBLS_VERSION=${PROJECT_VERSION}) if ( APPLE ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wparentheses -Wunused -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wunreachable-code -Wextra -fPIC -std=c++17") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wparentheses -Wunused -Wno-error=deprecated-copy -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wunreachable-code -Wextra -fPIC -std=c++17") else() if (EMSCRIPTEN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++17")#-Werror -Wall -Wparentheses -Wunused -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wunreachable-code -Wextra -Wno-error=int-in-bool-context + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++17")#-Werror -Wall -Wparentheses -Wunused -Wno-error=deprecated-copy -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wunreachable-code -Wextra -Wno-error=int-in-bool-context else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wunreachable-code -Wextra -Wno-error=deprecated-copy -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized -Wno-error=int-in-bool-context -fPIC -std=c++17") if( CMAKE_BUILD_TYPE STREQUAL "Debug" ) From e2de4b83c009c2c601fa98074ae67a698326b447 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 23:02:23 +0200 Subject: [PATCH 15/18] coverage fixes --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6600eb60..ec5ca363 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,10 @@ jobs: sudo make install cd .. cd .. + echo "Checking newest lcov version..." lcov --version + echo "Checking gcov tool version..." + gcov-tool-9 --version - name: Build dependencies run: | @@ -105,9 +108,9 @@ jobs: - name: Upload coverage run: | cd build - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files - lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files + lcov --capture --directory . --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info + lcov --remove coverage.info '/usr/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter system-files + lcov --remove coverage.info 'deps/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter dependency files # Uploading report to CodeCov bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" @@ -171,7 +174,7 @@ jobs: sudo apt-get update sudo apt-get install -y gcc-9 g++-9 clang-format-6.0 gawk sed shtool \ libffi-dev yasm texinfo flex bison \ - python3.6 lcov gcc-multilib + python3.6 gcc-multilib sudo apt-get update -qq sudo apt-get install -y python3-pip pip3 install --upgrade pip From f3f3b3d7c99dd63c27c8d904e5f61953b0c5de09 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 4 Nov 2021 23:15:36 +0200 Subject: [PATCH 16/18] coverage fixes --- .github/workflows/test.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec5ca363..d4ffb52d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,8 +58,8 @@ jobs: cd .. echo "Checking newest lcov version..." lcov --version - echo "Checking gcov tool version..." - gcov-tool-9 --version + # echo "Checking gcov tool version..." + # gcov-tool-9 --version - name: Build dependencies run: | @@ -105,15 +105,18 @@ jobs: ./threshold_encryption/te_test ./dkg_attack - - name: Upload coverage - run: | - cd build - lcov --capture --directory . --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info - lcov --remove coverage.info '/usr/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter system-files - lcov --remove coverage.info 'deps/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter dependency files + # - name: Upload coverage + # run: | + # cd build + # # lcov --capture --directory . --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info + # # lcov --remove coverage.info '/usr/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter system-files + # # lcov --remove coverage.info 'deps/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter dependency files + # lcov --capture --directory . --output-file coverage.info + # lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files + # lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files - # Uploading report to CodeCov - bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" + # # Uploading report to CodeCov + # bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" osx_build_and_test: runs-on: macos-11 From 495bc2ac2e4023268afa413939752776a1576759 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Fri, 5 Nov 2021 16:14:14 +0200 Subject: [PATCH 17/18] yml build script fixes --- .github/workflows/test.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4ffb52d..12c284ae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,6 +48,9 @@ jobs: sudo python3.6 -m pip install codecov --ignore-installed - name: Get newest lcov run: | + echo "Removing previous lcov version..." + sudo apt-get remove lcov || true + echo "Installing newest lcov version..." rm -rf newer_lcov || true mkdir newer_lcov cd newer_lcov @@ -56,7 +59,8 @@ jobs: sudo make install cd .. cd .. - echo "Checking newest lcov version..." + echo "Checking installed lcov version..." + which lcov lcov --version # echo "Checking gcov tool version..." # gcov-tool-9 --version @@ -105,18 +109,18 @@ jobs: ./threshold_encryption/te_test ./dkg_attack - # - name: Upload coverage - # run: | - # cd build - # # lcov --capture --directory . --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info - # # lcov --remove coverage.info '/usr/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter system-files - # # lcov --remove coverage.info 'deps/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter dependency files - # lcov --capture --directory . --output-file coverage.info - # lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files - # lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files + - name: Upload coverage + run: | + cd build + # lcov --capture --directory . --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info + # lcov --remove coverage.info '/usr/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter system-files + # lcov --remove coverage.info 'deps/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter dependency files + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files + lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files - # # Uploading report to CodeCov - # bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" + # Uploading report to CodeCov + bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" osx_build_and_test: runs-on: macos-11 From 35d0b5985fdc3118e7d56878597e40e3e8083504 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Fri, 5 Nov 2021 17:09:51 +0200 Subject: [PATCH 18/18] yml build script fixes --- .github/workflows/test.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12c284ae..fb89bf58 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,10 +27,29 @@ jobs: run: | sudo apt-get install -y software-properties-common sudo apt-get install -y gcc-9 g++-9 - - name: use g++-9 by default + - name: Use g++-9 and gcov-9 by default run: | + echo "Updating all needed alternatives" sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 + sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-9 9 + sudo update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-9 9 + sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-9 9 + echo "Checking alternative for gcc" + which gcc + gcc --version + echo "Checking alternative for g++" + which g++ + g++ --version + echo "Checking alternative for gcov" + which gcov + gcov --version + echo "Checking alternative for gcov-dump" + which gcov-dump + gcov-dump --version + echo "Checking alternative for gcov-tool" + which gcov-tool + gcov-tool --version - name: Update apt run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; - name: Install packages @@ -62,8 +81,6 @@ jobs: echo "Checking installed lcov version..." which lcov lcov --version - # echo "Checking gcov tool version..." - # gcov-tool-9 --version - name: Build dependencies run: | @@ -112,13 +129,9 @@ jobs: - name: Upload coverage run: | cd build - # lcov --capture --directory . --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info - # lcov --remove coverage.info '/usr/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter system-files - # lcov --remove coverage.info 'deps/*' --gcov-tool /usr/bin/gcov-tool-9 --output-file coverage.info # filter dependency files lcov --capture --directory . --output-file coverage.info lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files - # Uploading report to CodeCov bash <(curl -s https://codecov.io/bash) -f coverage.info -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports"