From 0eb7af6f7e3217c2aea7bcd3f1e2e65b05994dd6 Mon Sep 17 00:00:00 2001 From: Flouse <1297478+Flouse@users.noreply.github.com> Date: Sun, 15 Oct 2023 02:32:41 +0000 Subject: [PATCH] Fix function manual_build --- docker/docker-compose.yml | 2 ++ kicker | 38 +++++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b7f50d9..407ce96 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -21,6 +21,7 @@ services: volumes: - ./redis/data:/data + # TODO: update CKB version ckb: image: nervos/ckb:v0.103.0 user: root @@ -31,6 +32,7 @@ services: - ./layer1/ckb:/var/lib/ckb command: [ "run", "-C", "/var/lib/ckb" ] + # TODO: update CKB version ckb-miner: init: true image: nervos/ckb:v0.103.0 diff --git a/kicker b/kicker index ec70f6a..a9e0c5e 100755 --- a/kicker +++ b/kicker @@ -449,16 +449,19 @@ function manual_build() { echo "DOCKER_MANUAL_BUILD_IMAGE = \"$DOCKER_MANUAL_BUILD_IMAGE\"" echo + info "Start building..." | tee /tmp/kicker.log + du -hd6 $WORKSPACE | egrep G | tee --append /tmp/kicker.log + if [ "$MANUAL_BUILD_WEB3" = "true" ]; then info "Start building godwoken-web3" # godwoken-web3 is managed in the Godwoken monorepo. # See https://github.com/godwokenrises/godwoken/tree/develop/web3 - srcdir=$WORKSPACE/packages/godwoken-web3/web3 + srcdir=$WORKSPACE/packages/godwoken/web3 dstdir=$WORKSPACE/docker/manual-artifacts/godwoken-web3 # Download repo - prepare_repo godwoken-web3 "$WEB3_GIT_URL" "$WEB3_GIT_CHECKOUT" + prepare_repo godwoken "$WEB3_GIT_URL" "$WEB3_GIT_CHECKOUT" # Yarn install via docker (assumes the "web3" docker-compose service installed yarn) @@ -490,34 +493,34 @@ function manual_build() { if [ "$MANUAL_BUILD_WEB3_INDEXER" = "true" ]; then info "Start building godwoken-web3-indexer" - srcdir=$WORKSPACE/packages/godwoken-web3 + srcdir=$WORKSPACE/packages/godwoken dstdir=$WORKSPACE/docker/manual-artifacts # Download repo - prepare_repo godwoken-web3 "$WEB3_GIT_URL" "$WEB3_GIT_CHECKOUT" + prepare_repo godwoken "$WEB3_GIT_URL" "$WEB3_GIT_CHECKOUT" # Cargo fetch Rust dependencies (in order to access network via # host network). The docker image must have installed cargo, molecule # and rustfmt. - erun "cd $srcdir/web3 && CARGO_HOME=$srcdir/web3/.cargo cargo fetch --locked && cd -" - erun docker run \ - --rm \ - --env CARGO_HOME=/app/.cargo \ + erun "cd $srcdir/web3 && CARGO_HOME=$WORKSPACE/packages/.cargo cargo fetch --locked && cd -" + + erun docker run --rm \ + --workdir /app/web3 \ --volume $srcdir:/app \ --volume $WORKSPACE/packages/.rustup:/root/.rustup \ - --workdir /app/web3 \ - $DOCKER_MANUAL_BUILD_IMAGE cargo build --locked --release + --env CARGO_HOME=$WORKSPACE/packages/.cargo \ + $DOCKER_MANUAL_BUILD_IMAGE cargo build --locked # Copy the built artifacts to `docker/manual-artifacts/gw-web3-indexer` # # More: ./docker/manual-web3-indexer.compose.yml erun mkdir -p $dstdir - erun cp $srcdir/web3/target/release/gw-web3-indexer $dstdir + erun cp $srcdir/web3/target/debug/gw-web3-indexer $dstdir # Remove Rust target to avoid `out of disk` issue in CI - sudo rm -rf $srcdir/web3/target/release + sudo rm -rf $srcdir/target else - info "skip building godwoken-web3-indexer(gw-web3-indexer)" + info "skip building godwoken-web3-indexer (gw-web3-indexer)" fi if [ "$MANUAL_BUILD_GODWOKEN" = "true" ]; then @@ -538,11 +541,11 @@ function manual_build() { # to `cargo build` arguments. erun docker run \ --rm \ - --env CARGO_HOME=/app/.cargo \ + --env CARGO_HOME=$WORKSPACE/packages/.cargo \ --volume $srcdir:/app \ --volume $WORKSPACE/packages/.rustup:/root/.rustup \ --workdir /app \ - $DOCKER_MANUAL_BUILD_IMAGE \ + godwoken \ cargo build --locked --release --features gw-config/no-builtin # Copy the built artifacts to `docker/manual-artifacts/` @@ -607,6 +610,11 @@ function manual_build() { else info "skip building Scripts" fi + + docker rmi $DOCKER_MANUAL_BUILD_IMAGE + + info "End building." | tee --append /tmp/kicker.log + du -hd6 $WORKSPACE | egrep G | tee --append /tmp/kicker.log } function prepare_repo() {