Skip to content

Commit

Permalink
Merge branch 'develop' into master2dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Sep 27, 2023
2 parents 2a993e5 + dae755b commit 48e6c26
Show file tree
Hide file tree
Showing 184 changed files with 4,641 additions and 3,073 deletions.
151 changes: 114 additions & 37 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ orbs:
github-release: izumin5210/[email protected]
gcp-gcr: circleci/[email protected]
gcp-cli: circleci/[email protected]
docker-cache: cci-x/[email protected]
helm-release: taraxa/[email protected]

commands:
Expand Down Expand Up @@ -184,10 +183,10 @@ commands:
- run:
name: Cleanup PRNet IPs
command: |
if [[ $(gcloud compute addresses list --format json --project << parameters.project >> --filter="name~'prnet-boot-<< parameters.pr-name >>.*'" ) != "[]" ]];then
if [[ $(gcloud compute addresses list --format json --project << parameters.project >> --filter="name~'prnet-boot-<< parameters.pr-name >>.*'" ) != "[]" ]];then
gcloud compute addresses delete prnet-boot-<< parameters.pr-name >>-{1..3} --region << parameters.region >> --project << parameters.project >> --quiet
fi
if [[ $(gcloud compute addresses list --format json --project << parameters.project >> --filter="name~'prnet-rpc-<< parameters.pr-name >>.*'" ) != "[]" ]];then
if [[ $(gcloud compute addresses list --format json --project << parameters.project >> --filter="name~'prnet-rpc-<< parameters.pr-name >>.*'" ) != "[]" ]];then
gcloud compute addresses delete prnet-rpc-<< parameters.pr-name >>-{1..3} --region << parameters.region >> --project << parameters.project >> --quiet
fi
when: << parameters.when >>
Expand Down Expand Up @@ -216,7 +215,7 @@ commands:
echo -n "<< parameters.kubeconfig >>" | base64 --decode > $HOME/.kube/config
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo cp kubectl /usr/local/bin
sudo cp kubectl /usr/local/bin
sudo chmod +x /usr/local/bin/kubectl
when: << parameters.when >>

