Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: bundle msgpack to fix CI #450

Merged
merged 2 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "cpp/src/msgpack-c"]
path = cpp/src/msgpack-c
url = https://github.com/AztecProtocol/msgpack-c
[submodule "foundation"]
path = foundation
url = git@github.com:AztecProtocol/foundation.git
Expand Down
1 change: 0 additions & 1 deletion cpp/src/msgpack-c
Submodule msgpack-c deleted from 1c90fb
72 changes: 72 additions & 0 deletions cpp/src/msgpack-c/.github/depends/boost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

usage()
{
cat <<EOL
-b - 32-bit or 64-bit library, maybe 32, 64 or both
-t - the toolset, maybe gcc, clang or both
-p - installation prefix
EOL
}

build_boost()
{
./b2 \
--toolset=$1 \
--prefix=$3/$2 \
--with-test \
--with-headers \
--with-chrono \
--with-context \
--with-filesystem \
--with-system \
--with-timer \
address-model=$2 \
install || exit 1
}

bit="64"
toolset="gcc"
prefix="$HOME/boost-prefix"

while getopts "b:t:p:" c; do
case "$c" in
b)
bit="$OPTARG"
[ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1
;;
t)
toolset="$OPTARG"
[ "$toolset" != "gcc" ] && [ "$toolset" != "clang" ] && [ "$toolset" != "both" ] && usage && exit 1
;;
p)
prefix="$OPTARG"
;;
?*)
echo "invalid arguments." && exit 1
;;
esac
done

mkdir $prefix || exit 1
wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1
tar xf boost_1_76_0.tar.bz2 || exit 1
cd boost_1_76_0
./bootstrap.sh || exit 1

build()
{
if [ "$bit" = "both" ]; then
build_boost $1 32 $prefix
build_boost $1 64 $prefix
else
build_boost $1 $bit $prefix
fi
}

if [ "$toolset" = "both" ]; then
build gcc
build clang
else
build $toolset
fi
51 changes: 51 additions & 0 deletions cpp/src/msgpack-c/.github/depends/zlib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

usage()
{
cat <<EOL
-b - 32-bit or 64-bit library, maybe 32 or 64
-p - installation prefix
EOL
}

bit="64"
prefix="$HOME/zlib-prefix"

while getopts "b:t:p:" c; do
case "$c" in
b)
bit="$OPTARG"
[ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1
;;
p)
prefix="$OPTARG"
;;
?*)
echo "invalid arguments." && exit 1
;;
esac
done

mkdir $prefix || exit 1
wget https://zlib.net/zlib-1.2.13.tar.gz || exit 1
tar -xf zlib-1.2.13.tar.gz || exit 1
cd zlib-1.2.13

build()
{
cmake \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=$2/$1 \
-D CMAKE_C_FLAGS="-m$1" \
-D CMAKE_SHARED_LINKER_FLAGS="-m$1" \
-B build$1 \
-S .
cmake --build build$1 --target install
}

if [ "$bit" = "both" ]; then
build 32 $prefix
build 64 $prefix
else
build $bit $prefix
fi
73 changes: 73 additions & 0 deletions cpp/src/msgpack-c/.github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: coverage

on:
pull_request:
types: [opened, synchronize]
push:
branches:
- cpp_master
tags:
- '*'

jobs:
codecov:
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install g++-10 cmake lcov -y
./ci/set_gcc_10.sh
- name: Cache boost
id: cache-boost
uses: actions/cache@v1
with:
path: ~/boost-prefix/
key: ${{ runner.os }}-boost-64-1-76-0-2021-08-09

- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: ./.github/depends/boost.sh -b 64 -t gcc -p $HOME/boost-prefix

- name: Cache zlib
id: cache-zlib
uses: actions/cache@v1
with:
path: ~/zlib-prefix/
key: ${{ runner.os }}-zlib-64-1-2-11-2021-08-09

- name: Build zlib
if: steps.cache-zlib.outputs.cache-hit != 'true'
run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix

- name: Compile tests
run: |
mkdir build
cmake \
-D MSGPACK_CXX20=ON \
-D MSGPACK_32BIT=OFF \
-D MSGPACK_CHAR_SIGN=signed \
-D MSGPACK_USE_X3_PARSE=ON \
-D MSGPACK_BUILD_EXAMPLES=ON \
-D MSGPACK_BUILD_TESTS=ON \
-D CMAKE_BUILD_TYPE=Debug \
-D MSGPACK_GEN_COVERAGE=ON \
-D CMAKE_PREFIX_PATH="$HOME/zlib-prefix/64;$HOME/boost-prefix/64" \
-B build \
-S . || exit 1
cmake --build build --target all || exit 1
ctest --test-dir build || exit 1
- name: Upload coverage to Codecov
working-directory: build
run: |
# Create lcov report
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files
lcov --list coverage.info # debug info
# Uploading report to CodeCov
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
Loading