Browse Source

build scripts: use correct rust nightly toolchain

Mokhtar Naamani 4 years ago
parent
commit
da3243fa0a
9 changed files with 36 additions and 16 deletions
  1. 6 4
      .travis.yml
  2. 2 2
      README.md
  3. 6 4
      devops/git-hooks/pre-push
  4. 3 3
      node/README.md
  5. 2 2
      runtime/README.md
  6. 3 1
      scripts/cargo-build.sh
  7. 2 0
      scripts/run-dev-chain.sh
  8. 3 0
      scripts/run-test-chain.sh
  9. 9 0
      setup.sh

+ 6 - 4
.travis.yml

@@ -24,7 +24,7 @@ before_install:
     fi
 
 install:
-  - rustup install nightly-2020-05-23
+  - rustup install nightly-2020-05-23 --force
   - rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-23
   # travis installs rust using rustup with the "minimal" profile so these tools are not installed by default
   - rustup component add rustfmt
@@ -35,8 +35,10 @@ before_script:
 
 script:
   # we set release as build type for all steps to benefit from already compiled packages in prior steps
-  - BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release -- -D warnings
-  - BUILD_DUMMY_WASM_BINARY=1 cargo test --release --verbose --all
-  - TRIGGER_WASM_BUILD=1 WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release -p joystream-node
+  - export WASM_BUILD_TOOLCHAIN=nightly-2020-05-23
+  - cargo clippy --all -- -D warnings
+  - cargo test --verbose --all
+  - cargo build --release
   - ls -l ./target/release/wbuild/joystream-node-runtime/
   - ./target/release/joystream-node --version
+  - ./target/release/chain-spec-builder --version

+ 2 - 2
README.md

@@ -93,8 +93,8 @@ You can also run your our own joystream-node:
 
 ```sh
 git checkout master
-cargo build --release
-cargo run --release -- --pruning archive --chain testnets/rome.json
+WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release
+./target/release/joystream-node -- --pruning archive --chain testnets/rome.json
 ```
 
 Wait for the node to sync to the latest block, then change pioneer settings "remote node" option to "Local Node", or follow the link below:

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

@@ -1,10 +1,12 @@
 #!/bin/sh
 set -e
 
-echo '+cargo test --release --all'
-BUILD_DUMMY_WASM_BINARY=1 cargo test --all
+export WASM_BUILD_TOOLCHAIN=nightly-2020-05-23
 
-echo '+cargo clippy --release --all -- -D warnings'
-BUILD_DUMMY_WASM_BINARY=1 cargo clippy --all -- -D warnings
+echo '+cargo test --all'
+cargo test --all
+
+echo '+cargo clippy --all -- -D warnings'
+cargo clippy --all -- -D warnings
 
 

+ 3 - 3
node/README.md

@@ -26,7 +26,7 @@ cd joystream/
 Compile the node and runtime:
 
 ```bash
-cargo build --release
+WASM_BUILD_TOOLCHAIN=nightly-2020-05-23 cargo build --release
 ```
 
 This produces the binary in `./target/release/joystream-node`
@@ -34,7 +34,7 @@ This produces the binary in `./target/release/joystream-node`
 ### Running local development chain
 
 ```bash
-cargo run --release -- --dev
+./target/release/joystream-node --dev
 ```
 
 If you repeatedly need to restart a new chain,
@@ -49,7 +49,7 @@ this script will build and run a fresh new local development chain (purging exis
 Use the `--chain` argument, and specify the path to the genesis `chain.json` file for that public network. The JSON "chain spec" files for Joystream public networks can be found in [../testnets/](../testnets/).
 
 ```bash
-cargo run --release -- --chain testnets/rome.json
+./target/release/joystream-node --chain testnets/rome.json
 ```
 
 ### Tests and code quality

+ 2 - 2
runtime/README.md

@@ -7,9 +7,9 @@ The runtime is the code that defines the consensus rules of the Joystream protoc
 It is compiled to WASM and lives on chain.
 Joystream node execute the code's logic to validate transactions and blocks on the blockchain.
 
-When building joystream-node as described in [../node/README.md](../node/README.md) with `cargo build --release`, in addition to the joystream-node binary being built the WASM blob artifact is produced in:
+When building joystream-node as described in [../node/README.md](../node/README.md), in addition to the joystream-node binary being built the WASM blob artifact is produced in:
 
-`target/release/wbuild/joystream-node-runtime/joystream_node_runtime.compact.wasm`
+`./target/release/wbuild/joystream-node-runtime/joystream_node_runtime.compact.wasm`
 
 
 ### Deployment

+ 3 - 1
scripts/cargo-build.sh

@@ -1,3 +1,5 @@
 #!/bin/sh
 
-cargo build --release
+export WASM_BUILD_TOOLCHAIN=nightly-2020-05-23
+
+cargo build --release

+ 2 - 0
scripts/run-dev-chain.sh

@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+export WASM_BUILD_TOOLCHAIN=nightly-2020-05-23
+
 # Build release binary
 cargo build --release -p joystream-node
 

+ 3 - 0
scripts/run-test-chain.sh

@@ -1,4 +1,7 @@
 #!/bin/bash
+
+export WASM_BUILD_TOOLCHAIN=nightly-2020-05-23
+
 sh ./scripts/create-test-chainspec.sh
 yes | cargo run --release -p joystream-node -- purge-chain --dev
 cargo run --release -p joystream-node -- --chain=.tmp/chainspec.json --alice --validator

+ 9 - 0
setup.sh

@@ -13,6 +13,15 @@ source ~/.cargo/env
 
 rustup component add rustfmt clippy
 
+# Current version of substrate requires an older version of nightly toolchain
+# to successfully compile the WASM runtime. We force install because rustfmt package
+# is not available for this nightly version.
+rustup install nightly-2020-05-23 --force
+rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-23
+
+# Ensure the stable toolchain is still the default
+rustup default stable
+
 # TODO: Install additional tools...
 
 # - b2sum