Expand Down Expand Up @@ -306,7 +305,7 @@ commands:
echo "waiting.. for all resources to be deleted"
echo ${GETALL}
sleep 10
fi
fi
done
if [ $i -eq 50 ];then
echo "Exiting after 500 seconds not all resources may have cleaned up"
Expand All @@ -320,47 +319,55 @@ commands:
steps:
- run:
name: Prepare env variables
command: |
command: |
echo "export PR=$( [[ -z ${CIRCLE_PULL_REQUEST+x} ]] && echo false || echo $(basename ${CIRCLE_PULL_REQUEST}) )" >> $BASH_ENV
export PR=$( [[ -z ${CIRCLE_PULL_REQUEST+x} ]] && echo false || echo $(basename ${CIRCLE_PULL_REQUEST}) )
echo "export SHORT_GIT_HASH=$(echo $CIRCLE_SHA1 | cut -c -7)" >> $BASH_ENV
echo "export VERSION=$(git rev-parse --short HEAD)" >> $BASH_ENV
echo "export HELM_TEST_NAME=pr-${PR}" >> $BASH_ENV
echo "export DOCKER_BRANCH_TAG=$(./scripts/docker_tag_from_branch.sh $CIRCLE_BRANCH)" >> $BASH_ENV
echo "export GCP_IMAGE=gcr.io/${GOOGLE_PROJECT_ID}/${IMAGE}" >> $BASH_ENV
- run:
name: Clean old Images if disk available is lower than 15G
command: |
for time in 120 96 72 48 24 12 6 3 1 0
do
if [ $(df /var/lib/docker --block-size=1073741824 --output=avail|grep -v Avail) -lt 15 ]; then
df /var/lib/docker --block-size=1073741824 --output=avail
echo "Pruning images older than ${time}h"
docker image prune -a --force --filter "until=${time}h"
fi
done
build:
description: Builds docker images
description: Builds docker image (${IMAGE})
steps:
- run:
name: Build builder image
command: |
docker build -t ${IMAGE}:${VERSION} --target builder .
- run:
name: Checkout Submodules
command: |
git submodule sync
git submodule update --init --recursive --jobs 8
- run:
name: Build ctest image
name: Compile and build binaries
command: |
docker build -t ${IMAGE}-ctest:${VERSION} --target build .
- run:
name: Build taraxad image
name: Build final Docker image
command: |
docker build -t ${IMAGE}:${VERSION} .
build_builder:
description: Builds docker image (${IMAGE})
steps:
- run:
name: Build builder image
command: |
docker build -t ${IMAGE}:${VERSION} -f builder.Dockerfile .
tag_builder:
description: Tags docker images (builder)
steps:
- run:
name: Tag images
command: |
if [[ ${CIRCLE_TAG} != "" ]];then
TAG=$(echo ${CIRCLE_TAG} | sed 's/^builder-//g')
docker tag ${IMAGE}:${VERSION} taraxa/${IMAGE}:${TAG}
docker tag ${IMAGE}:${VERSION} taraxa/${IMAGE}:latest
else
docker tag ${IMAGE}:${VERSION} taraxa/${IMAGE}:${VERSION}
fi
tag:
description: Tags docker images
steps:
Expand Down Expand Up @@ -504,24 +511,24 @@ commands:
if [ ! -z "$(docker network list --format '{{.Name}}' | grep -o smoketest-${VERSION})" ]; then
docker network rm smoketest-${VERSION} >/dev/null;
fi
docker network create --driver=bridge \
smoketest-${VERSION}
docker run -d\
--name smoketest-${VERSION} \
--net smoketest-${VERSION} \
${IMAGE}:${VERSION} \
single
mkdir -p $PWD/test_build-d/
sleep 30
echo "--- Logs from container ---"
docker logs smoketest-${VERSION}
echo "--- Logs from container ---"
http_code=$(docker run --rm -v $PWD/test_build-d:/data \
--net smoketest-${VERSION} \
byrnedo/alpine-curl \
Expand All @@ -540,7 +547,7 @@ commands:
"secret": "3800b2875669d9b2053c1aff9224ecfdc411423aac5b5a73d7a45ced1c3b9dcd"
}]
}')
cat $PWD/test_build-d/http.out || true
if [[ $http_code -eq 200 ]] ; then
exit 0
Expand Down Expand Up @@ -701,9 +708,34 @@ jobs:
- test
- tag
- push_gcr

build-builder-docker-image:
environment:
- IMAGE: taraxa-builder
- CONAN_REVISIONS_ENABLED: 1
machine:
image: ubuntu-2204:2022.04.2
docker_layer_caching: true
resource_class: large
steps:
- checkout
- prepare
- run:
name: List images restored from DLC
command: |
docker images
- build_builder
- run:
name: List images to be saved in DLC
command: |
docker images
- run:
name: Show layers of taraxa-builder image
command: |
docker history taraxa-builder:${VERSION}
- tag_builder
- push_dockerhub
- store_artifacts:
path: tmp_docker


release-docker-image:
environment:
Expand All @@ -720,8 +752,6 @@ jobs:
- test
- tag
- push_dockerhub
- store_artifacts:
path: tmp_docker

create-and-push-builder:
docker:
Expand Down Expand Up @@ -1009,6 +1039,47 @@ workflows:
- build-linux
- build-mac


# ### workflows for builder image ### #
# run this workflow for specific branches 'builder/*'
build-builder-docker-image:
when:
and:
- not: << pipeline.parameters.deploy_prnet >>
- not: << pipeline.parameters.redeploy_prnet >>
- not: << pipeline.parameters.cleanup_prnet >>
jobs:
- build-builder-docker-image:
filters:
branches:
only:
- /^builder\/.*/
- /^chore\/builder-.*/
- /^fix\/builder-.*/
- /^feature\/builder-.*/
context:
- DOCKERHUB

