Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(ci): move web checks to x workflow namepsace (#4440)

teo20983b8f1a49
diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.yml
index e30e33ea34..71eb769392 100644
--- a/.github/workflows/web-app-check-main.yml
+++ b/.github/workflows/web-app-check-main.yml
@@ -1,208 +1,218 @@
-name: 'Web App Pr Checks'
-on:
+# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).
+# Source: rust/cloud-storage/tools/xtask/src/workflows/web_app_check_main.rs
+name: Web App Pr Checks
+'on':
pull_request:
+ types:
+ - opened
+ - synchronize
+ - reopened
+ - ready_for_review
branches:
- - main
- types: [opened, synchronize, reopened, ready_for_review]
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}-check
- cancel-in-progress: true
-
+ - main
jobs:
path-check:
- runs-on: ubuntu-latest
+ runs-on: namespace-profile-linux-small
outputs:
should_run: ${{ steps.filter.outputs.should_run }}
api_changed: ${{ steps.filter.outputs.api_changed }}
steps:
- - uses: actions/checkout@v6
- - uses: dorny/paths-filter@v3
- id: filter
- with:
- filters: |
- should_run:
- - 'js/package.json'
- - 'js/bun.lock'
- - 'js/app/package.json'
- - 'js/app/packages/**'
- - 'js/app/src/**'
- - 'js/app/biome.jsonc'
- - 'js/lexical-core/**'
- - 'js/lexical-service/**'
- - '.github/actions/setup-cachix/**'
- - '.github/actions/setup-reqs-web/**'
- - '.github/workflows/web-app-check-main.yml'
- api_changed:
- - 'rust/cloud-storage/**/*.rs'
- - 'rust/cloud-storage/Cargo.toml'
- - 'rust/cloud-storage/Cargo.lock'
- - 'flake.nix'
- - 'flake.lock'
- - 'js/app/scripts/generate-api-schema.ts'
- - 'js/app/scripts/services.ts'
- - '.github/actions/setup-cachix/**'
- - '.github/actions/setup-reqs-web/**'
- - '.github/workflows/web-app-check-main.yml'
-
+ - name: Checkout Repo
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
+ - id: filter
+ name: Filter changed paths
+ uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590
+ with:
+ filters: |
+ should_run:
+ - 'js/package.json'
+ - 'js/bun.lock'
+ - 'js/app/package.json'
+ - 'js/app/packages/**'
+ - 'js/app/src/**'
+ - 'js/app/biome.jsonc'
+ - 'js/lexical-core/**'
+ - 'js/lexical-service/**'
+ - '.github/actions/setup-cachix/**'
+ - '.github/actions/setup-reqs-web/**'
+ - '.github/workflows/web-app-check-main.yml'
+ api_changed:
+ - 'rust/cloud-storage/**/*.rs'
+ - 'rust/cloud-storage/Cargo.toml'
+ - 'rust/cloud-storage/Cargo.lock'
+ - 'flake.nix'
+ - 'flake.lock'
+ - 'js/app/scripts/generate-api-schema.ts'
+ - 'js/app/scripts/services.ts'
+ - '.github/actions/setup-cachix/**'
+ - '.github/actions/setup-reqs-web/**'
+ - '.github/workflows/web-app-check-main.yml'
typescript:
- needs: path-check
- # Run the type check if rust code or frontend code has changed.
+ needs:
+ - path-check
if: needs.path-check.outputs.should_run == 'true' || needs.path-check.outputs.api_changed == 'true'
name: Typecheck
runs-on: linux-extra-beefy
steps:
- - name: Checkout Repo
- uses: actions/checkout@v6
- - name: Setup Prereqs
- uses: ./.github/actions/setup-reqs-web
- with:
- cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
- - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- if: needs.path-check.outputs.api_changed == 'true'
- with:
- workspaces: rust/cloud-storage
- shared-key: cloud-storage-gen-api
- cache-on-failure: true
- cache-targets: true
- - name: Generate API Types
- if: needs.path-check.outputs.api_changed == 'true'
- working-directory: js/app
- env:
- AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: bun run gen-api -- --check
- - name: show sccache stats
- if: always() && needs.path-check.outputs.api_changed == 'true'
- env:
- AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: sccache --show-stats || true
- - name: Check Types
- working-directory: js/app
- run: |
- bun run --bun --silent tsc --project ./packages/app/tsconfig.json
-
+ - name: Checkout Repo
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
+ - name: Setup Prereqs
+ uses: './.github/actions/setup-reqs-web'
+ with:
+ cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
+ sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
+ - name: Cache Rust
+ if: needs.path-check.outputs.api_changed == 'true'
+ uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
+ with:
+ workspaces: rust/cloud-storage
+ shared-key: cloud-storage-gen-api
+ cache-on-failure: 'true'
+ cache-targets: 'true'
+ - name: Generate API Types
+ if: needs.path-check.outputs.api_changed == 'true'
+ run: bun run gen-api -- --check
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ working-directory: js/app
+ - name: show sccache stats
+ if: always() && needs.path-check.outputs.api_changed == 'true'
+ run: sccache --show-stats || true
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ - name: Check Types
+ run: bun run --bun --silent tsc --project ./packages/app/tsconfig.json
+ working-directory: js/app
biome-check:
- needs: path-check
+ needs:
+ - path-check
if: needs.path-check.outputs.should_run == 'true'
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: js/app
- run: biome ci --changed --no-errors-on-unmatched --error-on-warnings
-
+ - name: Checkout Repo
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
+ 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
+ run: biome ci --changed --no-errors-on-unmatched --error-on-warnings
+ working-directory: js/app
tailwind:
- needs: path-check
+ needs:
+ - path-check
if: needs.path-check.outputs.should_run == 'true'
name: Theme Hygiene Inspector
runs-on: linux-latest-middy
steps:
- - name: Checkout Repo
- uses: actions/checkout@v6
- with:
- fetch-depth: 0
- - name: Setup Prereqs
- uses: ./.github/actions/setup-reqs-web
- with:
- cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
- - name: Check Tailwind Classes
- working-directory: js/app
- run: just check-tailwind
-
+ - name: Checkout Repo
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
+ with:
+ fetch-depth: '0'
+ - name: Setup Prereqs
+ uses: './.github/actions/setup-reqs-web'
+ with:
+ cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
+ sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
+ - name: Check Tailwind Classes
+ run: just check-tailwind
+ working-directory: js/app
test:
- needs: path-check
+ needs:
+ - path-check
if: needs.path-check.outputs.should_run == 'true'
name: Test
runs-on: linux-latest-middy
steps:
- - name: Checkout Repo
- uses: actions/checkout@v6
- - name: Setup
- uses: ./.github/actions/setup-reqs-web
- with:
- cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
- playwright: 'true'
- - name: Test
- working-directory: js/app
- run: bunx vitest
-
+ - name: Checkout Repo
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
+ - name: Setup
+ uses: './.github/actions/setup-reqs-web'
+ with:
+ cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
+ sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
+ playwright: 'true'
+ - name: Test
+ run: bunx vitest
+ working-directory: js/app
cycles:
- needs: path-check
+ needs:
+ - path-check
if: needs.path-check.outputs.should_run == 'true'
name: Cycles Import Check
runs-on: linux-latest-middy
steps:
- - name: Checkout
- 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: Cycles Import Check
- working-directory: js/app
- run: biome lint --changed --no-errors-on-unmatched --only=suspicious/noImportCycles
-
+ - name: Checkout
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
+ - 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: Cycles Import Check
+ run: biome lint --changed --no-errors-on-unmatched --only=suspicious/noImportCycles
+ working-directory: js/app
build:
- needs: path-check
+ needs:
+ - path-check
if: needs.path-check.outputs.should_run == 'true'
name: Build
runs-on: linux-latest-middy
steps:
- - name: Checkout Repo
- uses: actions/checkout@v6
- - name: Setup
- uses: ./.github/actions/setup-reqs-web
- with:
- cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
- - name: Build
- working-directory: js/app
- run: bun run build
-
- # Collector job that always runs - use this as the required status check
+ - name: Checkout Repo
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
+ - name: Setup
+ uses: './.github/actions/setup-reqs-web'
+ with:
+ cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
+ sccache-bucket: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}
+ - name: Build
+ run: bun run build
+ working-directory: js/app
status-check:
- name: Web App Status Check
+ needs:
+ - path-check
+ - typescript
+ - biome-check
+ - tailwind
+ - test
+ - cycles
+ - build
if: always()
- needs: [path-check, typescript, biome-check, tailwind, test, cycles, build]
- runs-on: ubuntu-latest
+ name: Web App Status Check
+ runs-on: namespace-profile-linux-small
steps:
- - name: Check job results
- run: |
- echo "path-check: ${{ needs.path-check.result }}"
- echo "typescript: ${{ needs.typescript.result }}"
- echo "biome-check: ${{ needs.biome-check.result }}"
- echo "tailwind: ${{ needs.tailwind.result }}"
- echo "test: ${{ needs.test.result }}"
- echo "cycles: ${{ needs.cycles.result }}"
- echo "build: ${{ needs.build.result }}"
+ - name: Check job results
+ run: |
+ echo "path-check: ${{ needs.path-check.result }}"
+ echo "typescript: ${{ needs.typescript.result }}"
+ echo "biome-check: ${{ needs.biome-check.result }}"
+ echo "tailwind: ${{ needs.tailwind.result }}"
+ echo "test: ${{ needs.test.result }}"
+ echo "cycles: ${{ needs.cycles.result }}"
+ echo "build: ${{ needs.build.result }}"
- # Fail if any job failed (skipped and success are both OK)
- if [[ "${{ needs.path-check.result }}" == "failure" ]] || \
- [[ "${{ needs.typescript.result }}" == "failure" ]] || \
- [[ "${{ needs.biome-check.result }}" == "failure" ]] || \
- [[ "${{ needs.tailwind.result }}" == "failure" ]] || \
- [[ "${{ needs.test.result }}" == "failure" ]] || \
- [[ "${{ needs.cycles.result }}" == "failure" ]] || \
- [[ "${{ needs.build.result }}" == "failure" ]]; then
- echo "❌ One or more jobs failed"
- exit 1
- fi
+ # Fail if any job failed (skipped and success are both OK)
+ if [[ "${{ needs.path-check.result }}" == "failure" ]] || \
+ [[ "${{ needs.typescript.result }}" == "failure" ]] || \
+ [[ "${{ needs.biome-check.result }}" == "failure" ]] || \
+ [[ "${{ needs.tailwind.result }}" == "failure" ]] || \
+ [[ "${{ needs.test.result }}" == "failure" ]] || \
+ [[ "${{ needs.cycles.result }}" == "failure" ]] || \
+ [[ "${{ needs.build.result }}" == "failure" ]]; then
+ echo "One or more jobs failed"
+ exit 1
+ fi
- echo "✅ All jobs passed or were skipped"
+ echo "All jobs passed or were skipped"
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-check
+ cancel-in-progress: true
diff --git a/rust/cloud-storage/tools/xtask/src/workflows/mod.rs b/rust/cloud-storage/tools/xtask/src/workflows/mod.rs
index a4b4c3e3e6..a629d0cf04 100644
--- a/rust/cloud-storage/tools/xtask/src/workflows/mod.rs
+++ b/rust/cloud-storage/tools/xtask/src/workflows/mod.rs
@@ -20,6 +20,7 @@ mod code_check_cloud_storage;
mod runners;
mod steps;
mod vars;
+mod web_app_check_main;
use std::fs;
use std::path::{Path, PathBuf};
@@ -86,6 +87,11 @@ const WORKFLOWS: &[WorkflowFile] = &[
file_name: "check_generated.yml",
render_yaml: || render_gh_workflow(check_generated::check_generated_workflows)(),
},
+ WorkflowFile {
+ slug: "web_app_check_main",
+ file_name: "web-app-check-main.yml",
+ render_yaml: || render_gh_workflow(web_app_check_main::web_app_check_main)(),
+ },
];
/// Write every workflow to disk.
diff --git a/rust/cloud-storage/tools/xtask/src/workflows/steps.rs b/rust/cloud-storage/tools/xtask/src/workflows/steps.rs
index f61e22d852..4dfdc0f70a 100644
--- a/rust/cloud-storage/tools/xtask/src/workflows/steps.rs
+++ b/rust/cloud-storage/tools/xtask/src/workflows/steps.rs
@@ -33,7 +33,7 @@ impl<T> FluentBuilder for Step<T> {}
/// Reference a repo-local composite action (`uses: ./path`). The base
/// `gh-workflow` `uses()` only builds `owner/repo@version`, so we set the raw
/// `uses` field directly. Kept in one place so the workaround is contained.
-fn uses_local(name: &str, path: &str) -> Step<Use> {
+pub(crate) fn uses_local(name: &str, path: &str) -> Step<Use> {
let mut step = Step::new(name).uses("local", "local", "0");
step.value.uses = Some(path.to_string());
step
diff --git a/rust/cloud-storage/tools/xtask/src/workflows/web_app_check_main.rs b/rust/cloud-storage/tools/xtask/src/workflows/web_app_check_main.rs
new file mode 100644
index 0000000000..e26528e86f
--- /dev/null
+++ b/rust/cloud-storage/tools/xtask/src/workflows/web_app_check_main.rs
@@ -0,0 +1,301 @@
+//! `Web App Pr Checks` — frontend PR checks for the web app.
+//! Generated into `web-app-check-main.yml`.
+
+use gh_workflow::{
+ Concurrency, Env, Event, Expression, Job, PullRequest, PullRequestType, Run, Step, Use,
+ Workflow,
+};
+
+use crate::workflows::{
+ runners,
+ steps::{self, FluentBuilder},
+ vars,
+};
+
+const WEB_TYPESCRIPT_RUNNER: &str = "linux-extra-beefy";
+const WEB_DEFAULT_RUNNER: &str = "linux-latest-middy";
+const SCCACHE_BUCKET: &str = "${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}";
+const AWS_ACCESS_KEY_ID: &str = "${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}";
+const AWS_SECRET_ACCESS_KEY: &str = "${{ secrets.AWS_SECRET_ACCESS_KEY }}";
+
+/// Build the workflow.
+pub fn web_app_check_main() -> Workflow {
+ Workflow::new("Web App Pr Checks")
+ .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(
+ "${{ github.workflow }}-${{ github.ref }}-check",
+ ))
+ .cancel_in_progress(true),
+ )
+ .add_job("path-check", path_check())
+ .add_job("typescript", typescript())
+ .add_job("biome-check", biome_check())
+ .add_job("tailwind", tailwind())
+ .add_job("test", test())
+ .add_job("cycles", cycles())
+ .add_job("build", build())
+ .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_output("api_changed", "${{ steps.filter.outputs.api_changed }}")
+ .add_step(checkout("Checkout Repo", false))
+ .add_step(paths_filter())
+}
+
+fn typescript() -> Job {
+ Job::default()
+ .needs(vec!["path-check".to_string()])
+ .cond(Expression::new(
+ "needs.path-check.outputs.should_run == 'true' || needs.path-check.outputs.api_changed == 'true'",
+ ))
+ .name("Typecheck")
+ .runs_on(WEB_TYPESCRIPT_RUNNER)
+ .add_step(checkout("Checkout Repo", false))
+ .add_step(setup_reqs_web("Setup Prereqs", false))
+ .add_step(rust_cache())
+ .add_step(generate_api_types())
+ .add_step(show_sccache_stats())
+ .add_step(check_types())
+}
+
+fn biome_check() -> Job {
+ gated_web_job("Biome Check")
+ .add_step(checkout("Checkout Repo", true))
+ .add_step(setup_cachix_dev_shell())
+ .add_step(run_biome())
+}
+
+fn tailwind() -> Job {
+ gated_web_job("Theme Hygiene Inspector")
+ .add_step(checkout("Checkout Repo", true))
+ .add_step(setup_reqs_web("Setup Prereqs", false))
+ .add_step(check_tailwind_classes())
+}
+
+fn test() -> Job {
+ gated_web_job("Test")
+ .add_step(checkout("Checkout Repo", false))
+ .add_step(setup_reqs_web("Setup", true))
+ .add_step(run_tests())
+}
+
+fn cycles() -> Job {
+ gated_web_job("Cycles Import Check")
+ .add_step(checkout("Checkout", false))
+ .add_step(setup_cachix_dev_shell())
+ .add_step(cycles_import_check())
+}
+
+fn build() -> Job {
+ gated_web_job("Build")
+ .add_step(checkout("Checkout Repo", false))
+ .add_step(setup_reqs_web("Setup", false))
+ .add_step(run_build())
+}
+
+/// Always-run collector used as the required status check. Its name must stay
+/// stable because branch protection can reference it.
+fn status_check() -> Job {
+ Job::default()
+ .name("Web App Status Check")
+ .cond(Expression::new("always()"))
+ .needs(vec![
+ "path-check".to_string(),
+ "typescript".to_string(),
+ "biome-check".to_string(),
+ "tailwind".to_string(),
+ "test".to_string(),
+ "cycles".to_string(),
+ "build".to_string(),
+ ])
+ .runs_on(runners::Runner::Small.to_string())
+ .add_step(check_job_results())
+}
+
+fn gated_web_job(name: &str) -> Job {
+ Job::default()
+ .needs(vec!["path-check".to_string()])
+ .cond(Expression::new(
+ "needs.path-check.outputs.should_run == 'true'",
+ ))
+ .name(name)
+ .runs_on(WEB_DEFAULT_RUNNER)
+}
+
+fn checkout(name: &str, full_history: bool) -> Step<Use> {
+ Step::new(name)
+ .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:
+ - 'js/package.json'
+ - 'js/bun.lock'
+ - 'js/app/package.json'
+ - 'js/app/packages/**'
+ - 'js/app/src/**'
+ - 'js/app/biome.jsonc'
+ - 'js/lexical-core/**'
+ - 'js/lexical-service/**'
+ - '.github/actions/setup-cachix/**'
+ - '.github/actions/setup-reqs-web/**'
+ - '.github/workflows/web-app-check-main.yml'
+ api_changed:
+ - 'rust/cloud-storage/**/*.rs'
+ - 'rust/cloud-storage/Cargo.toml'
+ - 'rust/cloud-storage/Cargo.lock'
+ - 'flake.nix'
+ - 'flake.lock'
+ - 'js/app/scripts/generate-api-schema.ts'
+ - 'js/app/scripts/services.ts'
+ - '.github/actions/setup-cachix/**'
+ - '.github/actions/setup-reqs-web/**'
+ - '.github/workflows/web-app-check-main.yml'
+ "#},
+ ))
+}
+
+fn setup_reqs_web(name: &str, playwright: bool) -> Step<Use> {
+ steps::uses_local(name, "./.github/actions/setup-reqs-web")
+ .add_with(("cachix-auth-token", vars::CACHIX_AUTH_TOKEN))
+ .add_with(("sccache-bucket", SCCACHE_BUCKET))
+ .when(playwright, |step| step.add_with(("playwright", "true")))
+}
+
+fn setup_cachix_dev_shell() -> Step<Use> {
+ steps::uses_local("Setup Nix dev shell", "./.github/actions/setup-cachix")
+ .add_with(("cachix-auth-token", vars::CACHIX_AUTH_TOKEN))
+ .add_with(("dev-shell", "true"))
+ .add_with(("sccache-bucket", SCCACHE_BUCKET))
+}
+
+fn rust_cache() -> Step<Use> {
+ Step::new("Cache Rust")
+ .uses(
+ "Swatinem",
+ "rust-cache",
+ "9d47c6ad4b02e050fd481d890b2ea34778fd09d6",
+ )
+ .if_condition(Expression::new(
+ "needs.path-check.outputs.api_changed == 'true'",
+ ))
+ .add_with(("workspaces", "rust/cloud-storage"))
+ .add_with(("shared-key", "cloud-storage-gen-api"))
+ .add_with(("cache-on-failure", "true"))
+ .add_with(("cache-targets", "true"))
+}
+
+fn generate_api_types() -> Step<Run> {
+ with_aws_env(
+ Step::new("Generate API Types")
+ .run("bun run gen-api -- --check")
+ .if_condition(Expression::new(
+ "needs.path-check.outputs.api_changed == 'true'",
+ ))
+ .working_directory("js/app"),
+ )
+}
+
+fn show_sccache_stats() -> Step<Run> {
+ with_aws_env(
+ Step::new("show sccache stats")
+ .run("sccache --show-stats || true")
+ .if_condition(Expression::new(
+ "always() && needs.path-check.outputs.api_changed == 'true'",
+ )),
+ )
+}
+
+fn with_aws_env(step: Step<Run>) -> Step<Run> {
+ step.add_env(Env::new("AWS_ACCESS_KEY_ID", AWS_ACCESS_KEY_ID))
+ .add_env(Env::new("AWS_SECRET_ACCESS_KEY", AWS_SECRET_ACCESS_KEY))
+}
+
+fn check_types() -> Step<Run> {
+ Step::new("Check Types")
+ .run("bun run --bun --silent tsc --project ./packages/app/tsconfig.json")
+ .working_directory("js/app")
+}
+
+fn run_biome() -> Step<Run> {
+ Step::new("Run Biome")
+ .run("biome ci --changed --no-errors-on-unmatched --error-on-warnings")
+ .working_directory("js/app")
+}
+
+fn check_tailwind_classes() -> Step<Run> {
+ Step::new("Check Tailwind Classes")
+ .run("just check-tailwind")
+ .working_directory("js/app")
+}
+
+fn run_tests() -> Step<Run> {
+ Step::new("Test")
+ .run("bunx vitest")
+ .working_directory("js/app")
+}
+
+fn cycles_import_check() -> Step<Run> {
+ Step::new("Cycles Import Check")
+ .run("biome lint --changed --no-errors-on-unmatched --only=suspicious/noImportCycles")
+ .working_directory("js/app")
+}
+
+fn run_build() -> Step<Run> {
+ Step::new("Build")
+ .run("bun run build")
+ .working_directory("js/app")
+}
+
+fn check_job_results() -> Step<Run> {
+ Step::new("Check job results").run(indoc::indoc! {r#"
+ echo "path-check: ${{ needs.path-check.result }}"
+ echo "typescript: ${{ needs.typescript.result }}"
+ echo "biome-check: ${{ needs.biome-check.result }}"
+ echo "tailwind: ${{ needs.tailwind.result }}"
+ echo "test: ${{ needs.test.result }}"
+ echo "cycles: ${{ needs.cycles.result }}"
+ echo "build: ${{ needs.build.result }}"
+
+ # Fail if any job failed (skipped and success are both OK)
+ if [[ "${{ needs.path-check.result }}" == "failure" ]] || \
+ [[ "${{ needs.typescript.result }}" == "failure" ]] || \
+ [[ "${{ needs.biome-check.result }}" == "failure" ]] || \
+ [[ "${{ needs.tailwind.result }}" == "failure" ]] || \
+ [[ "${{ needs.test.result }}" == "failure" ]] || \
+ [[ "${{ needs.cycles.result }}" == "failure" ]] || \
+ [[ "${{ needs.build.result }}" == "failure" ]]; then
+ echo "One or more jobs failed"
+ exit 1
+ fi
+
+ echo "All jobs passed or were skipped"
+ "#})
+}