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

[DOPS-2942]: Update substrate build #907

Merged
merged 149 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 135 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
2958940
test coverage
Jan 9, 2024
3551dfd
fix nightly
Jan 9, 2024
6616d62
fix envs
Jan 9, 2024
b2aecd4
disable clippy
Jan 9, 2024
390c787
fix
Jan 9, 2024
b3560f3
test library
Jan 11, 2024
54ab3e8
make fail when coverage with errors
Jan 11, 2024
8ccdee6
Merge branch 'develop' of https://github.com/sora-xor/sora2-network i…
Jan 11, 2024
51fa270
fix env
Jan 11, 2024
f8b0587
fix secrets
Jan 11, 2024
5194bec
fix env
Jan 11, 2024
fc6cb8c
test env image
Jan 11, 2024
24d4ea8
debug
Jan 11, 2024
1634375
debug2
Jan 11, 2024
45685d7
debug3
Jan 11, 2024
2e684ff
fix debug3
Jan 11, 2024
079af82
debug4
Jan 12, 2024
225c886
revert to old toolchain
Jan 12, 2024
f8ec10c
fix debug
Jan 12, 2024
f42a4b1
test dockerfile
Jan 12, 2024
bd44c8e
test dockerfile
Jan 12, 2024
b50a122
test dockerfile and debug5
Jan 12, 2024
6888872
test
Jan 12, 2024
c94d8f1
test 10
Jan 12, 2024
8440ec0
try to revert old env
Jan 15, 2024
f4424b3
try to revert old env
Jan 15, 2024
c46cdf2
test env
Jan 15, 2024
39c8a9c
cobertura report
Jan 15, 2024
54c5161
decrease grcov
Jan 15, 2024
b9488fe
decrease grcov to 0.5.15 and move it to var
Jan 15, 2024
c8e10ed
decrease grcov to 0.5.15 and move it to var
Jan 15, 2024
6d1512d
update clang
Jan 15, 2024
ea172b6
test grcov
Jan 15, 2024
40a6d1b
update Dockerfile
Jan 16, 2024
f7c5eae
debug
Jan 16, 2024
48e3bdd
debug
Jan 16, 2024
b146ab9
test coverage
Jan 17, 2024
bbe753d
fix
Jan 17, 2024
2395333
test
Jan 17, 2024
bee7970
change dir
Jan 18, 2024
92e28a1
debug
Jan 18, 2024
8f0747f
disable debug
Jan 18, 2024
5a86c6f
test
Jan 19, 2024
c7c9603
test
Jan 19, 2024
0ac46c8
test lcov
Jan 19, 2024
64f9236
revert cobertura
Jan 19, 2024
11873e1
revert cobertura
Jan 19, 2024
84ff5e8
fix
Jan 22, 2024
154ded2
test
Jan 22, 2024
a54f6a1
revert features
Jan 22, 2024
d132a1f
try coverage
Jan 22, 2024
07e0df2
test threads
Jan 22, 2024
93c36b8
fix tests
Jan 23, 2024
424deb7
change tests
Jan 23, 2024
970a63c
change test workflow
Jan 23, 2024
315827c
update tests and coverage
Jan 23, 2024
1dafbeb
update tests and coverage
Jan 23, 2024
9d84348
fix
Jan 23, 2024
df0e9e6
fix
Jan 23, 2024
6620546
fix
Jan 23, 2024
8f05211
revert
Jan 23, 2024
a11c9b9
debug
Jan 23, 2024
478ef36
fix output
Jan 23, 2024
53bd361
fix coverage
Jan 23, 2024
f328066
test
Jan 23, 2024
c8c6e0c
rename report
Jan 24, 2024
1ab0b4f
test workflow
Jan 24, 2024
e9eabe1
fix
Jan 24, 2024
635106d
fix
Jan 24, 2024
cbff71a
test workflow
Jan 24, 2024
b7cb908
test workflow
Jan 24, 2024
bc41c41
test workflow
Jan 24, 2024
00a0a93
test 3
Jan 24, 2024
cb1731f
test 4
Jan 24, 2024
450879d
one feature report
Jan 25, 2024
08daf80
test lcov format
Jan 25, 2024
fa9c88d
sora2-stage-v5
Jan 25, 2024
1f42139
reduce steps
Jan 25, 2024
ae1c79e
reduce steps
Jan 25, 2024
b3bf42b
reduce steps
Jan 25, 2024
adc4066
test
Jan 25, 2024
2db4944
test coverage
Feb 7, 2024
374b00b
Merge branch develop
Feb 7, 2024
74d9c65
update env image
Feb 12, 2024
187c896
Add sonar, dojo
C4tWithShell Feb 12, 2024
9413f53
Fix coverage
C4tWithShell Feb 12, 2024
3eabaa2
update env
Feb 13, 2024
2e80677
reduce features for testing
Feb 13, 2024
536b8d4
change llvm-tool ver
Feb 13, 2024
1321b21
test coverage
Feb 13, 2024
92d2a8f
test coverage
Feb 13, 2024
334f476
test coverage name
Feb 14, 2024
09fbe78
Merge branch 'develop' of https://github.com/sora-xor/sora2-network i…
Feb 14, 2024
617de62
update build and coverage
Feb 14, 2024
e94d692
small fixes
Feb 14, 2024
bfd9510
revert
Feb 14, 2024
3b136e6
test
Feb 14, 2024
d4d4dde
test
Feb 14, 2024
b6662c7
test
Feb 14, 2024
2ed090a
fix
Feb 14, 2024
2ebf6a7
fix comments
Feb 14, 2024
fc1ec1a
fix comments
Feb 14, 2024
6862470
update build
Feb 14, 2024
b72bce3
test
Feb 14, 2024
0838cf2
update coverage and env
Feb 14, 2024
f5997eb
fix path
Feb 14, 2024
f52abeb
update coverage
Feb 14, 2024
2de3e52
fix
Feb 14, 2024
18cb209
update env, test lcov
Feb 15, 2024
72e4f26
change build
Feb 15, 2024
5742cda
update build
Feb 15, 2024
cfaac50
update Jenkinsfile
Feb 15, 2024
3250dc3
update Jenkinsfile
Feb 15, 2024
77b8d49
test build func
Feb 15, 2024
8b0dda1
Merge branch 'develop' into feature/dops-2942-update-build
f33r0 Feb 15, 2024
10cfff4
update build
Feb 15, 2024
7c3a287
Merge branch 'feature/dops-2942-update-build' of https://github.com/s…
Feb 15, 2024
61e15bf
Merge branch 'develop' into feature/dops-2942-update-build
f33r0 Feb 15, 2024
2ebb7eb
fix comment
Feb 21, 2024
691d891
Merge branch 'feature/dops-2942-update-build' of https://github.com/s…
Feb 21, 2024
d9ce493
Merge branch 'develop' into feature/dops-2942-update-build
f33r0 Feb 21, 2024
cbfccb9
update build
Feb 23, 2024
a72f4f7
fix
Feb 23, 2024
37fbff1
fix
Feb 24, 2024
7574c27
revert
Feb 24, 2024
8c846d6
Update build.sh
f33r0 Feb 24, 2024
f377513
ready for merge
Feb 26, 2024
b2ef4ac
revert .env
Feb 26, 2024
a9b2f9e
fix
Feb 26, 2024
0c7044b
Update .env
f33r0 Feb 26, 2024
8d2b12d
Update Jenkinsfile
f33r0 Feb 27, 2024
3d5b921
Merge branch 'develop' into feature/dops-2942-update-build
f33r0 Feb 27, 2024
c6efe50
fix
Feb 27, 2024
74eb5ea
fix scanner
Feb 27, 2024
14a6d3a
fix scanner
Feb 27, 2024
23624ff
Update Jenkinsfile-env
f33r0 Feb 27, 2024
6fce464
update subwasm
Feb 27, 2024
48547a7
Merge branch 'feature/dops-2942-update-build' of https://github.com/s…
Feb 27, 2024
3ac2357
update build
Feb 28, 2024
62561bf
update workflow
Feb 28, 2024
84f7492
coverage optimization
Feb 28, 2024
38a800b
update build
Feb 28, 2024
a76f1bc
Merge branch 'develop' into feature/dops-2942-update-build
f33r0 Feb 29, 2024
84dd72c
merge lib
Feb 29, 2024
d0fec95
Merge branch 'feature/dops-2942-update-build' of https://github.com/s…
Feb 29, 2024
5875521
fix
Feb 29, 2024
7e8fc74
fix tests
Feb 29, 2024
b45625f
fix
Feb 29, 2024
2c6bd14
fix
Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ housekeeping
LICENSE
rustfmt.toml
db*
.env
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ db?
.vscode/launch.json

