From bfdab65791a72e356b9ad61866a790a8646a4c62 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 5 Aug 2024 22:05:29 -0700 Subject: [PATCH] Fix CI concurrency (#849) Few CI improvements witch will reduce occupation CI queue and eliminate stale runs. 1. Kill CI jobs on PRs once PR branch gets a new push. This will prevent situation happened today - a huge job triggered twice in less than an hour and occupied all **org** (for all repositories) runners queue for the rest of the day (see pic). This completely blocked valkey-glide team. 2. Distribute nightly croned jobs on time to prevent them running together. Keep in mind, cron's TZ is UTC, so midnight tasks incur developers located in other timezones. This must be backported to all release branches (`valkey-x.y` and `x.y`) ![image](https://github.com/user-attachments/assets/923d8237-3cb7-42f5-80c8-5322b3f5187d) --------- Signed-off-by: Yury-Fridlyand --- .github/workflows/ci.yml | 4 ++++ .github/workflows/clang-format.yml | 4 ++++ .github/workflows/codecov.yml | 4 ++++ .github/workflows/codeql-analysis.yml | 6 +++++- .github/workflows/coverity.yml | 8 +++++++- .github/workflows/daily.yml | 4 ++++ .github/workflows/external.yml | 6 +++++- .github/workflows/reply-schemas-linter.yml | 4 ++++ .github/workflows/spell-check.yml | 4 ++++ 9 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a7b1fb1ce..6a1a9460fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,10 @@ name: CI on: [push, pull_request] +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + permissions: contents: read diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 7d53cc28e7..efc63a1f6f 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -5,6 +5,10 @@ on: paths: - 'src/**' +concurrency: + group: clang-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: clang-format-check: runs-on: ubuntu-latest diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 0a0d4a23db..951b5c2862 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -4,6 +4,10 @@ name: "Codecov" # where each PR needs to be compared against the coverage of the head commit on: [push, pull_request] +concurrency: + group: codecov-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: code-coverage: runs-on: ubuntu-latest diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6165429c3a..12358dea7e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -4,7 +4,11 @@ on: pull_request: schedule: # run weekly new vulnerability was added to the database - - cron: '0 0 * * 0' + - cron: '0 3 * * 0' + +concurrency: + group: codeql-${{ github.head_ref || github.ref }} + cancel-in-progress: true permissions: contents: read diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index cfd0df1af3..2561e4ceb5 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -3,11 +3,17 @@ name: Coverity Scan on: schedule: # Run once daily, since below 500k LOC can have 21 builds per week, per https://scan.coverity.com/faq#frequency - - cron: '0 0 * * *' + - cron: '0 1 * * *' # Support manual execution workflow_dispatch: + +concurrency: + group: coverity-${{ github.head_ref || github.ref }} + cancel-in-progress: true + permissions: contents: read + jobs: coverity: if: github.repository == 'valkey-io/valkey' diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 48cbb28ee1..2d7a4e5f86 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -29,6 +29,10 @@ on: description: "git branch or sha to use" default: "unstable" +concurrency: + group: daily-${{ github.head_ref || github.ref }} + cancel-in-progress: true + permissions: contents: read diff --git a/.github/workflows/external.yml b/.github/workflows/external.yml index e021a964d1..cfcab995d5 100644 --- a/.github/workflows/external.yml +++ b/.github/workflows/external.yml @@ -4,7 +4,11 @@ on: pull_request: push: schedule: - - cron: '0 0 * * *' + - cron: '0 2 * * *' + +concurrency: + group: external-${{ github.head_ref || github.ref }} + cancel-in-progress: true permissions: contents: read diff --git a/.github/workflows/reply-schemas-linter.yml b/.github/workflows/reply-schemas-linter.yml index 0c4e62341e..1141e235fb 100644 --- a/.github/workflows/reply-schemas-linter.yml +++ b/.github/workflows/reply-schemas-linter.yml @@ -8,6 +8,10 @@ on: paths: - 'src/commands/*.json' +concurrency: + group: reply-schemas-linter-${{ github.head_ref || github.ref }} + cancel-in-progress: true + permissions: contents: read diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index a5d3fd68d4..69d9b9cb6a 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -9,6 +9,10 @@ on: push: pull_request: +concurrency: + group: spellcheck-${{ github.head_ref || github.ref }} + cancel-in-progress: true + permissions: contents: read