Browse Source

cargo: run tests and clippy in release mode

this will reduce total build times in travis, and when running git hooks
Mokhtar Naamani 4 years ago
parent
commit
70683445f1
3 changed files with 11 additions and 9 deletions
  1. 2 2
      .travis.yml
  2. 5 1
      devops/dockerfiles/node-and-runtime/Dockerfile
  3. 4 6
      devops/git-hooks/pre-push

+ 2 - 2
.travis.yml

@@ -20,11 +20,11 @@ before_install:
   - rustup component add rustfmt
   - cargo fmt --all -- --check
   - rustup component add clippy
-  - BUILD_DUMMY_WASM_BINARY=1 cargo clippy -- -D warnings
+  - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release -- -D warnings
   - rustup default stable
   - rustup update nightly
   - rustup target add wasm32-unknown-unknown --toolchain nightly
-  - cargo test --verbose --all
+  - cargo test --release --verbose --all
 
 install:
   - |

+ 5 - 1
devops/dockerfiles/node-and-runtime/Dockerfile

@@ -3,7 +3,11 @@ LABEL description="Compiles all workspace artifacts"
 WORKDIR /joystream
 COPY . /joystream
 
-RUN cargo build --release
+# Make sure tests pass before continuing
+RUN cargo test --release
+
+# Build joystream-node and its dependencies - runtime
+RUN cargo build --release -p joystream-node
 
 FROM debian:stretch
 LABEL description="Joystream node"

+ 4 - 6
devops/git-hooks/pre-push

@@ -1,10 +1,8 @@
 #!/bin/sh
 set -e
 
-export BUILD_DUMMY_WASM_BINARY=1
+echo '+cargo test --release --all'
+cargo test --release --all
 
-echo '+cargo test --all'
-cargo test --all
-
-echo '+cargo clippy --all -- -D warnings'
-cargo clippy --all -- -D warnings
+echo '+cargo clippy --release --all -- -D warnings'
+BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings