From 37cff30978398a663b9ea61f0a14efa6614ece83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Sun, 10 Nov 2019 15:59:53 +0100 Subject: [PATCH 1/8] Fix a check for polkadot to work on forked repos. --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index baf875fd0fb79..36bbe029e5c3b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -345,10 +345,11 @@ check_polkadot: dependencies: - test-linux-stable script: - - git clone --depth 1 https://github.com/paritytech/polkadot.git - COMMIT_HASH=$(git rev-parse HEAD) + - SUBSTRATE_PATH=$(pwd) + - git clone --depth 1 https://gitlab.parity.io/parity/polkadot.git - cd polkadot - - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/" + - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~" - cargo update -p sr-io --precise $COMMIT_HASH - time cargo check - cd .. From a4c52aafb53b604dca1a18e742ec4b83d778e06c Mon Sep 17 00:00:00 2001 From: Max Inden Date: Sun, 10 Nov 2019 18:24:59 +0100 Subject: [PATCH 2/8] .gitlab-ci.yml: Add `git diff` for CI debugging --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36bbe029e5c3b..f8ae81ddb9718 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -350,6 +350,7 @@ check_polkadot: - git clone --depth 1 https://gitlab.parity.io/parity/polkadot.git - cd polkadot - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~" + - git diff - cargo update -p sr-io --precise $COMMIT_HASH - time cargo check - cd .. From e82ccd496ebb9be4d6ea27137138f224944018c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Sun, 10 Nov 2019 18:00:34 +0100 Subject: [PATCH 3/8] More future proof and less redundant. --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8ae81ddb9718..b905d61c0001f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -289,7 +289,7 @@ build-linux-subkey: script: - cd ./subkey - BUILD_DUMMY_WASM_BINARY=1 time cargo build --release --verbose - - cd .. + - cd - - sccache -s - mkdir -p ./artifacts/subkey - mv ./target/release/subkey ./artifacts/subkey/. @@ -351,9 +351,9 @@ check_polkadot: - cd polkadot - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~" - git diff - - cargo update -p sr-io --precise $COMMIT_HASH + - cargo update -p sr-io - time cargo check - - cd .. + - cd - - sccache -s #### stage: publish From 1b519fcadfdd59d299899e72eab1468f0c89eead Mon Sep 17 00:00:00 2001 From: Max Inden Date: Sun, 10 Nov 2019 19:40:49 +0100 Subject: [PATCH 4/8] .gitlab-ci.yml: Improve comments and refactor sed command --- .gitlab-ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b905d61c0001f..78177847beeb1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -338,6 +338,7 @@ check_warnings: fi allow_failure: true +# Check whether Polkadot 'master' branch builds using this Substrate commit. check_polkadot: stage: build <<: *docker-env @@ -347,11 +348,19 @@ check_polkadot: script: - COMMIT_HASH=$(git rev-parse HEAD) - SUBSTRATE_PATH=$(pwd) + # Clone the current Polkadot master branch into ./polkadot. - git clone --depth 1 https://gitlab.parity.io/parity/polkadot.git - cd polkadot - - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~" + # Within each Cargo.toml that references the Substrate 'polkadot-master' branch: + # 1. Remove the 'branch = .*' statement. + # 2. Replace 'git = "https://.*"' with 'git = "file://.*"' (the local + # checked out Substrate commit one folder above). + - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"//; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" - git diff + # Make sure 'Cargo.lock' matches 'Cargo.toml'. It's enough to update one + # package, others are updated along the way. - cargo update -p sr-io + # Check whether Polkadot 'master' branch builds with this Substrate commit. - time cargo check - cd - - sccache -s From ee716979059450f13cfbf0aec5784d72d3a3a245 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Sun, 10 Nov 2019 20:51:46 +0100 Subject: [PATCH 5/8] .gitlab-ci.yml: Remove two commas in a row --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78177847beeb1..063fb547d7175 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -351,11 +351,12 @@ check_polkadot: # Clone the current Polkadot master branch into ./polkadot. - git clone --depth 1 https://gitlab.parity.io/parity/polkadot.git - cd polkadot - # Within each Cargo.toml that references the Substrate 'polkadot-master' branch: + # Within Polkadot 'master' alter each Cargo.toml that references the + # Substrate 'polkadot-master' branch: # 1. Remove the 'branch = .*' statement. # 2. Replace 'git = "https://.*"' with 'git = "file://.*"' (the local # checked out Substrate commit one folder above). - - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"//; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" + - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"[, ]?//; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" - git diff # Make sure 'Cargo.lock' matches 'Cargo.toml'. It's enough to update one # package, others are updated along the way. From 6a0d20c5300472d9e6dd56e9ce4c298f9341ae00 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Sun, 10 Nov 2019 21:54:59 +0100 Subject: [PATCH 6/8] .gitlab-ci.yml: Ensure to match branch statements at the end --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 063fb547d7175..50d9948a72be1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -356,7 +356,7 @@ check_polkadot: # 1. Remove the 'branch = .*' statement. # 2. Replace 'git = "https://.*"' with 'git = "file://.*"' (the local # checked out Substrate commit one folder above). - - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"[, ]?//; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" + - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\",\?//; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" - git diff # Make sure 'Cargo.lock' matches 'Cargo.toml'. It's enough to update one # package, others are updated along the way. From d8f072ce3285df6423d9cdf1bb585995c598ac0f Mon Sep 17 00:00:00 2001 From: Max Inden Date: Mon, 11 Nov 2019 09:31:16 +0100 Subject: [PATCH 7/8] .gitlab-ci.yml: Reference concrete commit When one does not specify the concrete commit, cargo-update tries to checkout 'master' in the Substrate repository. --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50d9948a72be1..dfbb9cc819b76 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -353,10 +353,12 @@ check_polkadot: - cd polkadot # Within Polkadot 'master' alter each Cargo.toml that references the # Substrate 'polkadot-master' branch: - # 1. Remove the 'branch = .*' statement. + # 1. Replace the 'branch = "polkadot-master"' statements with the rev of our + # commit. # 2. Replace 'git = "https://.*"' with 'git = "file://.*"' (the local - # checked out Substrate commit one folder above). - - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\",\?//; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" + # checked out Substrate repository one folder above). + # 3. Remove any trailing commas. + - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" - git diff # Make sure 'Cargo.lock' matches 'Cargo.toml'. It's enough to update one # package, others are updated along the way. From 0fba0e7e50cf6d84ce0889a6db119585275ebae6 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Mon, 11 Nov 2019 10:12:14 +0100 Subject: [PATCH 8/8] .gitlab-ci.yml: Remove 'git diff' debug line --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfbb9cc819b76..c8c5abddce982 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -359,7 +359,6 @@ check_polkadot: # checked out Substrate repository one folder above). # 3. Remove any trailing commas. - git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/" - - git diff # Make sure 'Cargo.lock' matches 'Cargo.toml'. It's enough to update one # package, others are updated along the way. - cargo update -p sr-io