From a5b2c9ab3456072973fd4c6281a08d22b9c8f8b8 Mon Sep 17 00:00:00 2001
From: Pierre Krieger <pierre.krieger1708@gmail.com>
Date: Tue, 11 Jun 2019 22:01:26 +0200
Subject: [PATCH] Require --locked on CI for WASM runtime locks (#285)

* Require --locked on CI for WASM runtime locks

* Update runtime Cargo.lock

* Add quotes
---
 polkadot/.gitlab-ci.yml           | 4 ++--
 polkadot/ci/script.sh             | 4 ++--
 polkadot/runtime/wasm/Cargo.lock  | 1 +
 polkadot/runtime/wasm/build.sh    | 2 +-
 polkadot/scripts/build.sh         | 2 +-
 polkadot/test-parachains/build.sh | 2 +-
 6 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/polkadot/.gitlab-ci.yml b/polkadot/.gitlab-ci.yml
index 030e5fe4c00..7478a66eb87 100644
--- a/polkadot/.gitlab-ci.yml
+++ b/polkadot/.gitlab-ci.yml
@@ -84,7 +84,7 @@ test-linux-stable:                 &test
     variables:
       - $DEPLOY_TAG
   script:
-    - ./scripts/build.sh
+    - ./scripts/build.sh --locked
     - time cargo test --all --release --verbose --locked
     - sccache -s
 
@@ -107,7 +107,7 @@ build-linux-release:               &build
   tags:
     - linux-docker
   script:
-    - ./scripts/build.sh
+    - ./scripts/build.sh --locked
     - time cargo build --release --verbose
     - mkdir -p ./artifacts
     - mv ./target/release/polkadot ./artifacts/.
diff --git a/polkadot/ci/script.sh b/polkadot/ci/script.sh
index 7eee447bb06..d1d806f30f7 100755
--- a/polkadot/ci/script.sh
+++ b/polkadot/ci/script.sh
@@ -17,12 +17,12 @@ case $TARGET in
 		sudo apt-get -y update
 		sudo apt-get install -y cmake pkg-config libssl-dev
 
-		cargo test --all --locked
+		cargo test --all --locked "$@"
 		;;
 
 	"wasm")
 		# Install prerequisites and build all wasm projects
 		./scripts/init.sh
-		./scripts/build.sh
+		./scripts/build.sh --locked "$@"
 		;;
 esac
diff --git a/polkadot/runtime/wasm/Cargo.lock b/polkadot/runtime/wasm/Cargo.lock
index c9d379293bf..9a93cc34ea9 100644
--- a/polkadot/runtime/wasm/Cargo.lock
+++ b/polkadot/runtime/wasm/Cargo.lock
@@ -2425,6 +2425,7 @@ version = "2.0.0"
 source = "git+https://github.com/paritytech/substrate?branch=polkadot-master#54d028551b11f40266628ceeb35bec0595d360c3"
 dependencies = [
  "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
  "sr-primitives 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
  "sr-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
  "srml-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
diff --git a/polkadot/runtime/wasm/build.sh b/polkadot/runtime/wasm/build.sh
index 068b7c8b478..ea87bd76fd0 100755
--- a/polkadot/runtime/wasm/build.sh
+++ b/polkadot/runtime/wasm/build.sh
@@ -6,7 +6,7 @@ if cargo --version | grep -q "nightly"; then
 else
 	CARGO_CMD="cargo +nightly"
 fi
-RUSTFLAGS="-C link-arg=--export-table" $CARGO_CMD build --target=wasm32-unknown-unknown --release
+RUSTFLAGS="-C link-arg=--export-table" $CARGO_CMD build --target=wasm32-unknown-unknown --release $@
 for i in polkadot_runtime
 do
 	wasm-gc target/wasm32-unknown-unknown/release/$i.wasm target/wasm32-unknown-unknown/release/$i.compact.wasm
diff --git a/polkadot/scripts/build.sh b/polkadot/scripts/build.sh
index 9cacf74dbb0..3135a2f4de5 100755
--- a/polkadot/scripts/build.sh
+++ b/polkadot/scripts/build.sh
@@ -19,7 +19,7 @@ do
   echo "*** Building wasm binaries in $SRC"
   cd "$PROJECT_ROOT/$SRC"
 
-  ./build.sh
+  ./build.sh "$@"
 
   cd - >> /dev/null
 done
diff --git a/polkadot/test-parachains/build.sh b/polkadot/test-parachains/build.sh
index 06183fa2e5d..307b3e67481 100755
--- a/polkadot/test-parachains/build.sh
+++ b/polkadot/test-parachains/build.sh
@@ -7,7 +7,7 @@ export RUSTFLAGS="-C link-arg=--import-memory -C link-arg=--export-table -C pani
 for i in adder
 do
 	cd $i/wasm
-	cargo +nightly build --target=wasm32-unknown-unknown --release --no-default-features --target-dir target
+	cargo +nightly build --target=wasm32-unknown-unknown --release --no-default-features --target-dir target "$@"
 	wasm-gc target/wasm32-unknown-unknown/release/$i'_'wasm.wasm target/wasm32-unknown-unknown/release/$i.wasm
 	cp target/wasm32-unknown-unknown/release/$i.wasm ../../../parachain/tests/res/
 	rm -rf target
-- 
GitLab