Skip to content

Commit

Permalink
feat(ci): kill duplicate CI jobs on PRs
Browse files Browse the repository at this point in the history
Taking over #25243, where
@sebastianliebscher did great work and submitted this idea. I'm
re-opening under a new PR to accelerate things a bit. I've been
triggering lots and lots of CI jobs while working on docker and feeling
guilty about my carbon footprint.

Here I grepped for workflows that have pull_request events and
copy pasted the exact same snippet everywhere except for one place and
that's the comment-triggered ephemeral builds, where I reference the
issue number instead of the PR number. This should allow for someone
to oops and retrigger the ephemeral build, and the lastest one should
always land first, fixing potential race conditions
  • Loading branch information
mistercrunch committed Feb 1, 2024
1 parent 959a5a5 commit a0a7fa9
Show file tree
Hide file tree
Showing 18 changed files with 92 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/check_db_migration_confict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
- "superset/migrations/**"
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
check_db_migration_conflict:
name: Check DB migration conflict
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
schedule:
- cron: '0 4 * * *'

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/embedded-sdk-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
- "superset-embedded-sdk/**"
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
embedded-sdk-test:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ephemeral-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
issue_comment:
types: [created]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}
cancel-in-progress: true

jobs:
config:
runs-on: "ubuntu-latest"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
license_check:
name: License Check
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/no-hold-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
check-hold-label:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-20.04
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/prefer-typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ on:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- "superset-frontend/src/**"

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
prefer_typescript:
if: github.ref == 'ref/heads/master' && github.event_name == 'pull_request'
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
test-load-examples:
runs-on: ubuntu-20.04
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/superset-docs-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
paths:
- "docs/**"
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
build-deploy:
name: Build & Deploy
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
paths:
- "superset-frontend/**"

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
frontend-build:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-helm-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
paths:
- "helm/**"

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
lint-test:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-python-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
paths:
- "superset/**"

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
python-lint:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-python-presto-hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
paths:
- "superset/**"

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
test-postgres-presto:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-python-unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
paths:
- "superset/**"

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
unit-tests:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
frontend-check:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/superset-websocket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
- "superset-websocket/**"
types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
app-checks:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/update-monorepo-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
# Trigger this workflow when Dependabot creates a pull request
types: [opened]

# cancel previous workflow jobs for PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
update-lock-file:
runs-on: ubuntu-latest
Expand Down

0 comments on commit a0a7fa9

Please sign in to comment.