Skip to content

Commit

Permalink
ci: don't run CI on draft PRs (#7518)
Browse files Browse the repository at this point in the history
PR adds a resuable workflow that prevents CI to run on draft PRs. To run
CI on draft a new label is introduced: `A5-run-CI`. To run the CI the
label should be added and en empty commit should be pushed.


close paritytech/ci_cd#1099
close #7168
  • Loading branch information
alvicsam authored Feb 18, 2025
1 parent c4b4145 commit cc8f6e6
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/benchmarks-subsystem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ permissions:
contents: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

build:
timeout-minutes: 80
needs: [preflight]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ permissions:
contents: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

build-runtimes-polkavm:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-publish-eth-rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -15,10 +15,13 @@ env:
ETH_RPC_IMAGE_NAME: "docker.io/paritypr/eth-rpc"

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
set-variables:
# This workaround sets the container image for each job using 'set-variables' job output.
# env variables don't work for PR from forks, so we need to use outputs.
runs-on: ubuntu-latest
needs: isdraft
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
steps:
Expand Down Expand Up @@ -77,4 +80,3 @@ jobs:
push: true
tags: |
${{ env.ETH_RPC_IMAGE_NAME }}:${{ env.VERSION }}
5 changes: 4 additions & 1 deletion .github/workflows/build-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -18,7 +18,10 @@ jobs:
#
#
#
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

### Build ########################
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-cargo-check-runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ on:
# Jobs in this workflow depend on each other, only for limiting peak amount of spawned workers

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

check-runtime-assets:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/check-frame-omni-bencher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

concurrency:
Expand All @@ -16,7 +16,10 @@ env:
ARTIFACTS_NAME: frame-omni-bencher-artifacts

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

quick-benchmarks-omni:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/check-getting-started.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ on:
paths:
- ".github/workflows/check-getting-started.yml"
- "scripts/getting-started.sh"
types: [opened, synchronize, reopened, ready_for_review]
schedule:
- cron: "0 5 * * *"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
check-getting-started:
needs: isdraft
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -179,6 +182,7 @@ jobs:
timeout-minutes: 5

check-getting-started-macos:
needs: isdraft
strategy:
fail-fast: true
matrix:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/check-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Check licenses

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

concurrency:
Expand All @@ -12,8 +13,11 @@ permissions:
packages: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
check-licenses:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 10
env:
LICENSES: "'Apache-2.0' 'GPL-3.0-only' 'GPL-3.0-or-later WITH Classpath-exception-2.0' 'MIT-0' 'Unlicense'"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ permissions:
packages: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
link-checker:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 10
steps:
- name: Restore lychee cache
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-runtime-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ concurrency:
permissions: {}

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

# More info can be found here: https://github.com/paritytech/polkadot/pull/5865
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ env:
TOOLCHAIN: nightly-2024-11-19

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml
check-semver:
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/checks-quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ concurrency:
permissions: {}

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

fmt:
Expand All @@ -37,6 +40,7 @@ jobs:
app-key: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_KEY }}
check-dependency-rules:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 20
steps:
- uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.7
Expand Down Expand Up @@ -84,6 +88,7 @@ jobs:
echo "Please run `taplo format --config .config/taplo.toml` to fix any toml formatting issues"
check-workspace:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 20
steps:
- uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.0 (22. Sep 2023)
Expand All @@ -102,6 +107,7 @@ jobs:
run: python3 .github/scripts/deny-git-deps.py .
check-markdown:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 20
steps:
- name: Checkout sources
Expand Down Expand Up @@ -154,6 +160,7 @@ jobs:
fi
check-fail-ci:
runs-on: ubuntu-latest
needs: isdraft
container:
# there's no "rg" in ci-unified, and tools is a smaller image anyway
image: "paritytech/tools:latest"
Expand All @@ -179,6 +186,7 @@ jobs:
GIT_DEPTH: 1
check-readme:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ concurrency:
permissions: {}

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

cargo-clippy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/cmd-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Command Bot Tests

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read
Expand All @@ -11,8 +12,11 @@ concurrency:
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
test-cmd-bot:
runs-on: ubuntu-latest
needs: [isdraft]
steps:
- uses: actions/checkout@v4
- run: python3 .github/scripts/cmd/test_cmd.py
6 changes: 5 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

test-doc:
Expand Down Expand Up @@ -77,6 +80,7 @@ jobs:

build-implementers-guide:
runs-on: ubuntu-latest
needs: isdraft
container:
image: paritytech/mdbook-utils:e14aae4a-20221123
options: --user root
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/gitspiegel-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ on:
permissions: {}

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
sync:
runs-on: ubuntu-latest
needs: isdraft
steps:
- name: Do nothing
run: echo "let's go"
3 changes: 3 additions & 0 deletions .github/workflows/publish-check-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ concurrency:
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

check-publish-compile:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-check-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ concurrency:
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
check-publish:
runs-on: ubuntu-latest
needs: isdraft
steps:
- uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.7

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/reusable-isdraft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The workflow is not part of reusable-preflight.yml to allow testing CI in draft.

name: Preflight isdraft

on:
workflow_call:
# Map the workflow outputs to job outputs

jobs:
isdraft:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'A5-run-CI')
steps:
- name: echo test
shell: bash
run: echo "PR is not draft, starting CI"
3 changes: 3 additions & 0 deletions .github/workflows/tests-evm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ concurrency:
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

evm-test-suite:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests-linux-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ concurrency:
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

test-linux-stable-int:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ concurrency:
# Jobs in this workflow depend on each other, only for limiting peak amount of spawned workers

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

# more information about this job can be found here:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ concurrency:
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

# This job runs all benchmarks defined in the `/bin/node/runtime` once to check that there are no errors.
Expand Down
Loading

0 comments on commit cc8f6e6

Please sign in to comment.