ci: Add extension workflow concurrency rules (#43930)
Release Notes: - N/A
This commit is contained in:
@@ -46,3 +46,6 @@ jobs:
|
||||
with:
|
||||
bump-type: ${{ needs.determine_bump_type.outputs.bump_type }}
|
||||
force-bump: true
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anyshalabels' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
@@ -9,5 +9,5 @@ jobs:
|
||||
call_extension_tests:
|
||||
uses: zed-industries/zed/.github/workflows/extension_tests.yml@main
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anyshapr' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
@@ -7,7 +7,7 @@ use indoc::indoc;
|
||||
use crate::tasks::workflows::{
|
||||
runners,
|
||||
steps::{NamedJob, named},
|
||||
vars::{self, JobOutput, StepOutput},
|
||||
vars::{self, JobOutput, StepOutput, one_workflow_per_non_main_branch_and_token},
|
||||
};
|
||||
|
||||
pub(crate) fn bump_version() -> Workflow {
|
||||
@@ -20,6 +20,7 @@ pub(crate) fn bump_version() -> Workflow {
|
||||
.on(Event::default()
|
||||
.push(Push::default().add_branch("main"))
|
||||
.pull_request(PullRequest::default().add_type(PullRequestType::Labeled)))
|
||||
.concurrency(one_workflow_per_non_main_branch_and_token("labels"))
|
||||
.add_job(determine_bump_type.name, determine_bump_type.job)
|
||||
.add_job(call_bump_version.name, call_bump_version.job)
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ use gh_workflow::{Event, Job, PullRequest, UsesJob, Workflow};
|
||||
|
||||
use crate::tasks::workflows::{
|
||||
steps::{NamedJob, named},
|
||||
vars::one_workflow_per_non_main_branch,
|
||||
vars::one_workflow_per_non_main_branch_and_token,
|
||||
};
|
||||
|
||||
pub(crate) fn run_tests() -> Workflow {
|
||||
let call_extension_tests = call_extension_tests();
|
||||
named::workflow()
|
||||
.on(Event::default().pull_request(PullRequest::default().add_branch("**")))
|
||||
.concurrency(one_workflow_per_non_main_branch())
|
||||
.concurrency(one_workflow_per_non_main_branch_and_token("pr"))
|
||||
.add_job(call_extension_tests.name, call_extension_tests.job)
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,18 @@ pub fn bundle_envs(platform: Platform) -> Env {
|
||||
}
|
||||
|
||||
pub fn one_workflow_per_non_main_branch() -> Concurrency {
|
||||
one_workflow_per_non_main_branch_and_token("")
|
||||
}
|
||||
|
||||
pub fn one_workflow_per_non_main_branch_and_token<T: AsRef<str>>(token: T) -> Concurrency {
|
||||
Concurrency::default()
|
||||
.group("${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}")
|
||||
.group(format!(
|
||||
concat!(
|
||||
"${{{{ github.workflow }}}}-${{{{ github.ref_name }}}}-",
|
||||
"${{{{ github.ref_name == 'main' && github.sha || 'anysha{}' }}}}"
|
||||
),
|
||||
token.as_ref()
|
||||
))
|
||||
.cancel_in_progress(true)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user