From 4797995b56dfaa1a6ade9a434d780295ed123754 Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:29:49 -0400 Subject: [PATCH] ci: add build_context build to apps modules --- .../workflows/check-code-and-unit-test.yaml | 2 +- apps/admin-panel/BUCK | 109 ++++++++++-------- apps/consent/BUCK | 24 ++-- apps/dashboard/BUCK | 7 ++ apps/map/BUCK | 7 ++ apps/pay/BUCK | 7 ++ 6 files changed, 96 insertions(+), 60 deletions(-) diff --git a/.github/workflows/check-code-and-unit-test.yaml b/.github/workflows/check-code-and-unit-test.yaml index 5b2444980f2..0ad8d3b6473 100644 --- a/.github/workflows/check-code-and-unit-test.yaml +++ b/.github/workflows/check-code-and-unit-test.yaml @@ -49,7 +49,7 @@ jobs: case "$LABEL" in dashboard|consent|pay|admin-panel|map) ARGS+=" //apps/$LABEL:test" - BUILD_ARGS+=" //apps/$LABEL:node_modules" + BUILD_ARGS+=" //apps/$LABEL:eslint_build_context" ;; core) ARGS+=" //core/api:test" diff --git a/apps/admin-panel/BUCK b/apps/admin-panel/BUCK index 49b849499a8..a8387c28b97 100644 --- a/apps/admin-panel/BUCK +++ b/apps/admin-panel/BUCK @@ -1,95 +1,102 @@ load( - "@toolchains//workspace-pnpm:macros.bzl", - "dev_pnpm_task_binary", - "dev_pnpm_task_test", - "build_node_modules", - "next_build", - "next_build_bin", - "eslint", - "audit", + "@toolchains//workspace-pnpm:macros.bzl", + "dev_pnpm_task_binary", + "dev_pnpm_task_test", + "build_node_modules", + "prepare_build_context", + "next_build", + "next_build_bin", + "eslint", + "audit", ) dev_pnpm_task_binary( - name="dev", - command="dev", + name="dev", + command="dev", ) dev_pnpm_task_binary( - name="lint-fix", - command="lint:fix", + name="lint-fix", + command="lint:fix", ) dev_pnpm_task_binary( - name="cypress-open", - command="cypress:open", + name="cypress-open", + command="cypress:open", ) dev_pnpm_task_binary( - name="codegen", - command="codegen", + name="codegen", + command="codegen", ) dev_pnpm_task_test( - name="test-integration", - command="cypress:run", + name="test-integration", + command="cypress:run", ) export_file( - name="package.json", - visibility=["PUBLIC"], + name="package.json", + visibility=["PUBLIC"], ) build_node_modules( - name="node_modules", + name="node_modules", ) filegroup( - name="src", - srcs=glob( - [ - "app/**", - "public/**", - "components/**", - "tailwind.config.ts", - "postcss.config.js", - "next.config.js", - "tsconfig.json", - "*.ts", - "instrumentation.node.ts", - ] - ), + name="src", + srcs=glob( + [ + "app/**", + "public/**", + "components/**", + "tailwind.config.ts", + "postcss.config.js", + "next.config.js", + "tsconfig.json", + "*.ts", + "instrumentation.node.ts", + ] + ), ) next_build( - name="build", - srcs=[":src"], + name="build", + srcs=[":src"], ) next_build_bin( - name="admin-panel", + name="admin-panel", ) dev_deps_srcs = { - "lib/eslint-config": "//lib/eslint-config:src", + "lib/eslint-config": "//lib/eslint-config:src", } audit( - name="audit", - level="critical", + name="audit", + level="critical", +) + +prepare_build_context( + name = "eslint_build_context", + srcs = [":src"] + glob([".eslint*"]), + dev_deps_srcs = dev_deps_srcs, ) eslint( - name="lint", - srcs=[":src"] + glob([".eslint*"]), - extensions=[".ts", ".tsx"], - allow_warnings=True, - dev_deps_srcs=dev_deps_srcs, + name="lint", + srcs=[":src"] + glob([".eslint*"]), + extensions=[".ts", ".tsx"], + allow_warnings=True, + dev_deps_srcs=dev_deps_srcs, ) test_suite( - name="test", - tests=[ - ":audit", - ":lint", - ], + name="test", + tests=[ + ":audit", + ":lint", + ], ) diff --git a/apps/consent/BUCK b/apps/consent/BUCK index 16340a7b181..1ad6405194c 100644 --- a/apps/consent/BUCK +++ b/apps/consent/BUCK @@ -1,11 +1,13 @@ -load("@toolchains//workspace-pnpm:macros.bzl", -"dev_pnpm_task_binary", -"dev_pnpm_task_test", -"build_node_modules", -"next_build", -"next_build_bin", -"eslint", -"audit", +load( + "@toolchains//workspace-pnpm:macros.bzl", + "dev_pnpm_task_binary", + "dev_pnpm_task_test", + "build_node_modules", + "prepare_build_context", + "next_build", + "next_build_bin", + "eslint", + "audit", ) dev_pnpm_task_binary( @@ -82,6 +84,12 @@ audit( level = "critical", ) +prepare_build_context( + name = "eslint_build_context", + srcs = [":src"] + glob([".eslint*"]), + dev_deps_srcs = dev_deps_srcs, +) + eslint( name = "lint", srcs = [":src"] + glob([".eslint*"]), diff --git a/apps/dashboard/BUCK b/apps/dashboard/BUCK index 12d59157c11..99a57428472 100644 --- a/apps/dashboard/BUCK +++ b/apps/dashboard/BUCK @@ -3,6 +3,7 @@ load( "dev_pnpm_task_binary", "dev_pnpm_task_test", "build_node_modules", + "prepare_build_context", "next_build", "next_build_bin", "eslint", @@ -77,6 +78,12 @@ audit( level = "critical", ) +prepare_build_context( + name = "eslint_build_context", + srcs = [":src"] + glob([".eslint*"]), + dev_deps_srcs = dev_deps_srcs, +) + eslint( name = "lint", srcs = [":src"] + glob([".eslint*"]), diff --git a/apps/map/BUCK b/apps/map/BUCK index b904f516a99..551d1ae3a58 100644 --- a/apps/map/BUCK +++ b/apps/map/BUCK @@ -3,6 +3,7 @@ load( "dev_pnpm_task_binary", "dev_pnpm_task_test", "build_node_modules", + "prepare_build_context", "next_build", "next_build_bin", "eslint", @@ -68,6 +69,12 @@ audit( level = "critical", ) +prepare_build_context( + name = "eslint_build_context", + srcs = [":src"] + glob([".eslint*"]), + dev_deps_srcs = dev_deps_srcs, +) + eslint( name = "lint", srcs = [":src"] + glob([".eslint*"]), diff --git a/apps/pay/BUCK b/apps/pay/BUCK index 9aee47c7164..6e18dbf9f1b 100644 --- a/apps/pay/BUCK +++ b/apps/pay/BUCK @@ -3,6 +3,7 @@ load( "dev_pnpm_task_binary", "dev_pnpm_task_test", "build_node_modules", + "prepare_build_context", "next_build", "next_build_bin", "eslint", @@ -95,6 +96,12 @@ audit( level = "critical", ) +prepare_build_context( + name = "eslint_build_context", + srcs = [":src"] + glob([".eslint*"]), + dev_deps_srcs = dev_deps_srcs, +) + eslint( name = "lint", srcs = [":src"] + glob([".eslint*"]),