Skip to content

Commit

Permalink
feat: backend concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
4e6 committed Nov 28, 2024
1 parent 6d9699c commit 36c4be2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
required: false
type: string
default: nodejs
concurrency: release
jobs:
enso-build-ci-gen-draft-release-linux-amd64:
name: Create a release draft.
Expand Down Expand Up @@ -725,4 +726,3 @@ env:
ENSO_EDITION: ${{ inputs.version }}
ENSO_VERSION: ${{ inputs.version }}
RUST_BACKTRACE: full
concurrency: release
15 changes: 3 additions & 12 deletions .github/workflows/scala-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,10 @@ on:
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }}
jobs:
enso-build-ci-gen-job-cancel-workflow-linux-amd64:
name: Cancel Previous Runs
if: github.ref != 'refs/heads/develop'
runs-on:
- ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
permissions:
actions: write
enso-build-ci-gen-job-ci-check-backend-graal-vm-ce-linux-amd64:
name: Engine (GraalVM CE) (linux, amd64)
runs-on:
Expand Down
18 changes: 15 additions & 3 deletions build/build/src/ci_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,22 @@ pub fn gui_tests() -> Result<Workflow> {
Ok(workflow)
}

fn concurrency() -> Concurrency {
let github_workflow = wrap_expression("github.workflow");
let github_ref = wrap_expression("github.ref");
Concurrency::Map {
group: format!("{github_workflow}-{github_ref}"),
cancel_in_progress: wrap_expression(not_default_branch()),
}
}

pub fn backend() -> Result<Workflow> {
let on = typical_check_triggers();
let mut workflow = Workflow { name: "Engine CI".into(), on, ..default() };
workflow.add(PRIMARY_TARGET, job::CancelWorkflow);
let mut workflow = Workflow {
name: "Engine CI".into(),
on: typical_check_triggers(),
concurrency: Some(concurrency()),
..default()
};
workflow.add(PRIMARY_TARGET, job::VerifyLicensePackages);
for target in PR_CHECKED_TARGETS {
add_backend_checks(&mut workflow, target, graalvm::Edition::Community);
Expand Down
4 changes: 2 additions & 2 deletions build/ci_utils/src/actions/workflow/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ pub struct Workflow {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub on: Event,
#[serde(skip_serializing_if = "Option::is_none")]
pub concurrency: Option<Concurrency>,
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub permissions: BTreeMap<Permission, Access>,
// No additional clause, as the jobs must be non-empty.
pub jobs: BTreeMap<String, Job>,
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub env: BTreeMap<String, String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub concurrency: Option<Concurrency>,
}

impl Default for Workflow {
Expand Down

0 comments on commit 36c4be2

Please sign in to comment.