Mokhtar Naamani 3 years ago
parent
commit
ccb6949706
5 changed files with 15 additions and 15 deletions
  1. 1 1
      devops/git-hooks/pre-push
  2. 5 9
      joystream-node.Dockerfile
  3. 5 2
      runtime/Cargo.toml
  4. 3 2
      runtime/src/constants.rs
  5. 1 1
      scripts/cargo-build.sh

+ 1 - 1
devops/git-hooks/pre-push

@@ -10,4 +10,4 @@ echo 'running clippy (rust linter)'
 BUILD_DUMMY_WASM_BINARY=1 cargo +nightly-2021-02-20 clippy --release --all -- -D warnings
 
 echo 'running cargo unit tests'
-cargo +nightly-2021-02-20 test --release --all
+cargo +nightly-2021-02-20 test --release --all --features ""

+ 5 - 9
joystream-node.Dockerfile

@@ -15,16 +15,12 @@ COPY . /joystream
 # Build all cargo crates
 # Ensure our tests and linter pass before actual build
 ARG ALL_PROPOSALS_PARAMETERS_JSON
-ARG TEST_NODE
-RUN echo "TEST_NODE=$TEST_NODE"
-RUN test -n "$TEST_NODE" && sed -i 's/MILLISECS_PER_BLOCK: Moment = 6000/MILLISECS_PER_BLOCK: Moment = 1000/' ./runtime/src/constants.rs; exit 0
-RUN test -n "$TEST_NODE" && sed -i 's/SLOT_DURATION: Moment = 6000/SLOT_DURATION: Moment = 1000/' ./runtime/src/constants.rs; exit 0
-RUN test -n "$TEST_NODE" && export ALL_PROPOSALS_PARAMETERS_JSON="$(cat ./tests/network-tests/proposal-parameters.json)";\
-    echo "ALL_PROPOSALS_PARAMETERS_JSON=$ALL_PROPOSALS_PARAMETERS_JSON" && \
-    export WASM_BUILD_TOOLCHAIN=nightly-2021-02-20 && \
+ARG CARGO_FEATURES
+RUN echo "CARGO_FEATURES=$CARGO_FEATURES"
+RUN export WASM_BUILD_TOOLCHAIN=nightly-2021-02-20 && \
     BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings && \
-    cargo test --release --all && \
-    cargo build --release
+    cargo test --release --all --features "${CARGO_FEATURES}" && \
+    cargo build --release --features "${CARGO_FEATURES}"
 
 FROM ubuntu:21.04
 LABEL description="Joystream node"

+ 5 - 2
runtime/Cargo.toml

@@ -184,5 +184,8 @@ runtime-benchmarks = [
     'storage/runtime-benchmarks',       
     "blog/runtime-benchmarks",
 ]
-
-
+# Features to configure different runtime configurations
+# configuration suitable for staging networks and playground
+staging_env = []
+# configuration suitable for integration testing
+testing_env = []

+ 3 - 2
runtime/src/constants.rs

@@ -18,10 +18,11 @@ use sp_std::vec::Vec;
 /// `SLOT_DURATION` instead (like the timestamp module for calculating the
 /// minimum period).
 /// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
-pub const MILLISECS_PER_BLOCK: Moment = 6000;
-pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;
 
+pub const MILLISECS_PER_BLOCK: Moment = 6000;
 pub const SLOT_DURATION: Moment = 6000;
+
+pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;
 pub const BONDING_DURATION: u32 = 24 * 7;
 
 pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;

+ 1 - 1
scripts/cargo-build.sh

@@ -4,4 +4,4 @@
 
 export WASM_BUILD_TOOLCHAIN=nightly-2021-02-20
 
-cargo +nightly-2021-02-20 build --release
+cargo +nightly-2021-02-20 build --release --features ""