Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chore(ci): migrate infra code check to namespace + cargo x workflows (#4503)
teo3f91e623b114
diff --git a/.github/workflows/code-check-infra.yml b/.github/workflows/code-check-infra.ymldeleted file mode 100644index 67d1c68848..0000000000--- a/.github/workflows/code-check-infra.yml+++ /dev/null@@ -1,89 +0,0 @@-name: infra code check-on:- pull_request:- branches: [ 'main' ]- types: [opened, synchronize, reopened, ready_for_review]--concurrency:- group: code-check-infra-${{ github.ref }}- cancel-in-progress: true--jobs:- path-check:- runs-on: ubuntu-latest- outputs:- should_run: ${{ steps.filter.outputs.should_run }}- steps:- - uses: actions/checkout@v6- - uses: dorny/paths-filter@v3- id: filter- with:- filters: |- should_run:- - 'infra/**'- - 'flake.nix'- - 'flake.lock'- - '.github/actions/setup-cachix/**'- - .github/workflows/code-check-infra.yml-- biome-check:- needs: path-check- if: needs.path-check.outputs.should_run == 'true' && github.event.pull_request.draft == false- name: Biome Check- runs-on: linux-latest-middy- steps:- - name: Checkout Repo- uses: actions/checkout@v6- with:- fetch-depth: 0- - name: Setup Nix dev shell- uses: ./.github/actions/setup-cachix- with:- cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}- dev-shell: 'true'- sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}- - name: Run Biome- working-directory: infra- run: biome ci --changed --no-errors-on-unmatched --error-on-warnings-- check:- needs: path-check- if: needs.path-check.outputs.should_run == 'true' && github.event.pull_request.draft == false- runs-on: linux-latest-middy- steps:- - uses: actions/checkout@v6- - name: Setup Nix dev shell- uses: ./.github/actions/setup-cachix- with:- cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}- dev-shell: 'true'- sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}- - name: install- working-directory: infra- run: bun install --frozen-lockfile- - name: check- working-directory: infra- run: bun run check-- # Collector job that always runs - use this as the required status check- status-check:- name: Infra Status Check- if: always()- needs: [path-check, biome-check, check]- runs-on: ubuntu-latest- steps:- - name: Check job results- run: |- echo "path-check: ${{ needs.path-check.result }}"- echo "biome-check: ${{ needs.biome-check.result }}"- echo "check: ${{ needs.check.result }}"-- # Fail if any job failed (skipped and success are both OK)- if [[ "${{ needs.path-check.result }}" == "failure" ]] || \- [[ "${{ needs.biome-check.result }}" == "failure" ]] || \- [[ "${{ needs.check.result }}" == "failure" ]]; then- echo "❌ One or more jobs failed"- exit 1- fi-- echo "✅ All jobs passed or were skipped"diff --git a/.github/workflows/code_check_infra.yml b/.github/workflows/code_check_infra.ymlnew file mode 100644index 0000000000..19c6c99ce6--- /dev/null+++ b/.github/workflows/code_check_infra.yml@@ -0,0 +1,111 @@+# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).+# Source: rust/cloud-storage/tools/xtask/src/workflows/code_check_infra.rs+name: infra code check+'on':+ pull_request:+ types:+ - opened+ - synchronize+ - reopened+ - ready_for_review+ branches:+ - main+jobs:+ path-check:+ runs-on: namespace-profile-linux-small+ outputs:+ should_run: ${{ steps.filter.outputs.should_run }}+ steps:+ - name: Checkout Repo+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10+ - id: filter+ name: Filter changed paths+ uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590+ with:+ filters: |+ should_run:+ - 'infra/**'+ - 'flake.nix'+ - 'flake.lock'+ - '.github/actions/setup-cachix/**'+ - '.github/workflows/code_check_infra.yml'+ biome-check:+ needs:+ - path-check+ if: needs.path-check.outputs.should_run == 'true' && github.event.pull_request.draft == false+ name: Biome Check+ runs-on: namespace-profile-linux-mid;overrides.cache-tag=web-ci+ steps:+ - name: Checkout Repo+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10+ with:+ fetch-depth: '0'+ - name: Mount /nix cache volume+ uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0+ with:+ path: /nix+ continue-on-error: true+ - name: Setup Nix+ uses: './.github/actions/setup-nix'+ - name: Setup Nix dev shell+ uses: './.github/actions/setup-cachix'+ with:+ cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}+ dev-shell: 'true'+ - name: Run Biome+ run: biome ci --changed --no-errors-on-unmatched --error-on-warnings+ working-directory: infra+ check:+ needs:+ - path-check+ if: needs.path-check.outputs.should_run == 'true' && github.event.pull_request.draft == false+ runs-on: namespace-profile-linux-mid;overrides.cache-tag=web-ci+ steps:+ - name: Checkout Repo+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10+ - name: Mount Namespace cache volume+ uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0+ with:+ cache: bun+ path: /nix+ continue-on-error: true+ - name: Setup Nix+ uses: './.github/actions/setup-nix'+ - name: Setup Nix dev shell+ uses: './.github/actions/setup-cachix'+ with:+ cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}+ dev-shell: 'true'+ - name: install+ run: bun install --frozen-lockfile+ working-directory: infra+ - name: check+ run: bun run check+ working-directory: infra+ status-check:+ needs:+ - path-check+ - biome-check+ - check+ if: always()+ name: Infra Status Check+ runs-on: namespace-profile-linux-small+ steps:+ - name: Check job results+ run: |+ echo "path-check: ${{ needs.path-check.result }}"+ echo "biome-check: ${{ needs.biome-check.result }}"+ echo "check: ${{ needs.check.result }}"++ # Fail if any job failed (skipped and success are both OK)+ if [[ "${{ needs.path-check.result }}" == "failure" ]] || \+ [[ "${{ needs.biome-check.result }}" == "failure" ]] || \+ [[ "${{ needs.check.result }}" == "failure" ]]; then+ echo "❌ One or more jobs failed"+ exit 1+ fi++ echo "✅ All jobs passed or were skipped"+concurrency:+ group: code-check-infra-${{ github.ref }}+ cancel-in-progress: truediff --git a/rust/cloud-storage/tools/xtask/src/workflows/code_check_infra.rs b/rust/cloud-storage/tools/xtask/src/workflows/code_check_infra.rsnew file mode 100644index 0000000000..648b39cfda--- /dev/null+++ b/rust/cloud-storage/tools/xtask/src/workflows/code_check_infra.rs@@ -0,0 +1,155 @@+//! `infra code check` — PR checks for the infra (Pulumi TypeScript) workspace.+//! Generated into `code_check_infra.yml` (replaces the hand-written+//! `code-check-infra.yml`; the required status check is the job name+//! `Infra Status Check`, which is unchanged, so branch protection is+//! unaffected by the file rename).++use gh_workflow::{+ Concurrency, Event, Expression, Job, PullRequest, PullRequestType, Run, Step, Use, Workflow,+};++use crate::workflows::{+ runners,+ steps::{self, FluentBuilder},+ vars,+};++/// The infra checks need the same cache content as the web checks (Nix+/// dev-shell closure + bun cache), so they share the `web-ci` volume — infra+/// PRs are far rarer than js/app PRs, so the added churn is negligible.+fn infra_runner() -> String {+ runners::Runner::Mid.with_cache_tag(vars::WEB_CI_CACHE_TAG)+}++/// Build the workflow.+pub fn code_check_infra() -> Workflow {+ Workflow::new("infra code check")+ .on(Event::default().pull_request(+ PullRequest::default()+ .add_branch("main")+ .add_type(PullRequestType::Opened)+ .add_type(PullRequestType::Synchronize)+ .add_type(PullRequestType::Reopened)+ .add_type(PullRequestType::ReadyForReview),+ ))+ .concurrency(+ Concurrency::new(Expression::new("code-check-infra-${{ github.ref }}"))+ .cancel_in_progress(true),+ )+ .add_job("path-check", path_check())+ .add_job("biome-check", biome_check())+ .add_job("check", check())+ .add_job("status-check", status_check())+}++fn path_check() -> Job {+ Job::default()+ .runs_on(runners::Runner::Small.to_string())+ .add_output("should_run", "${{ steps.filter.outputs.should_run }}")+ .add_step(checkout(false))+ .add_step(paths_filter())+}++fn biome_check() -> Job {+ steps::gated_job()+ .name("Biome Check")+ .runs_on(infra_runner())+ .add_step(checkout(true))+ .add_step(steps::mount_nix_cache_volume())+ .add_step(steps::setup_nix())+ .add_step(steps::setup_dev_shell())+ .add_step(run_biome())+}++fn check() -> Job {+ steps::gated_job()+ .runs_on(infra_runner())+ .add_step(checkout(false))+ .add_step(steps::mount_web_cache_volume(false))+ .add_step(steps::setup_nix())+ .add_step(steps::setup_dev_shell())+ .add_step(bun_install())+ .add_step(bun_check())+}++/// Always-run collector used as the required status check. Its name must stay+/// stable because branch protection references it.+fn status_check() -> Job {+ Job::default()+ .name("Infra Status Check")+ .cond(Expression::new("always()"))+ .needs(vec![+ "path-check".to_string(),+ "biome-check".to_string(),+ "check".to_string(),+ ])+ .runs_on(runners::Runner::Small.to_string())+ .add_step(check_job_results())+}++fn checkout(full_history: bool) -> Step<Use> {+ Step::new("Checkout Repo")+ .uses(+ "actions",+ "checkout",+ "df4cb1c069e1874edd31b4311f1884172cec0e10",+ ) // v6+ .when(full_history, |step| step.add_with(("fetch-depth", 0)))+}++fn paths_filter() -> Step<Use> {+ Step::new("Filter changed paths")+ .uses(+ "dorny",+ "paths-filter",+ "d1c1ffe0248fe513906c8e24db8ea791d46f8590",+ ) // v3.0.3+ .id("filter")+ .add_with((+ "filters",+ indoc::indoc! {r#"+ should_run:+ - 'infra/**'+ - 'flake.nix'+ - 'flake.lock'+ - '.github/actions/setup-cachix/**'+ - '.github/workflows/code_check_infra.yml'+ "#},+ ))+}++fn run_biome() -> Step<Run> {+ Step::new("Run Biome")+ .run("biome ci --changed --no-errors-on-unmatched --error-on-warnings")+ .working_directory("infra")+}++fn bun_install() -> Step<Run> {+ Step::new("install")+ .run("bun install --frozen-lockfile")+ .working_directory("infra")+}++fn bun_check() -> Step<Run> {+ Step::new("check")+ .run("bun run check")+ .working_directory("infra")+}++fn check_job_results() -> Step<Run> {+ Step::new("Check job results").run(indoc::indoc! {r#"+ echo "path-check: ${{ needs.path-check.result }}"+ echo "biome-check: ${{ needs.biome-check.result }}"+ echo "check: ${{ needs.check.result }}"++ # Fail if any job failed (skipped and success are both OK)+ if [[ "${{ needs.path-check.result }}" == "failure" ]] || \+ [[ "${{ needs.biome-check.result }}" == "failure" ]] || \+ [[ "${{ needs.check.result }}" == "failure" ]]; then+ echo "❌ One or more jobs failed"+ exit 1+ fi++ echo "✅ All jobs passed or were skipped"+ "#})+}diff --git a/rust/cloud-storage/tools/xtask/src/workflows/mod.rs b/rust/cloud-storage/tools/xtask/src/workflows/mod.rsindex a7c69e26ef..81f9f531e1 100644--- a/rust/cloud-storage/tools/xtask/src/workflows/mod.rs+++ b/rust/cloud-storage/tools/xtask/src/workflows/mod.rs@@ -17,6 +17,7 @@ mod build_dmg_on_tag;mod check_generated;mod check_node_modules_nix;mod code_check_cloud_storage;+mod code_check_infra;mod deploy_preview;mod runners;mod steps;@@ -73,6 +74,11 @@ const WORKFLOWS: &[WorkflowFile] = &[file_name: "build_desktop_on_tag.yml",render_yaml: || render_gh_workflow(build_desktop_on_tag::build_desktop_on_tag)(),},+ WorkflowFile {+ slug: "code_check_infra",+ file_name: "code_check_infra.yml",+ render_yaml: || render_gh_workflow(code_check_infra::code_check_infra)(),+ },WorkflowFile {slug: "code_check_cloud_storage",file_name: "code_check_cloud_storage.yml",