From 48415ce2a7d9f304680c50206e97f5c8f48e6879 Mon Sep 17 00:00:00 2001
From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
Date: Sat, 26 Aug 2023 16:26:12 +0200
Subject: [PATCH] [ci] Add experimental feature in tests and cargo check
 (#1173)

* [ci] Add experimental feature in tests and cargo check

* fix labels GHA

* disable D-labels

* add check license

* add auto-label-issues

* fix CHECK_SPECS for labels

* rm useless commands

* Update .github/workflows/check-labels.yml

* fix

* Fudge license scanner

* remove spellcheck job

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
---
 .github/workflows/auto-label-issues.yml       | 17 ++++++++++++
 .github/workflows/check-labels.yml            |  6 +----
 .github/workflows/check-licenses.yml          | 26 +++++++++++++++++++
 .gitlab/pipeline/check.yml                    | 17 +-----------
 .gitlab/pipeline/test.yml                     |  2 +-
 .../.github/workflows/auto-label-issues.yml   |  2 +-
 6 files changed, 47 insertions(+), 23 deletions(-)
 create mode 100644 .github/workflows/auto-label-issues.yml
 create mode 100644 .github/workflows/check-licenses.yml

diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml
new file mode 100644
index 00000000000..12ffce702cd
--- /dev/null
+++ b/.github/workflows/auto-label-issues.yml
@@ -0,0 +1,17 @@
+# If the author of the issues is not a contributor to the project, label
+# the issue with 'Z0-unconfirmed'
+
+name: Label New Issues
+on:
+  issues:
+    types: [opened]
+
+jobs:
+  label-new-issues:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Label drafts
+        uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90 # 1.0.4
+        if: github.event.issue.author_association == 'NONE'
+        with:
+          add-labels: "I10-unconfirmed"
diff --git a/.github/workflows/check-labels.yml b/.github/workflows/check-labels.yml
index ea16bb9f3e4..83b52e82313 100644
--- a/.github/workflows/check-labels.yml
+++ b/.github/workflows/check-labels.yml
@@ -22,7 +22,7 @@ jobs:
           API_BASE: https://api.github.com/repos
           REPO: ${{ github.repository }}
           RULES_PATH: labels/ruled_labels
-          CHECK_SPECS: "[DRAFT]specs_monorepo.yaml"
+          CHECK_SPECS: "specs_polkadot-sdk.yaml"
         run: |
           echo "REPO: ${REPO}"
           echo "GITHUB_PR: ${GITHUB_PR}"
@@ -32,10 +32,6 @@ jobs:
 
           # Temporary, before https://github.com/paritytech/labels/pull/29 is not merged
           git clone https://github.com/paritytech/labels
-          cd labels
-          git fetch origin the-right-joyce-monorepo-labels
-          git checkout the-right-joyce-monorepo-labels
-          cd ..
 
           # Fetch the labels for the PR under test
           echo "Fetch the labels for $API_BASE/${REPO}/pulls/${GITHUB_PR}"
diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml
new file mode 100644
index 00000000000..39104c3a4a8
--- /dev/null
+++ b/.github/workflows/check-licenses.yml
@@ -0,0 +1,26 @@
+name: Check licenses
+
+on:
+  pull_request:
+
+jobs:
+  check-licenses:
+    runs-on: ubuntu-22.04
+    steps:
+      - name: Checkout sources
+        uses: actions/checkout@v3
+      - uses: actions/setup-node@v3.8.1
+        with:
+          node-version: '18.x'
+          registry-url: 'https://npm.pkg.github.com'
+          scope: '@paritytech'
+      - name: Check the licenses
+        run: |
+          shopt -s globstar
+
+          npx --yes https://github.com/paritytech/license-scanner scan \
+            --ensure-licenses=Apache-2.0 \
+            --ensure-licenses=GPL-3.0-only \
+            ./**/*.rs
+        env:
+          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml
index a282ec66fe7..123e02a8cd1 100644
--- a/.gitlab/pipeline/check.yml
+++ b/.gitlab/pipeline/check.yml
@@ -20,7 +20,7 @@ check-try-runtime:
     - time cargo check --locked -p parachain-template-node --features try-runtime
     # add after https://github.com/paritytech/substrate/pull/14502 is merged
     # experimental code may rely on try-runtime and vice-versa
-    # - time cargo check --locked --features try-runtime,experimental
+    - time cargo check --locked --features try-runtime,experimental
 
 cargo-fmt-manifest:
   stage: check
@@ -57,21 +57,6 @@ cargo-deny-licenses:
     paths:
       - deny.log
 
-spellcheck:
-  stage: check
-  extends:
-    - .kubernetes-env
-    - .common-refs
-  script:
-    - cargo spellcheck --version
-    # compare with the commit parent to the PR, given it's from a default branch
-    - git fetch origin +${CI_DEFAULT_BRANCH}:${CI_DEFAULT_BRANCH}
-    - echo "___Spellcheck is going to check your diff___"
-    - cargo spellcheck list-files -vvv $(git diff --diff-filter=AM --name-only $(git merge-base ${CI_COMMIT_SHA} ${CI_DEFAULT_BRANCH} -- :^bridges))
-    - time cargo spellcheck check -vvv --cfg=.gitlab/spellcheck.toml --checkers hunspell --code 1
-      $(git diff --diff-filter=AM --name-only $(git merge-base ${CI_COMMIT_SHA} ${CI_DEFAULT_BRANCH} -- :^bridges))
-  allow_failure: true
-
 # from substrate
 # not sure if it's needed in monorepo
 check-dependency-rules:
diff --git a/.gitlab/pipeline/test.yml b/.gitlab/pipeline/test.yml
index 23202005045..ca8da4ea756 100644
--- a/.gitlab/pipeline/test.yml
+++ b/.gitlab/pipeline/test.yml
@@ -34,7 +34,7 @@ test-linux-stable:
         --release \
         --verbose \
         --no-fail-fast \
-        --features runtime-benchmarks,try-runtime \
+        --features runtime-benchmarks,try-runtime,experimental \
         --partition count:${CI_NODE_INDEX}/${CI_NODE_TOTAL}
     # run runtime-api tests with `enable-staging-api` feature on the 1st node
     - if [ ${CI_NODE_INDEX} == 1 ]; then time cargo nextest run -p sp-api-test --features enable-staging-api; fi
diff --git a/substrate/.github/workflows/auto-label-issues.yml b/substrate/.github/workflows/auto-label-issues.yml
index 629966ed396..12ffce702cd 100644
--- a/substrate/.github/workflows/auto-label-issues.yml
+++ b/substrate/.github/workflows/auto-label-issues.yml
@@ -14,4 +14,4 @@ jobs:
         uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90 # 1.0.4
         if: github.event.issue.author_association == 'NONE'
         with:
-          add-labels: "J2-unconfirmed"
+          add-labels: "I10-unconfirmed"
-- 
GitLab