[stable 2407] Backport #5741 #11853
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Checks that doesn't require heavy lifting, like formatting, linting, etc. | |
name: quick-checks | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
merge_group: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: {} | |
jobs: | |
set-image: | |
# GitHub Actions allows using 'env' in a container context. | |
# However, env variables don't work for forks: https://github.com/orgs/community/discussions/44322 | |
# This workaround sets the container image for each job using 'set-image' job output. | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
outputs: | |
IMAGE: ${{ steps.set_image.outputs.IMAGE }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: set_image | |
run: cat .github/env >> $GITHUB_OUTPUT | |
fmt: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [set-image] | |
container: | |
image: ${{ needs.set-image.outputs.IMAGE }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Cargo fmt | |
run: cargo +nightly fmt --all -- --check | |
check-dependency-rules: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: check dependency rules | |
run: | | |
cd substrate/ | |
../.gitlab/ensure-deps.sh | |
check-rust-feature-propagation: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [set-image] | |
container: | |
image: ${{ needs.set-image.outputs.IMAGE }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: fetch deps | |
run: | | |
# Pull all dependencies eagerly: | |
time cargo metadata --format-version=1 --locked > /dev/null | |
- name: run zepter | |
run: | | |
zepter --version | |
time zepter run check | |
test-rust-features: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [set-image] | |
container: | |
image: ${{ needs.set-image.outputs.IMAGE }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: run rust features | |
run: bash .gitlab/rust-features.sh . | |
check-toml-format: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [set-image] | |
container: | |
image: ${{ needs.set-image.outputs.IMAGE }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: check toml format | |
run: | | |
taplo format --check --config .config/taplo.toml | |
echo "Please run `taplo format --config .config/taplo.toml` to fix any toml formatting issues" | |
check-workspace: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.0 (22. Sep 2023) | |
- name: install python deps | |
run: | | |
sudo apt-get update && sudo apt-get install -y python3-pip python3 | |
pip3 install toml "cargo-workspace>=1.2.6" | |
- name: check integrity | |
run: > | |
python3 .github/scripts/check-workspace.py . | |
--exclude | |
"substrate/frame/contracts/fixtures/build" | |
"substrate/frame/contracts/fixtures/contracts/common" | |
- name: deny git deps | |
run: python3 .github/scripts/deny-git-deps.py . | |
check-markdown: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: "18.x" | |
registry-url: "https://npm.pkg.github.com" | |
scope: "@paritytech" | |
- name: Install tooling | |
run: | | |
npm install -g markdownlint-cli | |
markdownlint --version | |
- name: Check Markdown | |
env: | |
CONFIG: .github/.markdownlint.yaml | |
run: | | |
echo "Checking markdown formatting. More info: docs/contributor/markdown_linting.md" | |
echo "To fix potential erros, you can run 'markdownlint --config .github/.markdownlint.yaml -f --ignore target .' locally." | |
markdownlint --config "$CONFIG" --ignore target . | |
check-umbrella: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [set-image] | |
container: | |
image: ${{ needs.set-image.outputs.IMAGE }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.0 (22. Sep 2023) | |
- name: install python deps | |
run: pip3 install "cargo-workspace>=1.2.4" toml | |
- name: check umbrella correctness | |
run: | | |
# Fixes "detected dubious ownership" error in the ci | |
git config --global --add safe.directory '*' | |
python3 scripts/generate-umbrella.py --sdk . --version 0.1.0 | |
cargo +nightly fmt --all | |
if [ -n "$(git status --porcelain)" ]; then | |
cat <<EOF | |
👋 Hello developer! Apparently you added a new crate that is not part of the umbrella crate? | |
You can just apply the patch (git apply PATCH_NAME) that was printed to make this CI check succeed. | |
Otherwise feel free to ask in the Merge Request or in Matrix chat. | |
EOF | |
git diff | |
exit 1 | |
fi |