git.delta.rocks / unique-network / refs/commits / d63678e90a0e

difftreelog

feat add integration-tests profile and use in CI

Daniel Shiposha2023-09-25parent: #9c8e078.patch.diff
in: master

4 files changed

modified.docker/Dockerfile-chain-devdiffbeforeafterboth
--- a/.docker/Dockerfile-chain-dev
+++ b/.docker/Dockerfile-chain-dev
@@ -21,7 +21,6 @@
 
 WORKDIR /dev_chain
 
-RUN cargo build --release
 RUN echo "$NETWORK"
 
-CMD cargo run --release --features=${NETWORK}-runtime -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
+CMD cargo run --profile integration-tests --features=${NETWORK}-runtime -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
modified.docker/Dockerfile-uniquediffbeforeafterboth
before · .docker/Dockerfile-unique
1# ===== Rust builder =====2FROM ubuntu:22.04 as rust-builder3LABEL maintainer="Unique.Network"45ENV CARGO_HOME="/cargo-home"6ENV PATH="/cargo-home/bin:$PATH"7ENV TZ=UTC8RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone910RUN apt-get update && \11    apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev protobuf-compiler && \12    apt-get clean && \13    rm -r /var/lib/apt/lists/*1415RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none1617ARG RUST_TOOLCHAIN18RUN echo "Using Rust '$RUST_TOOLCHAIN'" && \19    rustup toolchain install $RUST_TOOLCHAIN && \20    rustup target add wasm32-unknown-unknown --toolchain ${RUST_TOOLCHAIN} && \21    rustup default $RUST_TOOLCHAIN && \22    rustup target list --installed && \23    rustup show2425RUN mkdir /unique_parachain26WORKDIR /unique_parachain2728# ===== BUILD UNIQUE =====29FROM rust-builder as builder-polkadot-bin3031WORKDIR /unique_parachain3233COPY . unique-chain/3435ARG RUNTIME_FEATURES36# registry for Updating registry. It is safe to cache it, because it only contains references to the dependency files,37#   and the caches for the files themselves are set in Cargo.lock, which won't be updated because of --locked flag38# git for Updating git repository. It is safe to cache it, because git dependencies are cached by revision,39#   revision is locked in Cargo.lock, and it is forbidden to update the Cargo.lock, because of --locked flag40#   passed to cargo build41# target for built dependencies. Technically, it may be unsafe to cache it, but there was no bugs in the caching logic42#   of it to this day (Ignoring incremental compilation, which is explicitly disabled by CARGO_INCREMENTAL=0). Only the43#   fully built crates will be cached depending on the crate source, version and feature set, which are locked by44#   Cargo.lock, which can't be updated because of the --locked flag.45RUN --mount=type=cache,target=/cargo-home/registry \46    --mount=type=cache,target=/cargo-home/git \47    --mount=type=cache,target=/unique_parachain/unique-chain/target \48    cd unique-chain && \49    echo "Using runtime features '$RUNTIME_FEATURES'" && \50    CARGO_INCREMENTAL=0 cargo build --release --features="$RUNTIME_FEATURES" --locked && \51    mv ./target/release/unique-collator /unique_parachain/unique-chain/ && \52    cd target/release/wbuild && find . -name "*.wasm" -exec sh -c 'mkdir -p "../../../wasm/$(dirname {})"; cp {} "../../../wasm/{}"' \;5354# ===== BIN ======5556FROM ubuntu:22.04 as builder-polkadot5758COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/unique-collator /bin/unique-collator59COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/wasm /wasm60ENTRYPOINT ["/bin/unique-collator"]
after · .docker/Dockerfile-unique
1# ===== Rust builder =====2FROM ubuntu:22.04 as rust-builder3LABEL maintainer="Unique.Network"45ENV CARGO_HOME="/cargo-home"6ENV PATH="/cargo-home/bin:$PATH"7ENV TZ=UTC8RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone910RUN apt-get update && \11    apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev protobuf-compiler && \12    apt-get clean && \13    rm -r /var/lib/apt/lists/*1415RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none1617ARG RUST_TOOLCHAIN18RUN echo "Using Rust '$RUST_TOOLCHAIN'" && \19    rustup toolchain install $RUST_TOOLCHAIN && \20    rustup target add wasm32-unknown-unknown --toolchain ${RUST_TOOLCHAIN} && \21    rustup default $RUST_TOOLCHAIN && \22    rustup target list --installed && \23    rustup show2425RUN mkdir /unique_parachain26WORKDIR /unique_parachain2728# ===== BUILD UNIQUE =====29FROM rust-builder as builder-polkadot-bin3031WORKDIR /unique_parachain3233COPY . unique-chain/3435ARG RUNTIME_FEATURES36# registry for Updating registry. It is safe to cache it, because it only contains references to the dependency files,37#   and the caches for the files themselves are set in Cargo.lock, which won't be updated because of --locked flag38# git for Updating git repository. It is safe to cache it, because git dependencies are cached by revision,39#   revision is locked in Cargo.lock, and it is forbidden to update the Cargo.lock, because of --locked flag40#   passed to cargo build41# target for built dependencies. Technically, it may be unsafe to cache it, but there was no bugs in the caching logic42#   of it to this day (Ignoring incremental compilation, which is explicitly disabled by CARGO_INCREMENTAL=0). Only the43#   fully built crates will be cached depending on the crate source, version and feature set, which are locked by44#   Cargo.lock, which can't be updated because of the --locked flag.45RUN --mount=type=cache,target=/cargo-home/registry \46    --mount=type=cache,target=/cargo-home/git \47    --mount=type=cache,target=/unique_parachain/unique-chain/target \48    cd unique-chain && \49    echo "Using runtime features '$RUNTIME_FEATURES'" && \50    CARGO_INCREMENTAL=0 cargo build --profile integration-tests --features="$RUNTIME_FEATURES" --locked && \51    mv ./target/release/unique-collator /unique_parachain/unique-chain/ && \52    cd target/release/wbuild && find . -name "*.wasm" -exec sh -c 'mkdir -p "../../../wasm/$(dirname {})"; cp {} "../../../wasm/{}"' \;5354# ===== BIN ======5556FROM ubuntu:22.04 as builder-polkadot5758COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/unique-collator /bin/unique-collator59COPY --from=builder-polkadot-bin /unique_parachain/unique-chain/wasm /wasm60ENTRYPOINT ["/bin/unique-collator"]
modified.docker/docker-compose.gov.j2diffbeforeafterboth
--- a/.docker/docker-compose.gov.j2
+++ b/.docker/docker-compose.gov.j2
@@ -21,4 +21,4 @@
       options:
         max-size: "1m"
         max-file: "3"
-    command: cargo run --release --features={{ NETWORK }}-runtime,gov-test-timings -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
+    command: cargo run --profile integration-tests --features={{ NETWORK }}-runtime,gov-test-timings -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,6 +24,10 @@
 lto = true
 opt-level = 3
 
+[profile.integration-tests]
+inherits = "release"
+debug-assertions = true
+
 [workspace.dependencies]
 # Unique
 app-promotion-rpc = { path = "primitives/app_promotion_rpc", default-features = false }