# Generated folder for benchmark results (order book extra benchmarks)
benches/
benches/
12 changes: 8 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
@Library('jenkins-library') _
@Library('jenkins-library@feature/dops-2942-update_rust_lib') _

def pipeline = new org.rust.AppPipeline(steps: this,
initSubmodules: true,
envImageName: 'docker.soramitsu.co.jp/sora2/env:sub4',
envImageName: 'docker.soramitsu.co.jp/sora2/env:env',
appImageName: 'docker.soramitsu.co.jp/sora2/substrate',
codeCoverageCommand: './housekeeping/coverage.sh',
cargoDoc: true,
smartContractScanner: false,
clippyLinter: false,
cargoClippyTag: ':substrate',
Cre-eD marked this conversation as resolved.
Show resolved Hide resolved
cargoClippyCmds: ['housekeeping/clippy.sh'],
buildTestCmds: ['housekeeping/build.sh'],
buildTestCmds: 'housekeeping/build.sh',
buildArtifacts: 'framenode_runtime.compact.compressed.wasm, subwasm_report.json, pallet_list.txt',
Cre-eD marked this conversation as resolved.
Show resolved Hide resolved
pushToPublicRegistry: true
pushToPublicRegistry: true,
sonarProjectKey: 'sora:sora2-network',
sonarProjectName: 'sora2-network',
dojoProductType: 'sora'
)
pipeline.runPipeline()
6 changes: 3 additions & 3 deletions Jenkinsfile-env
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ def pipeline = new org.docker.AppPipeline(steps: this,
dockerImageName: 'sora2/env',
dockerRegistryCred: 'bot-sora2-rw',
dockerFileName: "housekeeping/docker/env/Dockerfile",
triggerCommonBuildExpression: (env.BRANCH_NAME in ['substrate-4.0.0']),
triggerCommonBuildExpression: (env.BRANCH_NAME in ['develop', 'master']),
triggerCommonBuildGrepRegex: 'housekeeping',
secretScannerExclusion: '.*Cargo.toml',
secretScannerExclusion: '.*Cargo.toml$|.*env\$',
nameCI: 'env-CI',
dockerImageTags: ['substrate-4.0.0':'sub4'])
dockerImageTags: ['master': 'env', 'develop': 'env'])
f33r0 marked this conversation as resolved.
Show resolved Hide resolved
pipeline.runPipeline()
3 changes: 3 additions & 0 deletions bridge-docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DATABASE_URL="postgres://postgres:${DATABASE_PASSWORD}@bridge-postgres:5432/postgres?sslmode=disable"
DATABASE_PASSWORD="postgres"
SECRET_KEY_BASE="56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN"
Cre-eD marked this conversation as resolved.
Show resolved Hide resolved
67 changes: 40 additions & 27 deletions housekeeping/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,63 @@ wasmReportFile='subwasm_report.json'
PACKAGE='framenode-runtime'
RUSTFLAGS='-Dwarnings'
RUNTIME_DIR='runtime'
allfeatures='private-net,wip,ready-to-test'

