From edb86ffe669c65f853b2f7678b1b3b6fc68bd12b Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 15 Apr 2025 07:31:28 +0000 Subject: [PATCH 1/2] build: follow-up fixes to fix CI errors Follow-up fixes to fix CI errors in `main`. --- .github/workflows/ci.material-aio.yml | 24 +++++++++++----- .github/workflows/ci.yml | 2 -- .github/workflows/pr.material-aio.yml | 22 +++++++++++---- .github/workflows/pr.yml | 2 -- docs/BUILD.bazel | 36 +++++++++++++++++++----- scripts/docs-deploy/monitoring/index.mts | 4 +-- 6 files changed, 64 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.material-aio.yml b/.github/workflows/ci.material-aio.yml index cb8f4bc69f54..5f3e95d96ae1 100644 --- a/.github/workflows/ci.material-aio.yml +++ b/.github/workflows/ci.material-aio.yml @@ -18,16 +18,16 @@ defaults: run: shell: bash -env: - # TODO: Remove when pnpm is exclusively used. - ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1' - jobs: lint: runs-on: ubuntu-latest steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Linting @@ -38,11 +38,13 @@ jobs: steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - - name: Execute Direct Production Build (deploy usage) - run: pnpm -s --cwd=docs prod-build - - name: Execute Build via Bazel + - name: Execute Build run: pnpm -s --cwd=docs bazel build //... test: @@ -50,6 +52,10 @@ jobs: steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Tests @@ -67,6 +73,10 @@ jobs: steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Lighthouse Audit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31f776181797..f41042b0b4d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,8 +183,6 @@ jobs: run: pnpm install --frozen-lockfile - name: Run tests run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/... - env: - ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1' - uses: ./.github/actions/slack if: failure() with: diff --git a/.github/workflows/pr.material-aio.yml b/.github/workflows/pr.material-aio.yml index 4c946c5349ff..064be73c02d5 100644 --- a/.github/workflows/pr.material-aio.yml +++ b/.github/workflows/pr.material-aio.yml @@ -1,4 +1,4 @@ -name: 'CI (material.angular.io)' +name: 'PR (material.angular.io)' on: pull_request: @@ -16,16 +16,16 @@ defaults: run: shell: bash -env: - # TODO: Remove when pnpm is exclusively used. - ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1' - jobs: lint: runs-on: ubuntu-latest steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Linting @@ -36,6 +36,10 @@ jobs: steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Build @@ -46,6 +50,10 @@ jobs: steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Tests @@ -63,6 +71,10 @@ jobs: steps: - name: Initialize environment uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel + uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b + - name: Setup Bazel RBE + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Lighthouse Audit diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2fc5ee8ca67e..c65f0bffcbc1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -146,8 +146,6 @@ jobs: run: pnpm install --frozen-lockfile - name: Run tests run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/... - env: - ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1' build: runs-on: ubuntu-latest-16core diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 8e5a86864dc9..558e37aeaf2a 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -1,5 +1,5 @@ load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin") -load("@aspect_rules_js//js:defs.bzl", "js_test") +load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_library", "js_test") load("@npm2//:defs.bzl", "npm_link_all_packages") load("//docs:defs.bzl", "ng_app") @@ -46,14 +46,13 @@ ng_app( ], ) -js_test( - name = "audit", - args = [ - "$(location //docs:build.production)", +js_library( + name = "audit_lib", + srcs = [ + "tools/audit-docs.js", + "tools/lighthouse-audit.mjs", ], data = [ - "tools/lighthouse-audit.mjs", - "//docs:build.production", "//docs:node_modules/light-server", "//docs:node_modules/lighthouse", "//docs:node_modules/lighthouse-logger", @@ -61,6 +60,29 @@ js_test( "//docs:node_modules/shelljs", "@rules_browsers//src/browsers/chromium", ], +) + +js_binary( + name = "audit_tool", + data = [":audit_lib"], + entry_point = "tools/audit-docs.js", + env = { + "CHROMIUM_BIN": "$(CHROME-HEADLESS-SHELL)", + }, + toolchains = [ + "@rules_browsers//src/browsers/chromium:toolchain_alias", + ], +) + +js_test( + name = "audit", + args = [ + "$(location //docs:build.production)", + ], + data = [ + ":audit_lib", + "//docs:build.production", + ], entry_point = "tools/audit-docs.js", env = { "CHROMIUM_BIN": "$(CHROME-HEADLESS-SHELL)", diff --git a/scripts/docs-deploy/monitoring/index.mts b/scripts/docs-deploy/monitoring/index.mts index 72aee8445f7b..a5871683f883 100644 --- a/scripts/docs-deploy/monitoring/index.mts +++ b/scripts/docs-deploy/monitoring/index.mts @@ -9,9 +9,7 @@ import {projectDir, sites} from '../utils.mjs'; * specified remote URL is properly functioning. */ export async function runMonitorTests(remoteUrl: string) { - cd(path.join(projectDir, 'docs')); - - await $`node ./tools/audit-docs.js ${remoteUrl}`; + await $`pnpm bazel run //docs:audit_tool -- ${remoteUrl}`; } /** Runs the monitoring tests for the stable release train. */ From 65eca0099c6f504f340cdd0727d90c2a5184df22 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 15 Apr 2025 08:57:55 +0000 Subject: [PATCH 2/2] build: always run material CI checks We can/should always run these tests. Bazel will use cached results if there are no changes. --- .github/workflows/ci.material-aio.yml | 18 ++++++++---------- .github/workflows/pr.material-aio.yml | 10 ++++------ WORKSPACE | 8 -------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.material-aio.yml b/.github/workflows/ci.material-aio.yml index 5f3e95d96ae1..a9758e5e6318 100644 --- a/.github/workflows/ci.material-aio.yml +++ b/.github/workflows/ci.material-aio.yml @@ -5,8 +5,6 @@ on: branches: - main - '[0-9]+.[0-9]+.x' - paths: - - 'material.angular.io/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -27,11 +25,11 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Linting - run: pnpm --cwd=docs bazel test --test_tag_filters=lint //... + run: pnpm bazel test --test_tag_filters=lint //docs/... build: runs-on: ubuntu-latest @@ -41,11 +39,11 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Build - run: pnpm -s --cwd=docs bazel build //... + run: pnpm -s build //docs/... test: runs-on: ubuntu-latest @@ -55,11 +53,11 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Tests - run: pnpm --cwd=docs bazel test --test_tag_filters=-lint,-e2e,-audit //... + run: pnpm bazel test --test_tag_filters=-lint,-e2e,-audit //docs/... - name: Store Test Logs uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 if: always() @@ -76,11 +74,11 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Lighthouse Audit - run: pnpm -s --cwd=docs bazel test --test_tag_filters=audit //... + run: pnpm -s bazel test --test_tag_filters=audit //docs/... - name: Store Audit Logs uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 if: always() diff --git a/.github/workflows/pr.material-aio.yml b/.github/workflows/pr.material-aio.yml index 064be73c02d5..74ddd6b2a426 100644 --- a/.github/workflows/pr.material-aio.yml +++ b/.github/workflows/pr.material-aio.yml @@ -3,8 +3,6 @@ name: 'PR (material.angular.io)' on: pull_request: types: [opened, synchronize, reopened] - paths: - - 'material.angular.io/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -25,7 +23,7 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Linting @@ -39,7 +37,7 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Build @@ -53,7 +51,7 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Tests @@ -74,7 +72,7 @@ jobs: - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4 + uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - name: Install node modules run: pnpm install --frozen-lockfile - name: Execute Lighthouse Audit diff --git a/WORKSPACE b/WORKSPACE index 7fc3ff17775d..021755625a1c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,14 +3,6 @@ workspace( name = "angular_material", ) -# Point to the nested WORKSPACE we merged from github.com/angular/material.angular.io -# NB: even though this isn't referenced anywhere, it's required for Bazel to know about the -# nested workspace so that wildcard patterns like //... don't descend into it. -local_repository( - name = "material_angular_io", - path = "./material.angular.io", -) - load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Add NodeJS rules