-
Notifications
You must be signed in to change notification settings - Fork 44
build: use cargo binstall to speed up builds #2321
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
Changes from all commits
24177fa
dacc6db
306b86c
99fe5fa
cee3098
0d3e091
e421514
3d941ec
4bc0a65
dc48827
cafda11
b86f4e0
ae97f47
48cca1a
5c80069
fc0082d
d4c2f7d
88d3596
681bf72
1ac8d3b
fa4cf99
6584fae
8c880aa
113e695
6e02f6a
e395f2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,16 +44,30 @@ ENV PATH=$CARGO_HOME/bin:$PATH | |
| COPY rust-toolchain.toml . | ||
| RUN TOOLCHAIN_VERSION="$(grep channel rust-toolchain.toml | awk '{print $3}' | tr -d '"')" && \ | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ | ||
| --profile minimal \ | ||
| -y \ | ||
| --default-toolchain "${TOOLCHAIN_VERSION}" \ | ||
| --target wasm32-unknown-unknown | ||
|
|
||
| # Install wasm-bindgen-cli in the same profile as other components, to sacrifice some performance & disk space to gain | ||
| # better build caching | ||
| RUN if [[ -z "${SCCACHE_MEMCACHED}" ]] ; then unset SCCACHE_MEMCACHED ; fi ; \ | ||
| RUSTFLAGS="-C target-feature=-crt-static" \ | ||
| # Meanwhile if you want to update wasm-bindgen you also need to update version in: | ||
| # - packages/wasm-dpp/Cargo.toml | ||
| # - packages/wasm-dpp/scripts/build-wasm.sh | ||
| cargo install [email protected] --locked | ||
| # Download and install cargo-binstall | ||
| ENV BINSTALL_VERSION=1.10.11 | ||
| RUN set -ex; \ | ||
| if [ "$TARGETARCH" = "amd64" ]; then \ | ||
| CARGO_BINSTALL_ARCH="x86_64-unknown-linux-musl"; \ | ||
| elif [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \ | ||
| CARGO_BINSTALL_ARCH="aarch64-unknown-linux-musl"; \ | ||
| else \ | ||
| echo "Unsupported architecture: $TARGETARCH"; exit 1; \ | ||
| fi; \ | ||
| DOWNLOAD_URL="https://github.com/cargo-bins/cargo-binstall/releases/download/v${BINSTALL_VERSION}/cargo-binstall-${CARGO_BINSTALL_ARCH}.tgz"; \ | ||
| curl -L --fail --show-error "$DOWNLOAD_URL" -o /tmp/cargo-binstall.tgz; \ | ||
| tar -xzf /tmp/cargo-binstall.tgz -C /tmp cargo-binstall; \ | ||
| chmod +x /tmp/cargo-binstall; \ | ||
| /tmp/cargo-binstall -y --force cargo-binstall; \ | ||
| rm /tmp/cargo-binstall; \ | ||
| cargo binstall -V | ||
|
|
||
| RUN cargo binstall [email protected] --locked \ | ||
| --no-discover-github-token \ | ||
| --disable-telemetry \ | ||
| --no-track \ | ||
| --no-confirm | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,9 +115,10 @@ runs: | |
| cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }} | ||
| outputs: type=image,name=${{ inputs.image_org }}/${{ inputs.image_name }},push-by-digest=${{ inputs.push_tags != 'true' }},name-canonical=true,push=true | ||
|
|
||
| - name: Save Docker mount cache | ||
| uses: dcginfra/buildkit-cache-dance/extract@s5cmd | ||
| if: ${{ inputs.cache_mounts != '' }} | ||
| with: | ||
| bucket: ${{ inputs.bucket }} | ||
| mounts: ${{ inputs.cache_mounts }} | ||
| # TODO: This is doesn't work | ||
| # - name: Save Docker mount cache | ||
| # uses: dcginfra/buildkit-cache-dance/extract@s5cmd | ||
| # if: ${{ inputs.cache_mounts != '' }} | ||
| # with: | ||
| # bucket: ${{ inputs.bucket }} | ||
| # mounts: ${{ inputs.cache_mounts }} | ||
|
Comment on lines
+118
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Enable cache extraction to improve build performance The 🔗 Analysis chainAddress the TODO comment and caching strategy The commented-out cache saving step is marked with a TODO indicating it's not working. This could impact build performance as subsequent builds won't benefit from cached mounts. Let's verify the impact and current caching behavior: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for cache-related configurations and their usage
# Check if cache mounts are used in other workflow files
echo "Checking cache mount usage in workflows:"
rg -A 5 "cache_mounts:" .github/workflows/
# Check for alternative caching mechanisms
echo "Checking for alternative caching strategies:"
rg -A 5 "cache-from|cache-to|actions/cache" .github/workflows/
Length of output: 297 Script: #!/bin/bash
# Description: Comprehensive search for cache-related configurations
# Search for any cache-related keywords in the repository
echo "Searching for cache-related keywords in the entire repository:"
rg "cache" .
# Search for usage of `s5cmd` to identify related caching operations
echo "Searching for usage of s5cmd in workflows and actions:"
rg "s5cmd" .github/actions/ .github/workflows/
Length of output: 142825 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,14 @@ jobs: | |
| - name: Setup Node.JS | ||
| uses: ./.github/actions/nodejs | ||
|
|
||
| - name: Install Cargo binstall | ||
| uses: cargo-bins/[email protected] | ||
| if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
|
|
||
| - name: Install wasm-bindgen-cli | ||
| run: cargo binstall [email protected] | ||
| if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
|
|
||
| - name: Build packages | ||
| run: yarn build | ||
| env: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,14 @@ jobs: | |
| with: | ||
| target: wasm32-unknown-unknown | ||
|
|
||
| - name: Install Cargo binstall | ||
| uses: cargo-bins/[email protected] | ||
| if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
|
|
||
| - name: Install wasm-bindgen-cli | ||
| run: cargo binstall [email protected] | ||
| if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
|
|
||
| - name: Build JS packages | ||
| run: yarn build | ||
| if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # syntax = docker/dockerfile:1.5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # syntax = docker/dockerfile:1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lklimek marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Docker image for rs-drive-abci | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -35,13 +35,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 3. Configuration variables are shared between runs using /root/env file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG ALPINE_VERSION=3.18 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG PROTOC_VERSION=27.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG RUSTC_WRAPPER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # DEPS: INSTALL AND CACHE DEPENDENCIES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FROM node:20-alpine${ALPINE_VERSION} as deps-base | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FROM node:20-alpine${ALPINE_VERSION} AS deps-base | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Install some dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -93,9 +92,12 @@ RUN TOOLCHAIN_VERSION="$(grep channel rust-toolchain.toml | awk '{print $3}' | t | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --default-toolchain "${TOOLCHAIN_VERSION}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --target wasm32-unknown-unknown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ONBUILD ENV HOME=/root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ONBUILD ENV CARGO_HOME=$HOME/.cargo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Install protoc - protobuf compiler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # The one shipped with Alpine does not work | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG PROTOC_VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG PROTOC_VERSION=27.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN if [[ "$TARGETARCH" == "arm64" ]] ; then export PROTOC_ARCH=aarch_64; else export PROTOC_ARCH=x86_64; fi; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl -Ls https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -o /tmp/protoc.zip && \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -107,14 +109,13 @@ RUN if [[ "$TARGETARCH" == "arm64" ]] ; then export PROTOC_ARCH=aarch_64; else e | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN rm /usr/bin/cc && ln -s /usr/bin/clang /usr/bin/cc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Select whether we want dev or release | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG CARGO_BUILD_PROFILE=dev | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ENV CARGO_BUILD_PROFILE ${CARGO_BUILD_PROFILE} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ONBUILD ARG CARGO_BUILD_PROFILE=dev | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG NODE_ENV=production | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ENV NODE_ENV ${NODE_ENV} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ENV NODE_ENV=${NODE_ENV} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # DEPS-SCCACHE stage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # DEPS-SCCACHE stage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # This stage is used to install sccache and configure it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Later on, one should source /root/env before building to use sccache. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -158,12 +159,12 @@ ARG SCCACHE_REGION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARG SCCACHE_S3_KEY_PREFIX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Generate sccache configuration variables and save them to /root/env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # We only enable one cache at a time. Setting env variables belonging to multiple cache backends may fail the build. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN <<EOS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -ex -o pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "${SCCACHE_GHA_ENABLED}" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "${SCCACHE_GHA_ENABLED}" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Github Actions cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "export SCCACHE_GHA_ENABLED=${SCCACHE_GHA_ENABLED}" >> /root/env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "export ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL}" >> /root/env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -186,7 +187,7 @@ RUN <<EOS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # memcached | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "export SCCACHE_MEMCACHED='${SCCACHE_MEMCACHED}'" >> /root/env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "${RUSTC_WRAPPER}" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "export CXX='${RUSTC_WRAPPER} clang++'" >> /root/env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "export CC='${RUSTC_WRAPPER} clang'" >> /root/env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -217,7 +218,7 @@ WORKDIR /tmp/rocksdb | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN <<EOS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -ex -o pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git clone https://github.com/facebook/rocksdb.git -b v8.10.2 --depth 1 . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git clone https://github.com/facebook/rocksdb.git -b v8.10.2 --depth 1 . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source /root/env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ "$TARGETARCH" == "amd64" ]] ; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -251,22 +252,32 @@ FROM deps-rocksdb AS deps | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WORKDIR /platform | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Install wasm-bindgen-cli in the same profile as other components, to sacrifice some performance & disk space to gain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # better build caching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOME}/registry/index \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --mount=type=cache,sharing=shared,id=cargo_registry_cache,target=${CARGO_HOME}/registry/cache \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --mount=type=cache,sharing=shared,id=cargo_git,target=${CARGO_HOME}/git/db \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --mount=type=cache,sharing=shared,id=target_${TARGETARCH},target=/platform/target \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source $HOME/.cargo/env && \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source /root/env && \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUSTFLAGS="-C target-feature=-crt-static" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CARGO_TARGET_DIR="/platform/target" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # TODO: Build wasm with build.rs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Meanwhile if you want to update wasm-bindgen you also need to update version in: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - packages/wasm-dpp/Cargo.toml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - packages/wasm-dpp/scripts/build-wasm.sh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cargo install --profile "$CARGO_BUILD_PROFILE" [email protected] [email protected] --locked && \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ -x /usr/bin/sccache ]]; then sccache --show-stats; fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Download and install cargo-binstall | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ENV BINSTALL_VERSION=1.10.11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN set -ex; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$TARGETARCH" = "amd64" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CARGO_BINSTALL_ARCH="x86_64-unknown-linux-musl"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| elif [ "$TARGETARCH" = "arm64" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CARGO_BINSTALL_ARCH="aarch64-unknown-linux-musl"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Unsupported architecture: $TARGETARCH"; exit 1; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Construct download URL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DOWNLOAD_URL="https://github.com/cargo-bins/cargo-binstall/releases/download/v${BINSTALL_VERSION}/cargo-binstall-${CARGO_BINSTALL_ARCH}.tgz"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Download and extract the cargo-binstall binary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -L --proto '=https' --tlsv1.2 -sSf "$DOWNLOAD_URL" | tar -xvzf -; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ./cargo-binstall -y --force cargo-binstall; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm ./cargo-binstall; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source $HOME/.cargo/env; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cargo binstall -V | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
shumkov marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+255
to
+273
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve error handling in cargo-binstall installation The installation script should verify the successful installation of cargo-binstall before removing the binary and should handle potential network failures. RUN set -ex; \
if [ "$TARGETARCH" = "amd64" ]; then \
CARGO_BINSTALL_ARCH="x86_64-unknown-linux-musl"; \
elif [ "$TARGETARCH" = "arm64" ]; then \
CARGO_BINSTALL_ARCH="aarch64-unknown-linux-musl"; \
else \
echo "Unsupported architecture: $TARGETARCH"; exit 1; \
fi; \
DOWNLOAD_URL="https://github.com/cargo-bins/cargo-binstall/releases/download/v${BINSTALL_VERSION}/cargo-binstall-${CARGO_BINSTALL_ARCH}.tgz"; \
- curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -L --proto '=https' --tlsv1.2 -sSf "$DOWNLOAD_URL" | tar -xvzf -; \
- ./cargo-binstall -y --force cargo-binstall; \
- rm ./cargo-binstall; \
+ curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -L --proto '=https' --tlsv1.2 -sSf "$DOWNLOAD_URL" -o cargo-binstall.tgz || exit 1; \
+ tar -xvzf cargo-binstall.tgz || exit 1; \
+ ./cargo-binstall -y --force cargo-binstall || exit 1; \
+ if ! command -v cargo-binstall >/dev/null 2>&1; then \
+ echo "cargo-binstall installation failed"; \
+ exit 1; \
+ fi; \
+ rm ./cargo-binstall cargo-binstall.tgz; \
source $HOME/.cargo/env; \
cargo binstall -V📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN source $HOME/.cargo/env; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cargo binstall [email protected] [email protected] \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --locked \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --no-discover-github-token \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --disable-telemetry \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --no-track \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --no-confirm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Rust build planner to speed up builds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -291,7 +302,6 @@ FROM deps AS build-drive-abci | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SHELL ["/bin/bash", "-o", "pipefail","-e", "-x", "-c"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WORKDIR /platform | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| COPY --from=build-planner /platform/recipe.json recipe.json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -333,9 +343,9 @@ RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOM | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --package drive-abci \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${FEATURES_FLAG} \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --locked && \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cp /platform/target/${OUT_DIRECTORY}/drive-abci /artifacts/ && \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cp /platform/target/${OUT_DIRECTORY}/drive-abci /artifacts/ && \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ -x /usr/bin/sccache ]]; then sccache --show-stats; fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+346
to
+348
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for binary copy operation The copy operation of the built binary should be verified to ensure the file exists and the copy was successful. - cp /platform/target/${OUT_DIRECTORY}/drive-abci /artifacts/ && \
+ if [ ! -f "/platform/target/${OUT_DIRECTORY}/drive-abci" ]; then \
+ echo "Binary not found in /platform/target/${OUT_DIRECTORY}/drive-abci"; \
+ exit 1; \
+ fi && \
+ cp /platform/target/${OUT_DIRECTORY}/drive-abci /artifacts/ || exit 1 && \
if [[ -x /usr/bin/sccache ]]; then sccache --show-stats; fi📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # STAGE: BUILD JAVASCRIPT INTERMEDIATE IMAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ this repository may be used on the following networks: | |
| in terminal run `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc` or `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile` depending on your default shell. | ||
| You can find your default shell with `echo $SHELL` | ||
| - Reload your shell with `source ~/.zshrc` or `source ~/.bash_profile` | ||
| - `cargo install [email protected].85` | ||
| - `cargo install [email protected].86` | ||
| - *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file* | ||
| - *Depending on system, additional packages may need to be installed as a prerequisite for wasm-bindgen-cli. If anything is missing, installation will error and prompt what packages are missing (i.e. clang, llvm, libssl-dev)* | ||
| - essential build tools - example for Debian/Ubuntu: `apt install -y build-essential libssl-dev pkg-config clang cmake llvm` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ Library consumers must ignore class names minification for `@dashevo/wasm-dpp` l | |
|
|
||
| - Install [Rust](https://www.rust-lang.org/tools/install) v1.73+ | ||
| - Add wasm32 target: `$ rustup target add wasm32-unknown-unknown` | ||
| - Install wasm-bingen-cli: `cargo install [email protected].85` | ||
| - Install wasm-bingen-cli: `cargo install [email protected].86` | ||
| - *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file* | ||
| - *Depending on system, additional packages may need to be installed as a prerequisite for wasm-bindgen-cli. If anything is missing, installation will error and prompt what packages are missing (i.e. clang, llvm, libssl-dev)* | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,8 +28,8 @@ fi | |
| # - packages/wasm-dpp/Cargo.toml | ||
| # - Dockerfile | ||
| if ! [[ -x "$(command -v wasm-bindgen)" ]]; then | ||
| echo "Wasm-bindgen CLI ${WASM_BINDGEN_VERSION} is not installed. Installing" | ||
| cargo install --config net.git-fetch-with-cli=true --profile "${CARGO_BUILD_PROFILE}" -f "[email protected]" | ||
| echo "Wasm-bindgen CLI ${WASM_BINDGEN_VERSION} is not installed." | ||
| exit 1 | ||
shumkov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
| # On a mac, bundled clang won't work - you need to install LLVM manually through brew, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.