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 parachain build #205

Merged
merged 14 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
7 changes: 4 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
@Library('jenkins-library') _
@Library('jenkins-library@feature/dops-2942-update_rust_lib') _

def pipeline = new org.rust.AppPipeline(steps: this,
envImageName: 'docker.soramitsu.co.jp/sora2/parachain-env:latest',
envImageName: 'docker.soramitsu.co.jp/sora2/env:env',
appImageName: 'docker.soramitsu.co.jp/sora2/parachain',
clippyLinter: false,
cargoClippyTag: ':parachain',
buildTestCmds: ['housekeeping/scripts/build.sh'],
cargoClippyCmds: ['housekeeping/scripts/clippy.sh'],
codeCoverage: false,
codeCoverageCommand: './housekeeping/scripts/coverage.sh',
pushTags: ['develop': 'dev'],
buildArtifacts: 'sora2-parachain-runtime_rococo.compact.compressed.wasm, sora2-parachain-runtime_kusama.compact.compressed.wasm, sora2-parachain-runtime_polkadot.compact.compressed.wasm',
sonarProjectKey: 'sora:sora2-parachain',
Expand Down
12 changes: 0 additions & 12 deletions Jenkinsfile-env

This file was deleted.

59 changes: 0 additions & 59 deletions Jenkinsfile-relay

This file was deleted.

30 changes: 0 additions & 30 deletions housekeeping/docker/develop/Dockerfile

This file was deleted.

50 changes: 0 additions & 50 deletions housekeeping/docker/relay/Dockerfile

This file was deleted.

84 changes: 53 additions & 31 deletions housekeeping/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,38 @@ errorfile="benchmarking_errors.txt"

rm -rf ~/.cargo/registry/

if [[ $buildTag != null ]] && [[ ${TAG_NAME} != null || ${TAG_NAME} != '' ]]; then
if [[ ${TAG_NAME} =~ 'benchmarking'* ]]; then
buildcmd="cargo build --release --locked --bin parachain-collator --features"
buildfeature="runtime-benchmarks,kusama"
elif [[ $buildTag = 'dev' || $buildTag = 'latest' ]] || [[ ${TAG_NAME} = 'stage-'* ]] || [[ ${TAG_NAME} = 'test-'* ]]; then
buildfeature="rococo"
elif [[ ${TAG_NAME} = 'kusama-'* ]]; then
buildfeature="kusama"
elif [[ ${TAG_NAME} = 'polkadot-'* ]]; then
buildfeature="polkadot"
fi
printf "🕙 Testing with feature $buildfeature will start now... \n"
$testcmd "$buildfeature"
printf "🕙 Building with feature $buildfeature will start now... \n"
$buidcmd "$buildfeature"
wasm_in="./target/release/wbuild/sora2-parachain-runtime/"
wasm_out=./sora2-parachain-runtime_$buildfeature.compact.compressed.wasm
wasm_file=$(ls "$wasm_in" | grep ".compact.compressed.wasm")
mv "$wasm_in$wasm_file" "$wasm_out"
if [ -f "$wasm_out" ]; then
printf "✅ "$wasm_out" found!\n"
else
printf "❌"$wasm_out" can't found!\n"
exit 1
fi
else
for network in ${networks[@]}
do
printf "⚡️ There is no tag here, only tests run. \n"
printf "🏃 Running tests for "$network"... \n"
# build func with feature
build() {
feature=$1
printf "🕙 Building with feature $feature will start now... \n"
$buidcmd "$feature"
wasm_in="./target/release/wbuild/sora2-parachain-runtime/"
wasm_out=./sora2-parachain-runtime_$feature.compact.compressed.wasm
wasm_file=$(ls "$wasm_in" | grep ".compact.compressed.wasm")
mv "$wasm_in$wasm_file" "$wasm_out"
if [ -f "$wasm_out" ]; then
printf "✅ $wasm_out found!\n"
else
printf "❌ $wasm_out can't found!\n"
exit 1
fi
}

# test func with tag
releasetest() {
feature=$1
printf "🕙 Testing with feature $feature will start now... \n"
$testcmd "$feature"
}

# test func without tag
test() {
export RUSTFLAGS="-Cinstrument-coverage"
export LLVM_PROFILE_FILE="sora2-%p-%m.profraw"
printf "⚡️ There is no tag here, only tests run. \n"
for network in ${networks[@]}
do
printf "🏃 Running with $network feature... \n"
$testcmd "$network" "$benchfeature"
wasm_in="./target/release/wbuild/sora2-parachain-runtime/"
wasm_out=./sora2-parachain-runtime_$network.compact.compressed.wasm
Expand All @@ -53,7 +55,27 @@ else
printf "❌"$wasm_out" can't found!\n"
exit 1
fi
done
done
}

# build workflow
if [[ $buildTag != null ]] && [[ ${TAG_NAME} != null || ${TAG_NAME} != '' ]]; then
if [[ ${TAG_NAME} =~ 'benchmarking'* ]]; then
buildcmd="cargo build --release --locked --bin parachain-collator --features"
releasetest "runtime-benchmarks,kusama"
build "runtime-benchmarks,kusama"
elif [[ $buildTag = 'dev' || $buildTag = 'latest' ]] || [[ ${TAG_NAME} = 'stage-'* ]] || [[ ${TAG_NAME} = 'test-'* ]]; then
releasetest "rococo"
build "rococo"
elif [[ ${TAG_NAME} = 'kusama-'* ]]; then
releasetest "kusama"
build "kusama"
elif [[ ${TAG_NAME} = 'polkadot-'* ]]; then
releasetest "polkadot"
build "polkadot"
fi
else
test
fi

if [ -f "$binaryfile" ]; then
Expand Down
7 changes: 1 addition & 6 deletions housekeeping/scripts/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/sh

export RUSTFLAGS="-Cinstrument-coverage"
export SKIP_WASM_BUILD=1
export LLVM_PROFILE_FILE="sora2-%p-%m.profraw"
grcov . --binary-path ./target/release -s . -t lcov --branch -o ./lcov_report --ignore-not-existing --ignore "/opt/cargo/**" "target/release" "node/src" --log-level="ERROR" --llvm-path='/usr/lib/llvm-14/bin'

rustup component add llvm-tools-preview

grcov . --binary-path ./target/debug -s . -t lcov --branch -o ./lcov_report --ignore-not-existing --ignore "/opt/cargo/**" "target/debug" "node/src"
find . -type f -name '*.profraw' -delete