if [[ $buildTag != null ]] && [[ ${TAG_NAME} != null || ${TAG_NAME} != '' ]]; then
printf "Tag is %s\n" $buildTag ${TAG_NAME}
else
printf "⚡️ There is no tag here. "
fi
# build func
test() {
if [[ $buildTag != null ]] && [[ ${TAG_NAME} != null || ${TAG_NAME} != '' ]]; then
printf "⚡️ Testing with features: private-net runtime-benchmarks\n"
cargo test --release --features "private-net runtime-benchmarks"
elif [[ ${prBranch} = 'master' ]]; then
printf "⚡️ This is "${prbranch}" Running tests and migrations %s\n"
RUST_LOG="debug cargo test --features try-runtime -- run_migrations"
else
printf "⚡️ Running Tests for code coverage only\n"
export RUSTFLAGS="-Cinstrument-coverage"
export SKIP_WASM_BUILD=1
export LLVM_PROFILE_FILE="sora2-%p-%m.profraw"
rm -rf ~/.cargo/.package-cache
cargo fmt -- --check > /dev/null
cargo test --features $allfeatures
fi
}

# build
# If TAG_NAME is defined, build for a specific tag
if [[ $buildTag != null ]] && [[ ${TAG_NAME} != null || ${TAG_NAME} != '' ]]; then
build() {
printf "Tag is %s\n" ${TAG_NAME}
printf "BuildTag is %s\n" ${buildTag}
sudoCheckStatus="0"
if [[ ${TAG_NAME} =~ 'benchmarking'* ]]; then
featureList='private-net runtime-benchmarks'
sudoCheckStatus=0
elif [[ ${TAG_NAME} =~ 'stage'* ]]; then
featureList='private-net include-real-files ready-to-test'
sudoCheckStatus=0
elif [[ ${TAG_NAME} =~ 'test'* ]]; then
elif [[ ${TAG_NAME} =~ 'test'* || -n ${buildTag} ]]; then
featureList='private-net include-real-files reduced-pswap-reward-periods ready-to-test'
sudoCheckStatus=0
elif [[ -n ${TAG_NAME} && ${TAG_NAME} != 'predev' ]]; then
featureList='include-real-files'
sudoCheckStatus=101
sudoCheckStatus="101"
elif [[ -n ${buildTag} ]]; then
featureList='private-net include-real-files reduced-pswap-reward-periods wip ready-to-test'
fi
printf "Building with features: %s\n" "$featureList"
printf "Checking sudo pallet: %s\n" "$sudoCheckStatus"
cargo test --release --features "private-net runtime-benchmarks"
printf "⚡️ Building with features: %s\n" "$featureList"
printf "⚡️ Checking sudo pallet: %s\n" "$sudoCheckStatus"
rm -rf target
cargo build --release --features "$featureList"
mv ./target/release/framenode .
mv ./target/release/relayer ./relayer.bin
mv ./target/release/wbuild/framenode-runtime/framenode_runtime.compact.compressed.wasm ./framenode_runtime.compact.compressed.wasm
subwasm --json info framenode_runtime.compact.compressed.wasm > $wasmReportFile
subwasm metadata framenode_runtime.compact.compressed.wasm > $palletListFile
set +e
subwasm metadata -m Sudo framenode_runtime.compact.compressed.wasm
if [[ $(echo $?) -eq $sudoCheckStatus ]]; then echo "✅ sudo check is successful!"; else echo "❌ sudo check is failed!"; exit 1; fi
else
# If TAG_NAME is not defined, run tests and checks
if [[ $prBranch == 'master' ]]; then
RUST_LOG="debug cargo test --features try-runtime -- run_migrations"
if [[ $? -eq $sudoCheckStatus ]]; then
echo "✅ sudo check is successful!"
else
echo "❌ sudo check is failed!"
exit 1
fi
printf "⚡️ only tests run %s\n"
rm -rf ~/.cargo/.package-cache
cargo fmt -- --check > /dev/null
cargo test
cargo test --features "private-net wip ready-to-test runtime-benchmarks"
}

