From 6765bcd8a34bc47b4f8ad0c5c9f00574e3b1b9af Mon Sep 17 00:00:00 2001
From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
Date: Wed, 9 Oct 2024 14:16:55 +0200
Subject: [PATCH] [ci] Remove short-benchmarks from Gitlab (#5988)

PR removes short-benchmarks from GitLab, adds condition for
cargo-check-rutimes
---
 .../workflows/check-cargo-check-runtimes.yml  |   3 +-
 .gitlab-ci.yml                                |   7 -
 .gitlab/pipeline/build.yml                    | 102 +--------------
 .gitlab/pipeline/short-benchmarks.yml         | 122 +-----------------
 4 files changed, 4 insertions(+), 230 deletions(-)

diff --git a/.github/workflows/check-cargo-check-runtimes.yml b/.github/workflows/check-cargo-check-runtimes.yml
index 7e9f0dc77b7..b49a2cbbfd3 100644
--- a/.github/workflows/check-cargo-check-runtimes.yml
+++ b/.github/workflows/check-cargo-check-runtimes.yml
@@ -7,11 +7,12 @@ concurrency:
 on:
   pull_request:
     types: [opened, synchronize, reopened, ready_for_review]
+    paths:
+      - "cumulus/parachains/runtimes/*"
 
 # Jobs in this workflow depend on each other, only for limiting peak amount of spawned workers
 
 jobs:
-
   preflight:
     uses: ./.github/workflows/reusable-preflight.yml
 
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dbc5dafeb0a..f508404f1ef 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -225,8 +225,6 @@ include:
   - .gitlab/pipeline/test.yml
   # build jobs
   - .gitlab/pipeline/build.yml
-  # short-benchmarks jobs
-  - .gitlab/pipeline/short-benchmarks.yml
   # publish jobs
   - .gitlab/pipeline/publish.yml
   # zombienet jobs
@@ -284,8 +282,3 @@ cancel-pipeline-build-linux-substrate:
   extends: .cancel-pipeline-template
   needs:
     - job: build-linux-substrate
-
-cancel-pipeline-build-short-benchmark:
-  extends: .cancel-pipeline-template
-  needs:
-    - job: build-short-benchmark
diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml
index 0d509879b44..179eebf8b50 100644
--- a/.gitlab/pipeline/build.yml
+++ b/.gitlab/pipeline/build.yml
@@ -160,19 +160,6 @@ build-implementers-guide:
     - mkdir -p artifacts
     - mv polkadot/roadmap/implementers-guide/book artifacts/
 
-build-short-benchmark:
-  stage: build
-  extends:
-    - .docker-env
-    - .common-refs
-    - .run-immediately
-    - .collect-artifacts
-  script:
-    - cargo build --profile release --locked --features=runtime-benchmarks,on-chain-release-build --bin polkadot --workspace
-    - mkdir -p artifacts
-    - target/release/polkadot --version
-    - cp ./target/release/polkadot ./artifacts/
-
 build-polkadot-zombienet-tests:
   stage: build
   extends:
@@ -191,7 +178,6 @@ build-polkadot-zombienet-tests:
     - mkdir -p artifacts
     - cp polkadot-zombienet-tests.tar.zst ./artifacts
 
-
 # build jobs from cumulus
 
 build-linux-stable-cumulus:
@@ -234,92 +220,6 @@ build-test-parachain:
     - mkdir -p ./artifacts/zombienet
     - mv ./target/release/wbuild/cumulus-test-runtime/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm ./artifacts/zombienet/.
 
-# build runtime only if files in $RUNTIME_PATH/$RUNTIME_NAME were changed
-.build-runtime-template: &build-runtime-template
-  stage: build
-  extends:
-    - .docker-env
-    - .test-refs-no-trigger-prs-only
-    - .run-immediately
-  variables:
-    RUNTIME_PATH: "parachains/runtimes/assets"
-  script:
-    - cd ${RUNTIME_PATH}
-    - for directory in $(echo */); do
-      echo "_____Running cargo check for ${directory} ______";
-      cd ${directory};
-      pwd;
-      SKIP_WASM_BUILD=1 cargo check --locked;
-      cd ..;
-      done
-
-# DAG: build-runtime-assets -> build-runtime-collectives -> build-runtime-bridge-hubs
-# DAG: build-runtime-assets -> build-runtime-collectives -> build-runtime-contracts
-# DAG: build-runtime-assets -> build-runtime-coretime
-# DAG: build-runtime-assets -> build-runtime-testing
-build-runtime-assets:
-  <<: *build-runtime-template
-  variables:
-    RUNTIME_PATH: "cumulus/parachains/runtimes/assets"
-
-build-runtime-collectives:
-  <<: *build-runtime-template
-  variables:
-    RUNTIME_PATH: "cumulus/parachains/runtimes/collectives"
-  # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
-  needs:
-    - job: build-runtime-assets
-      artifacts: false
-
-build-runtime-coretime:
-  <<: *build-runtime-template
-  variables:
-    RUNTIME_PATH: "cumulus/parachains/runtimes/coretime"
-  # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
-  needs:
-    - job: build-runtime-assets
-      artifacts: false
-
-build-runtime-bridge-hubs:
-  <<: *build-runtime-template
-  variables:
-    RUNTIME_PATH: "cumulus/parachains/runtimes/bridge-hubs"
-  # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
-  needs:
-    - job: build-runtime-collectives
-      artifacts: false
-
-build-runtime-contracts:
-  <<: *build-runtime-template
-  variables:
-    RUNTIME_PATH: "cumulus/parachains/runtimes/contracts"
-  # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
-  needs:
-    - job: build-runtime-collectives
-      artifacts: false
-
-build-runtime-testing:
-  <<: *build-runtime-template
-  variables:
-    RUNTIME_PATH: "cumulus/parachains/runtimes/testing"
-  # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
-  needs:
-    - job: build-runtime-assets
-      artifacts: false
-
-build-short-benchmark-cumulus:
-  stage: build
-  extends:
-    - .docker-env
-    - .common-refs
-    - .run-immediately
-    - .collect-artifacts
-  script:
-    - cargo build --profile release --locked --features=runtime-benchmarks,on-chain-release-build -p polkadot-parachain-bin --bin polkadot-parachain --workspace
-    - mkdir -p artifacts
-    - target/release/polkadot-parachain --version
-    - cp ./target/release/polkadot-parachain ./artifacts/
-
 # substrate
 
 build-linux-substrate:
@@ -340,7 +240,7 @@ build-linux-substrate:
     # tldr: we need to checkout the branch HEAD explicitly because of our dynamic versioning approach while building the substrate binary
     # see https://github.com/paritytech/ci_cd/issues/682#issuecomment-1340953589
     - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
-    - !reference [ .forklift-cache, before_script ]
+    - !reference [.forklift-cache, before_script]
   script:
     - time WASM_BUILD_NO_COLOR=1 cargo build --locked --release -p staging-node-cli
     - mv $CARGO_TARGET_DIR/release/substrate-node ./artifacts/substrate/substrate
diff --git a/.gitlab/pipeline/short-benchmarks.yml b/.gitlab/pipeline/short-benchmarks.yml
index ad09f3f7cb0..ed97d539c09 100644
--- a/.gitlab/pipeline/short-benchmarks.yml
+++ b/.gitlab/pipeline/short-benchmarks.yml
@@ -1,121 +1 @@
-# This file is part of .gitlab-ci.yml
-# Here are all jobs that are executed during "short-benchmarks" stage
-
-# Run all pallet benchmarks only once to check if there are any errors
-
-# run short-benchmarks for relay chain runtimes from polkadot
-
-short-benchmark-westend: &short-bench
-  stage: short-benchmarks
-  extends:
-    - .docker-env
-    - .common-refs
-  needs:
-    - job: build-short-benchmark
-      artifacts: true
-  variables:
-    RUNTIME: westend
-    # Enable debug assertions since we are running optimized builds for testing
-    # but still want to have debug assertions.
-    RUSTFLAGS: "-C debug-assertions -D warnings"
-    RUST_BACKTRACE: "full"
-    WASM_BUILD_NO_COLOR: 1
-    WASM_BUILD_RUSTFLAGS: "-C debug-assertions -D warnings"
-  tags:
-    - benchmark
-  script:
-    - ./artifacts/polkadot benchmark pallet --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1
-
-short-benchmark-rococo: &short-bench
-  stage: short-benchmarks
-  extends:
-    - .docker-env
-    - .common-refs
-  needs:
-    - job: build-short-benchmark
-      artifacts: true
-  variables:
-    RUNTIME: rococo
-    # Enable debug assertions since we are running optimized builds for testing
-    # but still want to have debug assertions.
-    RUSTFLAGS: "-C debug-assertions -D warnings"
-    RUST_BACKTRACE: "full"
-    WASM_BUILD_NO_COLOR: 1
-    WASM_BUILD_RUSTFLAGS: "-C debug-assertions -D warnings"
-  tags:
-    - benchmark
-  script:
-    - ./artifacts/polkadot benchmark pallet --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1
-
-# run short-benchmarks for system parachain runtimes from cumulus
-
-.short-benchmark-cumulus: &short-bench-cumulus
-  stage: short-benchmarks
-  extends:
-    - .common-refs
-    - .docker-env
-  needs:
-    - job: build-short-benchmark-cumulus
-      artifacts: true
-  variables:
-    RUNTIME_CHAIN: benchmarked-runtime-chain
-    # Enable debug assertions since we are running optimized builds for testing
-    # but still want to have debug assertions.
-    RUSTFLAGS: "-C debug-assertions -D warnings"
-    RUST_BACKTRACE: "full"
-    WASM_BUILD_NO_COLOR: 1
-    WASM_BUILD_RUSTFLAGS: "-C debug-assertions -D warnings"
-  tags:
-    - benchmark
-  script:
-    - ./artifacts/polkadot-parachain benchmark pallet --chain $RUNTIME_CHAIN --pallet "*" --extrinsic "*" --steps 2 --repeat 1
-
-short-benchmark-asset-hub-rococo:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: asset-hub-rococo-dev
-
-short-benchmark-asset-hub-westend:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: asset-hub-westend-dev
-
-short-benchmark-bridge-hub-rococo:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: bridge-hub-rococo-dev
-
-short-benchmark-bridge-hub-westend:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: bridge-hub-westend-dev
-
-short-benchmark-collectives-westend:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: collectives-westend-dev
-
-short-benchmark-coretime-rococo:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: coretime-rococo-dev
-
-short-benchmark-coretime-westend:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: coretime-westend-dev
-
-short-benchmark-people-rococo:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: people-rococo-dev
-
-short-benchmark-people-westend:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: people-westend-dev
-
-short-benchmark-glutton-westend:
-  <<: *short-bench-cumulus
-  variables:
-    RUNTIME_CHAIN: glutton-westend-dev-1300
+---
-- 
GitLab