From 2e72ae46ec0ab8129bc67c8328acc1e2fcd5592a Mon Sep 17 00:00:00 2001
From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
Date: Wed, 17 Aug 2022 12:35:44 +0200
Subject: [PATCH] [ci] Add check-runtime-migration job (#5891)

* [WIP] Playground for check-runtime-migration

* add condition

* fix syntax

* enable pipeline

* uncomment needs

* change label name to code label
---
 polkadot/.gitlab-ci.yml | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/polkadot/.gitlab-ci.yml b/polkadot/.gitlab-ci.yml
index d73a90cb3a6..94f700f7b98 100644
--- a/polkadot/.gitlab-ci.yml
+++ b/polkadot/.gitlab-ci.yml
@@ -624,6 +624,32 @@ check-try-runtime:
     # Check that everything compiles with `try-runtime` feature flag.
     - cargo check --features try-runtime --all
 
+# More info can be found here: https://github.com/paritytech/polkadot/pull/5865
+# Works only in PRs
+check-runtime-migration:
+  stage:                           stage3
+  # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
+  needs:
+    - job:                         test-node-metrics
+      artifacts:                   false
+  <<:                              *test-pr-refs
+  <<:                              *docker-env
+  <<:                              *compiler-info
+  script:
+    - |
+      export has_runtimemigration_label=$(curl -sS -H "Accept: application/vnd.github+json" \
+        -H "Authorization: token $GITHUB_PR_TOKEN" \
+        https://api.github.com/repos/paritytech/polkadot/issues/$CI_COMMIT_REF_NAME/labels | grep "E1" | wc -l)
+    - |
+      if [[ $has_runtimemigration_label != 0 ]]; then
+        echo "Found label runtimemigration. Running tests"
+        export RUST_LOG=remote-ext=debug,runtime=debug
+        time cargo test --release -p westend-runtime -p polkadot-runtime -p kusama-runtime --features try-runtime
+      else
+        echo "runtimemigration label not found. Skipping"
+      fi
+
+
 check-no-default-features:
   stage:                           stage3
   # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
-- 
GitLab