# run this workflow for specific tags 'builder/*'
release-builder-docker-image:
when:
and:
- not: << pipeline.parameters.deploy_prnet >>
- not: << pipeline.parameters.redeploy_prnet >>
- not: << pipeline.parameters.cleanup_prnet >>
jobs:
- build-builder-docker-image:
filters:
branches:
ignore: /.*/
tags:
only: /^builder-v\d+.\d+.\d+/
context:
- DOCKERHUB
# ### workflows for builder image ### #


# ### workflows for taraxa-node image ### #
# run this workflow for all branches apart those reserved for chart
build-docker-image:
when:
Expand All @@ -1026,6 +1097,10 @@ workflows:
- /^chore\/chart-.*/
- /^fix\/chart-.*/
- /^feature\/chart-.*/
- /^builder\/.*/
- /^chore\/builder-.*/
- /^fix\/builder-.*/
- /^feature\/builder-.*/
context:
- TARAXA
- GCP
Expand Down Expand Up @@ -1060,7 +1135,7 @@ workflows:
- release-docker-image:
filters:
tags:
only:
only:
- /^v?\d+\.\d+\.\d+$/
- /^v?\d+\.\d+\.\d+-beta$/
branches:
Expand All @@ -1071,7 +1146,9 @@ workflows:
- K8S
- GCR
- DOCKERHUB
# ### workflows for taraxa-node image ### #

# ### workflows for taraxa-node helm chart ### #
# run this workflow for branches specified below
build-helm-chart:
when:
Expand All @@ -1091,13 +1168,12 @@ workflows:
- CHARTSREPO
filters:
branches:
only:
only:
- /^chart\/.*/
- /^chore\/chart-.*/
- /^fix\/chart-.*/
- /^feature\/chart-.*/


# run this workflow for tags, like chart-vX.Y.Z
release-helm-chart:
jobs:
Expand All @@ -1114,3 +1190,4 @@ workflows:
ignore: /.*/
tags:
only: /^chart-v\d+.\d+.\d+/
# ### workflows for taraxa-node helm chart ### #
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ set(TARAXA_PATCH_VERSION 4)
set(TARAXA_VERSION ${TARAXA_MAJOR_VERSION}.${TARAXA_MINOR_VERSION}.${TARAXA_PATCH_VERSION})

# Any time a change in the network protocol is introduced this version should be increased
set(TARAXA_NET_VERSION 1)
set(TARAXA_NET_VERSION 2)
# Major version is modified when DAG blocks, pbft blocks and any basic building blocks of our blockchain is modified
# in the db
set(TARAXA_DB_MAJOR_VERSION 1)
# Minor version should be modified when changes to the database are made in the tables that can be rebuilt from the
# basic tables
set(TARAXA_DB_MINOR_VERSION 1)
set(TARAXA_DB_MINOR_VERSION 2)

# Defines Taraxa library target.
project(taraxa-node VERSION ${TARAXA_VERSION})
Expand Down
51 changes: 28 additions & 23 deletions CMakeModules/cpp_graphql_gen.cmake
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
########### cppgraphqlgen ###########
# ########## cppgraphqlgen ###########
include(FetchContent)

set(Boost_NO_WARN_NEW_VERSIONS 1)

FetchContent_Declare(
cppgraphqlgen
GIT_REPOSITORY https://github.com/microsoft/cppgraphqlgen.git
GIT_TAG 8c1623acc42392ef2a1bc0336482621386f98c77 # v4.5.0
GIT_TAG 8c1623acc42392ef2a1bc0336482621386f98c77 # v4.5.0
)
set(GRAPHQL_BUILD_TESTS OFF)
set(GRAPHQL_UPDATE_VERSION OFF)
set(GRAPHQL_UPDATE_SAMPLES OFF)
#set(GRAPHQL_BUILD_SCHEMAGEN OFF)

