Merge pull request #214 from skalenetwork/move-to-g++-11 #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish libBLS | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- beta | |
- stable | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-22.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 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '14.x' | |
registry-url: 'https://registry.npmjs.org' | |
- 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-11 g++-11 | |
- name: use g++-11 by default | |
run: | | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11 | |
- name: Install more packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gawk sed shtool \ | |
libffi-dev yasm texinfo libgnutls28-dev gcc-multilib | |
- name: Build dependencies | |
run: | | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export TARGET=all | |
cd deps | |
./build.sh | |
- name: Configure | |
run: | | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export TARGET=all | |
mkdir -p build && cd build | |
cmake .. | |
- name: Build | |
run: | | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export TARGET=all | |
cd build | |
make -j$(nproc) | |
- name: Build dependencies wasm | |
run: | | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export TARGET=all | |
cd deps | |
./clean.sh | |
./build.sh WITH_EMSCRIPTEN=1 | |
cd .. | |
- name: Build wasm | |
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 .. | |
cp build_em/threshold_encryption/encrypt.js node/ | |
- name: Calculate version | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
echo "Branch $BRANCH" | |
echo "::set-env name=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: Publish on npm | |
if: github.ref != 'refs/heads/stable' | |
run: | | |
cd node | |
npm version --no-git-tag-version ${{ env.VERSION }} | |
npm publish --access public --tag ${{ env.BRANCH }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish on npm (stable) | |
if: github.ref == 'refs/heads/stable' | |
run: | | |
cd node | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- 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 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 |