if [ "$(type -t $1)" = "function" ]; then
"$1"
else
echo "Func '$1' is not exists in this workflow. Skipped."
fi
4 changes: 2 additions & 2 deletions housekeeping/clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e
if [ "$pr" = true ] && [ "$prBranch" != "master" ]; then
printf "👷‍♂️ starting clippy \n"
SKIP_WASM_BUILD=1 cargo clippy --features private-net,ready-to-test,runtime-benchmarks -- -D warnings
SKIP_WASM_BUILD=1 cargo clippy --features private-net,ready-to-test,wip,runtime-benchmarks -- -D warnings
SKIP_WASM_BUILD=1 cargo clippy --features private-net,ready-to-test,wip,runtime-benchmarks --message-format=json -- -D warnings > clippy_report.json
else
printf "👷‍♂️ starting a regular clippy \n"
cargo clippy || exit 0
cargo clippy --message-format=json > clippy_report.json || exit 0
fi
13 changes: 6 additions & 7 deletions housekeeping/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/sh
set -e

export RUSTFLAGS="-Cinstrument-coverage"
export SKIP_WASM_BUILD=1
export LLVM_PROFILE_FILE="sora2-%p-%m.profraw"
printf '⚡️ Running coverage %s\n'
# coverage and generate report
grcov . --binary-path ./target/debug -s . -t lcov --branch -o ./lcov_report --ignore-not-existing --ignore "/opt/cargo/**" "target/debug" "node/src" --log-level="ERROR" --llvm-path='/usr/lib/llvm-14/bin'

cargo test --features private-net

