Skip to content

Commit 7de2cc8

Browse files
alvicsamggwpez
authored andcommitted
Add CI for monorepo (#1145)
* Add CI for monorepo * fix frame tests * Format features Signed-off-by: Oliver Tale-Yazdi <[email protected]> * add note for skipping tests and disable test-linux-stable-all * Fix tests and compile issues (#1152) * Fix feature dependant import Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Bump test timeout Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove feature gate Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Add resolver 2 Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove old lockfile Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Format features Signed-off-by: Oliver Tale-Yazdi <[email protected]> --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Fix check-dependency-rules Signed-off-by: Oliver Tale-Yazdi <[email protected]> * rm test-runtime Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Actually fix script Signed-off-by: Oliver Tale-Yazdi <[email protected]> * enable cargo-check-each-crate-macos * Run check-each-crate on 6 machines (#1163) --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
1 parent 0ecf484 commit 7de2cc8

File tree

157 files changed

+4970
-18573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+4970
-18573
lines changed

.cargo/config.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# An auto defined `clippy` feature was introduced,
3+
# but it was found to clash with user defined features,
4+
# so was renamed to `cargo-clippy`.
5+
#
6+
# If you want standard clippy run:
7+
# RUSTFLAGS= cargo clippy
8+
[target.'cfg(feature = "cargo-clippy")']
9+
rustflags = [
10+
"-Aclippy::all",
11+
"-Dclippy::correctness",
12+
"-Aclippy::if-same-then-else",
13+
"-Aclippy::clone-double-ref",
14+
"-Dclippy::complexity",
15+
"-Aclippy::zero-prefixed-literal", # 00_1000_000
16+
"-Aclippy::type_complexity", # raison d'etre
17+
"-Aclippy::nonminimal-bool", # maybe
18+
"-Aclippy::borrowed-box", # Reasonable to fix this one
19+
"-Aclippy::too-many-arguments", # (Turning this on would lead to)
20+
"-Aclippy::unnecessary_cast", # Types may change
21+
"-Aclippy::identity-op", # One case where we do 0 +
22+
"-Aclippy::useless_conversion", # Types may change
23+
"-Aclippy::unit_arg", # styalistic.
24+
"-Aclippy::option-map-unit-fn", # styalistic
25+
"-Aclippy::bind_instead_of_map", # styalistic
26+
"-Aclippy::erasing_op", # E.g. 0 * DOLLARS
27+
"-Aclippy::eq_op", # In tests we test equality.
28+
"-Aclippy::while_immutable_condition", # false positives
29+
"-Aclippy::needless_option_as_deref", # false positives
30+
"-Aclippy::derivable_impls", # false positives
31+
"-Aclippy::stable_sort_primitive", # prefer stable sort
32+
"-Aclippy::extra-unused-type-parameters", # stylistic
33+
]

.config/nextest.toml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# This is the default config used by nextest. It is embedded in the binary at
2+
# build time. It may be used as a template for .config/nextest.toml.
3+
4+
[store]
5+
# The directory under the workspace root at which nextest-related files are
6+
# written. Profile-specific storage is currently written to dir/<profile-name>.
7+
dir = "target/nextest"
8+
9+
# This section defines the default nextest profile. Custom profiles are layered
10+
# on top of the default profile.
11+
[profile.default]
12+
# "retries" defines the number of times a test should be retried. If set to a
13+
# non-zero value, tests that succeed on a subsequent attempt will be marked as
14+
# non-flaky. Can be overridden through the `--retries` option.
15+
# Examples
16+
# * retries = 3
17+
# * retries = { backoff = "fixed", count = 2, delay = "1s" }
18+
# * retries = { backoff = "exponential", count = 10, delay = "1s", jitter = true, max-delay = "10s" }
19+
retries = 5
20+
21+
# The number of threads to run tests with. Supported values are either an integer or
22+
# the string "num-cpus". Can be overridden through the `--test-threads` option.
23+
# test-threads = "num-cpus"
24+
25+
test-threads = 20
26+
27+
# The number of threads required for each test. This is generally used in overrides to
28+
# mark certain tests as heavier than others. However, it can also be set as a global parameter.
29+
threads-required = 1
30+
31+
# Show these test statuses in the output.
32+
#
33+
# The possible values this can take are:
34+
# * none: no output
35+
# * fail: show failed (including exec-failed) tests
36+
# * retry: show flaky and retried tests
37+
# * slow: show slow tests
38+
# * pass: show passed tests
39+
# * skip: show skipped tests (most useful for CI)
40+
# * all: all of the above
41+
#
42+
# Each value includes all the values above it; for example, "slow" includes
43+
# failed and retried tests.
44+
#
45+
# Can be overridden through the `--status-level` flag.
46+
status-level = "pass"
47+
48+
# Similar to status-level, show these test statuses at the end of the run.
49+
final-status-level = "flaky"
50+
51+
# "failure-output" defines when standard output and standard error for failing tests are produced.
52+
# Accepted values are
53+
# * "immediate": output failures as soon as they happen
54+
# * "final": output failures at the end of the test run
55+
# * "immediate-final": output failures as soon as they happen and at the end of
56+
# the test run; combination of "immediate" and "final"
57+
# * "never": don't output failures at all
58+
#
59+
# For large test suites and CI it is generally useful to use "immediate-final".
60+
#
61+
# Can be overridden through the `--failure-output` option.
62+
failure-output = "immediate"
63+
64+
# "success-output" controls production of standard output and standard error on success. This should
65+
# generally be set to "never".
66+
success-output = "never"
67+
68+
# Cancel the test run on the first failure. For CI runs, consider setting this
69+
# to false.
70+
fail-fast = true
71+
72+
# Treat a test that takes longer than the configured 'period' as slow, and print a message.
73+
# See <https://nexte.st/book/slow-tests> for more information.
74+
#
75+
# Optional: specify the parameter 'terminate-after' with a non-zero integer,
76+
# which will cause slow tests to be terminated after the specified number of
77+
# periods have passed.
78+
# Example: slow-timeout = { period = "60s", terminate-after = 2 }
79+
slow-timeout = { period = "60s" }
80+
81+
# Treat a test as leaky if after the process is shut down, standard output and standard error
82+
# aren't closed within this duration.
83+
#
84+
# This usually happens in case of a test that creates a child process and lets it inherit those
85+
# handles, but doesn't clean the child process up (especially when it fails).
86+
#
87+
# See <https://nexte.st/book/leaky-tests> for more information.
88+
leak-timeout = "100ms"
89+
90+
[profile.default.junit]
91+
# Output a JUnit report into the given file inside 'store.dir/<profile-name>'.
92+
# If unspecified, JUnit is not written out.
93+
94+
path = "junit.xml"
95+
96+
# The name of the top-level "report" element in JUnit report. If aggregating
97+
# reports across different test runs, it may be useful to provide separate names
98+
# for each report.
99+
report-name = "substrate"
100+
101+
# Whether standard output and standard error for passing tests should be stored in the JUnit report.
102+
# Output is stored in the <system-out> and <system-err> elements of the <testcase> element.
103+
store-success-output = false
104+
105+
# Whether standard output and standard error for failing tests should be stored in the JUnit report.
106+
# Output is stored in the <system-out> and <system-err> elements of the <testcase> element.
107+
#
108+
# Note that if a description can be extracted from the output, it is always stored in the
109+
# <description> element.
110+
store-failure-output = true
111+
112+
# This profile is activated if MIRI_SYSROOT is set.
113+
[profile.default-miri]
114+
# Miri tests take up a lot of memory, so only run 1 test at a time by default.
115+
test-threads = 1
116+
117+
# Mutual exclusion of tests with `cargo build` invocation as a lock to avoid multiple
118+
# simultaneous invocations clobbering each other.
119+
[test-groups]
120+
serial-integration = { max-threads = 1 }
121+
122+
# Running UI tests sequentially
123+
# More info can be found here: https://github.com/paritytech/ci_cd/issues/754
124+
[[profile.default.overrides]]
125+
filter = 'test(/(^ui$|_ui|ui_)/)'
126+
test-group = 'serial-integration'

.github/pr-custom-review.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# 🔒 PROTECTED: Changes to locks-review-team should be approved by the current locks-review-team
2+
locks-review-team: locks-review
3+
team-leads-team: polkadot-review
4+
action-review-team: ci
5+
6+
rules:
7+
- name: CI files
8+
check_type: changed_files
9+
condition:
10+
include: ^\.gitlab-ci\.yml|^docker/.*|^\.github/.*|^\.gitlab/.*|^\.config/nextest.toml|^\.cargo/.*
11+
exclude: ^./gitlab/pipeline/zombienet.yml$
12+
min_approvals: 2
13+
teams:
14+
- ci
15+
- release-engineering
16+
17+
- name: Audit rules
18+
check_type: changed_files
19+
condition:
20+
include: ^polkadot/runtime\/(kusama|polkadot|common)\/.*|^polkadot/primitives/src\/.+\.rs$|^substrate/primitives/.*|^substrate/frame/.*
21+
exclude: ^polkadot/runtime\/(kusama|polkadot)\/src\/weights\/.+\.rs$|^substrate\/frame\/.+\.md$
22+
all_distinct:
23+
- min_approvals: 1
24+
teams:
25+
- locks-review
26+
- min_approvals: 1
27+
teams:
28+
- polkadot-review
29+
- min_approvals: 2
30+
teams:
31+
- srlabs
32+
33+
- name: Core developers
34+
check_type: changed_files
35+
condition:
36+
include: .*
37+
# excluding files from 'Runtime files' and 'CI files' rules
38+
exclude: ^polkadot/runtime/(kusama|polkadot)/src/[^/]+\.rs$|^cumulus/parachains/runtimes/assets/(asset-hub-kusama|asset-hub-polkadot)/src/[^/]+\.rs$|^cumulus/parachains/runtimes/bridge-hubs/(bridge-hub-kusama|bridge-hub-polkadot)/src/[^/]+\.rs$|^cumulus/parachains/runtimes/collectives/collectives-polkadot/src/[^/]+\.rs$|^cumulus/parachains/common/src/[^/]+\.rs$|^substrate/frame/(?!.*(nfts/.*|uniques/.*|babe/.*|grandpa/.*|beefy|merkle-mountain-range/.*|contracts/.*|election|nomination-pools/.*|staking/.*|aura/.*))|^polkadot/runtime/(kusama|polkadot)/src/[^/]+\.rs$|^\.gitlab-ci\.yml|^(?!.*\.dic$|.*spellcheck\.toml$)scripts/ci/.*|^\.github/.*
39+
min_approvals: 2
40+
teams:
41+
- core-devs
42+
43+
# cumulus
44+
- name: Runtime files cumulus
45+
check_type: changed_files
46+
condition: ^cumulus/parachains/runtimes/assets/(asset-hub-kusama|asset-hub-polkadot)/src/[^/]+\.rs$|^cumulus/parachains/runtimes/bridge-hubs/(bridge-hub-kusama|bridge-hub-polkadot)/src/[^/]+\.rs$|^cumulus/parachains/runtimes/collectives/collectives-polkadot/src/[^/]+\.rs$|^cumulus/parachains/common/src/[^/]+\.rs$
47+
all_distinct:
48+
- min_approvals: 1
49+
teams:
50+
- locks-review
51+
- min_approvals: 1
52+
teams:
53+
- polkadot-review
54+
55+
# if there are any changes in the bridges subtree (in case of backport changes back to bridges repo)
56+
- name: Bridges subtree files
57+
check_type: changed_files
58+
condition: ^cumulus/bridges/.*
59+
min_approvals: 1
60+
teams:
61+
- bridges-core
62+
63+
# substrate
64+
65+
- name: FRAME coders substrate
66+
check_type: changed_files
67+
condition:
68+
include: ^substrate/frame/(?!.*(nfts/.*|uniques/.*|babe/.*|grandpa/.*|beefy|merkle-mountain-range/.*|contracts/.*|election|nomination-pools/.*|staking/.*|aura/.*))
69+
all:
70+
- min_approvals: 2
71+
teams:
72+
- core-devs
73+
- min_approvals: 1
74+
teams:
75+
- frame-coders
76+
77+
prevent-review-request:
78+
teams:
79+
- core-devs

.github/workflows/check-D-labels.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# name: Check D labels
2+
# disabled in favor of pr-custom-review
3+
4+
# on:
5+
# pull_request:
6+
# types: [labeled, opened, synchronize, unlabeled]
7+
# paths:
8+
# - cumulus/primitives/**
9+
# - polkadot/runtime/polkadot/**
10+
# - polkadot/runtime/kusama/**
11+
# - polkadot/runtime/common/**
12+
# - polkadot/primitives/src/**
13+
# - substrate/frame/**
14+
# - substrate/primitives/**
15+
16+
# jobs:
17+
# check-labels:
18+
# runs-on: ubuntu-latest
19+
# steps:
20+
# - name: Pull image
21+
# env:
22+
# IMAGE: paritytech/ruled_labels:0.4.0
23+
# run: docker pull $IMAGE
24+
25+
# - name: Check labels
26+
# env:
27+
# IMAGE: paritytech/ruled_labels:0.4.0
28+
# MOUNT: /work
29+
# GITHUB_PR: ${{ github.event.pull_request.number }}
30+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
# API_BASE: https://api.github.com/repos
32+
# REPO: ${{ github.repository }}
33+
# RULES_PATH: labels/ruled_labels
34+
# CHECK_SPECS: specs_cumulus.yaml
35+
# run: |
36+
# echo "REPO: ${REPO}"
37+
# echo "GITHUB_PR: ${GITHUB_PR}"
38+
# # Clone repo with labels specs
39+
# git clone https://github.com/paritytech/labels
40+
# # Fetch the labels for the PR under test
41+
# labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
42+
43+
# if [ -z "${labels}" ]; then
44+
# docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --tags audit --no-label
45+
# fi
46+
47+
# labels_args=${labels: :-1}
48+
# printf "Checking labels: %s\n" "${labels_args}"
49+
50+
# # Prevent the shell from splitting labels with spaces
51+
# IFS=","
52+
53+
# # --dev is more useful to debug mode to debug
54+
# docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags audit

.github/workflows/check-labels.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Check labels
2+
3+
on:
4+
pull_request:
5+
types: [labeled, opened, synchronize, unlabeled]
6+
7+
jobs:
8+
check-labels:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Pull image
12+
env:
13+
IMAGE: paritytech/ruled_labels:0.4.0
14+
run: docker pull $IMAGE
15+
16+
- name: Check labels
17+
env:
18+
IMAGE: paritytech/ruled_labels:0.4.0
19+
MOUNT: /work
20+
GITHUB_PR: ${{ github.event.pull_request.number }}
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
API_BASE: https://api.github.com/repos
23+
REPO: ${{ github.repository }}
24+
RULES_PATH: labels/ruled_labels
25+
CHECK_SPECS: "[DRAFT]specs_monorepo.yaml"
26+
run: |
27+
echo "REPO: ${REPO}"
28+
echo "GITHUB_PR: ${GITHUB_PR}"
29+
30+
# Clone repo with labels specs
31+
echo "Cloning repo with labels specs"
32+
33+
# Temporary, before https://github.com/paritytech/labels/pull/29 is not merged
34+
git clone https://github.com/paritytech/labels
35+
cd labels
36+
git fetch origin the-right-joyce-monorepo-labels
37+
git checkout the-right-joyce-monorepo-labels
38+
cd ..
39+
40+
# Fetch the labels for the PR under test
41+
echo "Fetch the labels for $API_BASE/${REPO}/pulls/${GITHUB_PR}"
42+
labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
43+
echo "Labels: ${labels}"
44+
45+
if [ -z "${labels}" ]; then
46+
echo "No labels found, checking without them"
47+
docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --no-label
48+
fi
49+
50+
labels_args=${labels: :-1}
51+
printf "Checking labels: %s\n" "${labels_args}"
52+
53+
# Prevent the shell from splitting labels with spaces
54+
IFS=","
55+
56+
# --dev is more useful to debug mode to debug
57+
docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags PR

.github/workflows/fmt-check.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Rustfmt check
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
quick_check:
12+
strategy:
13+
matrix:
14+
os: ["ubuntu-latest"]
15+
runs-on: ${{ matrix.os }}
16+
container:
17+
image: paritytech/ci-unified:bullseye-1.70.0-2023-05-23-v20230706
18+
steps:
19+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
20+
21+
- name: Cargo fmt
22+
run: cargo +nightly fmt --all -- --check

0 commit comments

Comments
 (0)