Ignore checks for companion PRs (#1455)

This commit is contained in:
Cecile Tonglet
2020-08-06 06:52:03 +02:00
committed by GitHub
parent bd85b3c7d3
commit 497772da18
8 changed files with 210 additions and 156 deletions
+6
View File
@@ -14,3 +14,9 @@ indent_style=space
indent_size=2
tab_width=8
end_of_line=lf
[*.sh]
indent_style=space
indent_size=2
tab_width=8
end_of_line=lf
+4 -21
View File
@@ -99,17 +99,7 @@ test-deterministic-wasm:
<<: *docker-env
except:
script:
# build runtime
- WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
# make checksum
- sha256sum target/release/wbuild/target/wasm32-unknown-unknown/release/*.wasm > checksum.sha256
# clean up FIXME: can we reuse some of the artifacts?
- cargo clean
# build again
- WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
# confirm checksum
- sha256sum -c checksum.sha256
- ./scripts/gitlab/test_deterministic_wasm.sh
test-linux-stable: &test
stage: test
@@ -123,7 +113,7 @@ test-linux-stable: &test
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
TARGET: native
script:
- time cargo test --all --release --verbose --locked --features runtime-benchmarks
- ./scripts/gitlab/test_linux_stable.sh
- sccache -s
check-web-wasm: &test
@@ -134,14 +124,7 @@ check-web-wasm: &test
script:
# WASM support is in progress. As more and more crates support WASM, we
# should add entries here. See https://github.com/paritytech/polkadot/issues/625
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/polkadot/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/kusama/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path erasure-coding/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path parachain/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path primitives/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path rpc/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path statement-table/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path cli/Cargo.toml --no-default-features --features browser
- ./scripts/gitlab/check_web_wasm.sh
- sccache -s
check-runtime-benchmarks: &test
@@ -151,7 +134,7 @@ check-runtime-benchmarks: &test
<<: *compiler_info
script:
# Check that the node will compile with `runtime-benchmarks` feature flag.
- time cargo check --features runtime-benchmarks
- ./scripts/gitlab/check_runtime_benchmarks.sh
- sccache -s
build-wasm-release:
+12 -10
View File
@@ -89,7 +89,7 @@ then
)"
boldcat <<-EOT
boldcat <<EOT
previous substrate commit id ${SUBSTRATE_PREV_REF}
new substrate commit id ${SUBSTRATE_NEW_REF}
EOT
@@ -106,7 +106,7 @@ then
"${SUBSTRATE_PREV_REF}..${SUBSTRATE_NEW_REF}" "${SUBSTRATE_VERSIONS_FILE}" \
| grep -E '^[\+\-][[:space:]]+(spec|impl)_version: +([0-9]+),$' || exit 0
boldcat <<-EOT
boldcat <<EOT
spec_version or or impl_version have changed in substrate after updating Cargo.lock
please make sure versions are bumped in polkadot accordingly
EOT
@@ -128,6 +128,8 @@ then
fi
failed_runtime_checks=()
# Iterate over each runtime defined at the start of the script
for RUNTIME in "${runtimes[@]}"
do
@@ -165,7 +167,7 @@ do
github_label "D2-breaksapi"
fi
boldcat <<-EOT
boldcat <<EOT
## RUNTIME: ${RUNTIME} ##
changes to the ${RUNTIME} runtime sources and changes in the spec version.
@@ -192,7 +194,7 @@ do
# see if the impl version changed
if [ "${add_impl_version}" != "${sub_impl_version}" ]
then
boldcat <<-EOT
boldcat <<EOT
## RUNTIME: ${RUNTIME} ##
@@ -204,8 +206,12 @@ do
continue
fi
failed_runtime_checks+=("$RUNTIME")
fi
done
boldcat <<-EOT
if [ ${#failed_runtime_checks} -gt 0 ]; then
boldcat <<EOT
wasm source files changed or the spec version in the substrate reference in
the Cargo.lock but not the spec/impl version. If changes made do not alter
logic, just bump 'impl_version'. If they do change logic, bump
@@ -214,14 +220,10 @@ do
source file directories:
- runtime
versions file: ${RUNTIME}
version files: ${failed_runtime_checks[@]}
EOT
exit 1
fi
done
exit 0
# vim: noexpandtab
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#shellcheck source=lib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
skip_if_companion_pr
time cargo check --features runtime-benchmarks
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
#shellcheck source=lib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
skip_if_companion_pr
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/polkadot/Cargo.toml
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/kusama/Cargo.toml
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path erasure-coding/Cargo.toml
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path parachain/Cargo.toml
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path primitives/Cargo.toml
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path rpc/Cargo.toml
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path statement-table/Cargo.toml
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path cli/Cargo.toml --no-default-features --features browser
+15
View File
@@ -96,3 +96,18 @@ curl -XPOST -d "$1" "https://matrix.parity.io/_matrix/client/r0/rooms/$2/send/m.
# Pretty-printing functions
boldprint () { printf "|\n| \033[1m%s\033[0m\n|\n" "${@}"; }
boldcat () { printf "|\n"; while read -r l; do printf "| \033[1m%s\033[0m\n" "${l}"; done; printf "|\n" ; }
skip_if_companion_pr() {
url="https://api.github.com/repos/paritytech/polkadot/pulls/${CI_COMMIT_REF_NAME}"
echo "[+] API URL: $url"
pr_title=$(curl -sSL -H "Authorization: token ${GITHUB_PR_TOKEN}" "$url" | jq -r .title)
echo "[+] PR title: $pr_title"
if echo "$pr_title" | grep -qi '^companion'; then
echo "[!] PR is a companion PR. Build is already done in substrate"
exit 0
else
echo "[+] PR is not a companion PR. Proceeding test"
fi
}
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
#shellcheck source=lib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
skip_if_companion_pr
# build runtime
WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
# make checksum
sha256sum target/release/wbuild/target/wasm32-unknown-unknown/release/*.wasm > checksum.sha256
# clean up - FIXME: can we reuse some of the artifacts?
cargo clean
# build again
WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
# confirm checksum
sha256sum -c checksum.sha256
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#shellcheck source=lib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
skip_if_companion_pr
time cargo test --all --release --verbose --locked --features runtime-benchmarks