Skip to content

Commit

Permalink
refactor: remove mocks from default features
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Jan 24, 2025
1 parent 3e776b6 commit e7d487c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ENV NODE_ENV=${NODE_ENV}
#
# This stage is used to install sccache and configure it.
# Later on, one should source /root/env before building to use sccache.
#
#
# Note that, due to security concerns, each stage needs to declare variables containing authentication secrets, like
# ACTIONS_RUNTIME_TOKEN, AWS_SECRET_ACCESS_KEY. This is to prevent leaking secrets to the final image. The secrets are
# loaded using docker buildx `--secret` flag and need to be explicitly mounted with `--mount=type=secret,id=SECRET_ID`.
Expand Down Expand Up @@ -205,7 +205,7 @@ RUN --mount=type=secret,id=AWS <<EOS
echo "export ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL}" >> /root/env
# ACTIONS_RUNTIME_TOKEN is a secret so we quote it here, and it will be loaded when `source /root/env` is run
echo 'export ACTIONS_RUNTIME_TOKEN="$(cat /run/secrets/GHA)"' >> /root/env

### AWS S3 ###
elif [ -n "${SCCACHE_BUCKET}" ]; then
echo "export SCCACHE_BUCKET='${SCCACHE_BUCKET}'" >> /root/env
Expand All @@ -218,11 +218,11 @@ RUN --mount=type=secret,id=AWS <<EOS
mkdir --mode=0700 -p "$HOME/.aws"
ln -s /run/secrets/AWS "$HOME/.aws/credentials"
echo "export AWS_SHARED_CREDENTIALS_FILE=$HOME/.aws/credentials" >> /root/env

# Check if AWS credentials file is mounted correctly, eg. --mount=type=secret,id=AWS
echo '[ -e "${AWS_SHARED_CREDENTIALS_FILE}" ] || {
echo "$(id -u): Cannot read ${AWS_SHARED_CREDENTIALS_FILE}; did you use RUN --mount=type=secret,id=AWS ?";
exit 1;
echo '[ -e "${AWS_SHARED_CREDENTIALS_FILE}" ] || {
echo "$(id -u): Cannot read ${AWS_SHARED_CREDENTIALS_FILE}; did you use RUN --mount=type=secret,id=AWS ?";
exit 1;
}' >> /root/env

### memcached ###
Expand All @@ -233,9 +233,9 @@ RUN --mount=type=secret,id=AWS <<EOS
echo "Error: cannot determine sccache cache backend" >&2
exit 1
fi

echo "export SCCACHE_SERVER_PORT=$((RANDOM+1025))" >> /root/env

# Configure compilers to use sccache
echo "export CXX='sccache clang++'" >> /root/env
echo "export CC='sccache clang'" >> /root/env
Expand Down Expand Up @@ -464,10 +464,9 @@ RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOM
source /root/env && \
if [[ "${CARGO_BUILD_PROFILE}" == "release" ]] ; then \
mv .cargo/config-release.toml .cargo/config.toml && \
export FEATURES_FLAG="--no-default-features" ; \
export OUT_DIRECTORY=release ; \
else \
export FEATURES_FLAG="--no-default-features --features=console,grovedbg" ; \
export FEATURES_FLAG="--features=console,grovedbg" ; \
export OUT_DIRECTORY=debug ; \
fi && \
# Workaround: as we cache dapi-grpc, its build.rs is not rerun, so we need to touch it
Expand Down
4 changes: 2 additions & 2 deletions packages/rs-drive-abci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ dpp = { path = "../rs-dpp", features = [
drive = { path = "../rs-drive", features = ["fixtures-and-mocks"] }
strategy-tests = { path = "../strategy-tests" }
assert_matches = "1.5.0"
drive-abci = { path = ".", features = ["testing-config"] }
drive-abci = { path = ".", features = ["testing-config", "mocks"] }
bls-signatures = { git = "https://github.com/dashpay/bls-signatures", tag = "1.3.3"}
mockall = { version = "0.13" }

Expand All @@ -105,7 +105,7 @@ rocksdb = { version = "0.23.0" }
integer-encoding = { version = "4.0.0" }

[features]
default = ["mocks"]
default = []
mocks = ["mockall", "drive/fixtures-and-mocks", "bls-signatures"]
console = ["console-subscriber", "tokio/tracing"]
testing-config = []
Expand Down

0 comments on commit e7d487c

Please sign in to comment.