# set(GRAPHQL_BUILD_SCHEMAGEN OFF)
set(GRAPHQL_BUILD_CLIENTGEN OFF)

FetchContent_MakeAvailable(cppgraphqlgen)
######################################

# #####################################
set(GRAPHQL_GEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/network/graphql/gen)
list(APPEND GRAPHQL_GENERATED_SOURCES
${GRAPHQL_GEN_DIR}/AccountObject.cpp
${GRAPHQL_GEN_DIR}/BlockObject.cpp
${GRAPHQL_GEN_DIR}/CallResultObject.cpp
${GRAPHQL_GEN_DIR}/CurrentStateObject.cpp
${GRAPHQL_GEN_DIR}/DagBlockObject.cpp
${GRAPHQL_GEN_DIR}/LogObject.cpp
${GRAPHQL_GEN_DIR}/MutationObject.cpp
${GRAPHQL_GEN_DIR}/PendingObject.cpp
${GRAPHQL_GEN_DIR}/QueryObject.cpp
${GRAPHQL_GEN_DIR}/SubscriptionObject.cpp
${GRAPHQL_GEN_DIR}/SyncStateObject.cpp
${GRAPHQL_GEN_DIR}/TaraxaSchema.cpp
${GRAPHQL_GEN_DIR}/TransactionObject.cpp
${GRAPHQL_GEN_DIR}/AccountObject.cpp
${GRAPHQL_GEN_DIR}/BlockObject.cpp
${GRAPHQL_GEN_DIR}/CallResultObject.cpp
${GRAPHQL_GEN_DIR}/CurrentStateObject.cpp
${GRAPHQL_GEN_DIR}/DagBlockObject.cpp
${GRAPHQL_GEN_DIR}/LogObject.cpp
${GRAPHQL_GEN_DIR}/MutationObject.cpp
${GRAPHQL_GEN_DIR}/PendingObject.cpp
${GRAPHQL_GEN_DIR}/QueryObject.cpp
${GRAPHQL_GEN_DIR}/SubscriptionObject.cpp
${GRAPHQL_GEN_DIR}/SyncStateObject.cpp
${GRAPHQL_GEN_DIR}/TaraxaSchema.cpp
${GRAPHQL_GEN_DIR}/TransactionObject.cpp
)

add_custom_command(OUTPUT ${GRAPHQL_GENERATED_SOURCES}
COMMAND ${CMAKE_COMMAND} -E remove -f ${GRAPHQL_GEN_DIR}/*.cpp
COMMAND ${CMAKE_COMMAND} -E remove -f ${GRAPHQL_GEN_DIR}/*.h
COMMAND cppgraphqlgen::schemagen --schema="${CMAKE_CURRENT_SOURCE_DIR}/network/graphql/schema/schema.taraxa.graphql" --prefix="Taraxa" --namespace="taraxa"
WORKING_DIRECTORY ${GRAPHQL_GEN_DIR}
COMMENT "Regenerating TaraxaSchema files")
add_custom_command(
OUTPUT ${GRAPHQL_GENERATED_SOURCES}
COMMAND ${CMAKE_COMMAND} -E remove -f ${GRAPHQL_GEN_DIR}/*.cpp
COMMAND ${CMAKE_COMMAND} -E remove -f ${GRAPHQL_GEN_DIR}/*.h
COMMAND cppgraphqlgen::schemagen --schema="${CMAKE_CURRENT_SOURCE_DIR}/network/graphql/schema/schema.taraxa.graphql" --prefix="Taraxa" --namespace="taraxa"
WORKING_DIRECTORY ${GRAPHQL_GEN_DIR}
COMMENT "Regenerating TaraxaSchema files"
DEPENDS ${GRAPHQL_GEN_DIR}/../schema/schema.taraxa.graphql
)
Loading

0 comments on commit 48e6c26

Please sign in to comment.