grcov . --binary-path ./target/debug -s . -t cobertura --branch -o ./cobertura_report --ignore-not-existing --ignore "/opt/cargo/**" "target/debug" "node/src"
find . -type f -name '*.profraw' -delete
# delete generated *.profraw
find . -type f -name '*.profraw' -delete
76 changes: 31 additions & 45 deletions housekeeping/docker/env/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,45 @@
FROM debian:bullseye-slim
FROM debian:bullseye-20240211-slim

# Set environment variables
ENV RUSTUP_HOME="/opt/rustup"
ENV CARGO_HOME="/opt/cargo"
ENV PATH="$PATH:$CARGO_HOME/bin"
ENV RUSTUP_HOME="/opt/rust"
ENV CARGO_HOME="/opt/rust"
ENV PATH="$PATH:$RUSTUP_HOME/bin"
ENV CARGO_BUILD_DEP_INFO_BASEDIR="."
ENV CC=clang-13
ENV CXX=clang++-13
ENV RUST_VERSION=nightly-2024-01-15
ENV TZ=Europe/Moscow
ENV CC=clang-14
ENV CXX=clang++-14
ENV SUBWASM_VER=v0.14.0
ENV GRCOV_VERSION=0.8.19
ENV LLVM_TOOLS_VER=14
ENV CCLANG_VER=14
ARG DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates apt-transport-https gnupg \
libssl-dev pkg-config \
curl \
wget \
git binaryen \
make cmake libssl-dev \
software-properties-common && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-13 main" >> /etc/apt/sources.list.d/llvm-toochain-bullseye-13.list && \
echo "deb-src http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-13 main" >> /etc/apt/sources.list.d/llvm-toochain-bullseye-13.list && \
apt-get -y update && \
apt-get install -y --no-install-recommends \
clang-13 lldb-13 lld-13 libclang-13-dev llvm-13 protobuf-compiler && \
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-13 100 && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install docker
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository \
"deb https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
wget -O - https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain ${RUST_VERSION} && \
rustup toolchain install ${RUST_VERSION} && \
rustup target add wasm32-unknown-unknown --toolchain ${RUST_VERSION} && \
wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh ${LLVM_TOOLS_VER} && \
rm llvm.sh && \
apt-get update && \
apt-get install --no-install-recommends -y \
docker-ce docker-ce-cli containerd.io && \
clang-${CCLANG_VER} lldb-${CCLANG_VER} lld-${CCLANG_VER} libclang-${CCLANG_VER}-dev llvm-${LLVM_TOOLS_VER} protobuf-compiler && \
update-alternatives --install /usr/bin/cc cc /usr/bin/${CC} 100 && \
wget https://github.com/chevdor/subwasm/releases/download/${SUBWASM_VER}/subwasm_linux_amd64_${SUBWASM_VER}.deb -O subw.deb && \
dpkg -i subw.deb && rm subw.deb && \
rustup update && \
cargo install grcov --version ${GRCOV_VERSION} && \
rustup component add llvm-tools-preview && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install rust
ENV RUST_NIGHTLY_VERSION=nightly-2023-03-21
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain stable && \
rustup toolchain install ${RUST_NIGHTLY_VERSION} && \
rustup target add wasm32-unknown-unknown && \
rustup target add wasm32-unknown-unknown --toolchain ${RUST_NIGHTLY_VERSION} && \
rm -rf "${CARGO_HOME}/registry" "${CARGO_HOME}/git"

RUN curl https://github.com/chevdor/subwasm/releases/download/v0.17.0/subwasm_linux_amd64_v0.17.0.deb -sSL -o subw.deb && \
dpkg -i subw.deb && rm subw.deb

RUN cargo install grcov && \
rustup component add llvm-tools-preview && \
rm -rf "${CARGO_HOME}/registry" "${CARGO_HOME}/git"
rm -rf /var/lib/apt/lists/* && \
rm -rf "${CARGO_HOME}/git" && \
ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone
3 changes: 1 addition & 2 deletions housekeeping/docker/release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM debian:bullseye
# Install dependencies

RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates nano curl && \
Expand All @@ -13,6 +13,5 @@ RUN mkdir /chain && \
USER substrate

COPY ./framenode /usr/local/bin/framenode
COPY ./relayer.bin /usr/local/bin/relayer

ENTRYPOINT ["framenode"]
Loading