Add CI for monorepo (#1145)

* Add CI for monorepo

* fix frame tests

* Format features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* 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 <oliver.tale-yazdi@parity.io>

* Bump test timeout

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove feature gate

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add resolver 2

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove old lockfile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Format features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix check-dependency-rules

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* rm test-runtime

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Actually fix script

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* enable cargo-check-each-crate-macos

* Run check-each-crate on 6 machines (#1163)

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Alexander Samusev
2023-08-25 16:35:22 +02:00
committed by GitHub
parent 1a38d6d6be
commit e49493442a
157 changed files with 5001 additions and 18604 deletions
+54
View File
@@ -0,0 +1,54 @@
# name: Check D labels
# disabled in favor of pr-custom-review
# on:
# pull_request:
# types: [labeled, opened, synchronize, unlabeled]
# paths:
# - cumulus/primitives/**
# - polkadot/runtime/polkadot/**
# - polkadot/runtime/kusama/**
# - polkadot/runtime/common/**
# - polkadot/primitives/src/**
# - substrate/frame/**
# - substrate/primitives/**
# jobs:
# check-labels:
# runs-on: ubuntu-latest
# steps:
# - name: Pull image
# env:
# IMAGE: paritytech/ruled_labels:0.4.0
# run: docker pull $IMAGE
# - name: Check labels
# env:
# IMAGE: paritytech/ruled_labels:0.4.0
# MOUNT: /work
# GITHUB_PR: ${{ github.event.pull_request.number }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# API_BASE: https://api.github.com/repos
# REPO: ${{ github.repository }}
# RULES_PATH: labels/ruled_labels
# CHECK_SPECS: specs_cumulus.yaml
# run: |
# echo "REPO: ${REPO}"
# echo "GITHUB_PR: ${GITHUB_PR}"
# # Clone repo with labels specs
# git clone https://github.com/paritytech/labels
# # Fetch the labels for the PR under test
# labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
# if [ -z "${labels}" ]; then
# docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --tags audit --no-label
# fi
# labels_args=${labels: :-1}
# printf "Checking labels: %s\n" "${labels_args}"
# # Prevent the shell from splitting labels with spaces
# IFS=","
# # --dev is more useful to debug mode to debug
# docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags audit
+57
View File
@@ -0,0 +1,57 @@
name: Check labels
on:
pull_request:
types: [labeled, opened, synchronize, unlabeled]
jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- name: Pull image
env:
IMAGE: paritytech/ruled_labels:0.4.0
run: docker pull $IMAGE
- name: Check labels
env:
IMAGE: paritytech/ruled_labels:0.4.0
MOUNT: /work
GITHUB_PR: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API_BASE: https://api.github.com/repos
REPO: ${{ github.repository }}
RULES_PATH: labels/ruled_labels
CHECK_SPECS: "[DRAFT]specs_monorepo.yaml"
run: |
echo "REPO: ${REPO}"
echo "GITHUB_PR: ${GITHUB_PR}"
# Clone repo with labels specs
echo "Cloning repo with labels specs"
# 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}"
labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
echo "Labels: ${labels}"
if [ -z "${labels}" ]; then
echo "No labels found, checking without them"
docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --no-label
fi
labels_args=${labels: :-1}
printf "Checking labels: %s\n" "${labels_args}"
# Prevent the shell from splitting labels with spaces
IFS=","
# --dev is more useful to debug mode to debug
docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags PR
+22
View File
@@ -0,0 +1,22 @@
name: Rustfmt check
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
quick_check:
strategy:
matrix:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
container:
image: paritytech/ci-unified:bullseye-1.70.0-2023-05-23-v20230706
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Cargo fmt
run: cargo +nightly fmt --all -- --check
+42
View File
@@ -0,0 +1,42 @@
name: Assign reviewers
on:
pull_request:
branches:
- master
- main
types:
- opened
- reopened
- synchronize
- review_requested
- review_request_removed
- ready_for_review
- converted_to_draft
pull_request_review:
jobs:
pr-custom-review:
runs-on: ubuntu-latest
steps:
- name: Skip if pull request is in Draft
# `if: github.event.pull_request.draft == true` should be kept here, at
# the step level, rather than at the job level. The latter is not
# recommended because when the PR is moved from "Draft" to "Ready to
# review" the workflow will immediately be passing (since it was skipped),
# even though it hasn't actually ran, since it takes a few seconds for
# the workflow to start. This is also disclosed in:
# https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17
# That scenario would open an opportunity for the check to be bypassed:
# 1. Get your PR approved
# 2. Move it to Draft
# 3. Push whatever commits you want
# 4. Move it to "Ready for review"; now the workflow is passing (it was
# skipped) and "Check reviews" is also passing (it won't be updated
# until the workflow is finished)
if: github.event.pull_request.draft == true
run: exit 1
- name: pr-custom-review
uses: paritytech/pr-custom-review@master
with:
checks-reviews-api: http://pcr.parity-stg.parity.io/api/v1/check_reviews