From ed6e6f5bebabeb79ae504affa139aa04f612eeb7 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Fri, 6 Nov 2026 11:38:11 -0600 Subject: [PATCH] [build] extend the EngFlow cache to Python, Ruby, JavaScript and .NET and write it only from trunk pushes, macOS included --- .bazelrc.remote | 1 + .github/workflows/bazel.yml | 6 +++--- .github/workflows/ci-dotnet.yml | 3 +++ .github/workflows/ci-java.yml | 5 +---- .github/workflows/ci-javascript.yml | 7 +++---- .github/workflows/ci-python.yml | 7 +++---- .github/workflows/ci-ruby.yml | 7 +++---- scripts/github-actions/remote-cache-summary.sh | 13 ++++++++++--- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/.bazelrc.remote b/.bazelrc.remote index 816ceba040520..e1231b7d7f537 100644 --- a/.bazelrc.remote +++ b/.bazelrc.remote @@ -73,6 +73,7 @@ build:rbe --nolegacy_important_outputs build:remote-cache --remote_cache=grpcs://gypsum.cluster.engflow.com build:remote-cache --remote_upload_local_results=false build:remote-cache --experimental_remote_cache_chunking +build:remote-cache --remote_cache_compression build:remote-cache --grpc_keepalive_time=30s build:remote-cache --bes_backend=grpcs://gypsum.cluster.engflow.com build:remote-cache --bes_results_url=https://gypsum.cluster.engflow.com/invocation diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 796a3b665abe0..1de0f3a8a58c2 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -77,7 +77,7 @@ on: type: boolean default: false remote-cache: - description: Read the EngFlow remote cache (the nightly also writes it) + description: Read the EngFlow remote cache (trunk pushes also write it; the nightly does not use it) required: false type: boolean default: false @@ -180,7 +180,7 @@ jobs: bazelisk-cache: true bazelrc: | common --color=yes - ${{ inputs.remote-cache && github.repository_owner == 'SeleniumHQ' && (github.event_name == 'schedule' && 'build --config=remote-cache-write --noremote_accept_cached' || 'build --config=remote-cache') || '' }} + ${{ inputs.remote-cache && github.repository_owner == 'SeleniumHQ' && github.event_name != 'schedule' && (github.event_name == 'push' && 'build --config=remote-cache-write' || 'build --config=remote-cache') || '' }} # Workaround for long path issues: https://github.com/bazelbuild/bazel/pull/22532 output-base: ${{ inputs.os == 'windows' && 'D://b' || '' }} disk-cache: false @@ -260,7 +260,7 @@ jobs: # The following two steps can be removed after collecting data evaluating effectiveness of remote caching - name: Summarize remote cache use id: remote-cache-summary - if: always() && inputs.remote-cache && github.repository_owner == 'SeleniumHQ' + if: always() && inputs.remote-cache && github.repository_owner == 'SeleniumHQ' && github.event_name != 'schedule' continue-on-error: true shell: bash env: diff --git a/.github/workflows/ci-dotnet.yml b/.github/workflows/ci-dotnet.yml index 84ad71b91b001..095c67decdf22 100644 --- a/.github/workflows/ci-dotnet.yml +++ b/.github/workflows/ci-dotnet.yml @@ -18,6 +18,7 @@ on: permissions: contents: read + packages: read jobs: lint: @@ -44,6 +45,7 @@ jobs: os: windows needs-display: true rerun-with-debug: true + remote-cache: true run: | bazel test --local_resources=browser=1 ${{ inputs.compile-manager && '--manager=host' || '' }} //dotnet/test/webdriver:ElementFindingTests-firefox //dotnet/test/webdriver:ElementFindingTests-chrome @@ -55,5 +57,6 @@ jobs: os: windows needs-display: true rerun-with-debug: true + remote-cache: true run: | bazel test --local_resources=browser=1 ${{ inputs.compile-manager && '--manager=host' || '' }} //dotnet/test/remote --flaky_test_attempts=3 diff --git a/.github/workflows/ci-java.yml b/.github/workflows/ci-java.yml index 4356c184e9d9a..251f558f58e67 100644 --- a/.github/workflows/ci-java.yml +++ b/.github/workflows/ci-java.yml @@ -29,9 +29,6 @@ jobs: matrix: os: [windows, macos] tag_filters: ["unit,os-sensitive,se-manager,skip-rbe"] - # macOS runners are scarce, so only use for PRs and nightly runs - exclude: - - os: ${{ github.event_name == 'push' && 'macos' || '' }} include: # Edge has no linux-arm64 build - os: ubuntu-24.04-arm @@ -48,5 +45,5 @@ jobs: ./scripts/github-actions/bazel-test-if-targets.sh --config=gh-browser ${{ inputs.compile-manager && '--manager=host' || '' }} - --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && github.event_name == 'pull_request' && ',-edge' || '' }} + --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && (github.event_name == 'pull_request' || github.event_name == 'push') && ',-edge' || '' }} --target_pattern_file=bazel-targets-java.txt diff --git a/.github/workflows/ci-javascript.yml b/.github/workflows/ci-javascript.yml index cd2a81d7b733a..e10c78f6e7f4f 100644 --- a/.github/workflows/ci-javascript.yml +++ b/.github/workflows/ci-javascript.yml @@ -28,6 +28,7 @@ on: permissions: contents: read + packages: read # RBE runs the Linux x86_64 tests; these jobs cover macOS and Windows. jobs: @@ -64,21 +65,19 @@ jobs: matrix: os: [macos, windows] tag_filters: ['unit,os-sensitive,se-manager'] - # macOS runners are scarce, so only use for PRs and nightly runs - exclude: - - os: ${{ github.event_name == 'push' && 'macos' || '' }} with: name: ${{ matrix.os }} needs-display: true os: ${{ matrix.os }} rerun-with-debug: true + remote-cache: true download-artifact-name: targets run: > [ -s bazel-targets-js.txt ] || echo //javascript/selenium-webdriver/... > bazel-targets-js.txt; ./scripts/github-actions/bazel-test-if-targets.sh --config=gh-browser ${{ inputs.compile-manager && '--manager=host' || '' }} - --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && github.event_name == 'pull_request' && ',-edge' || '' }} + --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && (github.event_name == 'pull_request' || github.event_name == 'push') && ',-edge' || '' }} --target_pattern_file=bazel-targets-js.txt os-tests-full: diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 4b995facbebe6..882ff7ade3037 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -28,6 +28,7 @@ on: permissions: contents: read + packages: read # Two tiers, mutually exclusive by content. `smoke` runs on every event, including # schedule, so the schedule-only flaky parser sees it. The full jobs run on schedule @@ -83,21 +84,19 @@ jobs: matrix: os: [windows, macos] tag_filters: ["unit,os-sensitive,se-manager,skip-rbe"] - # macOS runners are scarce, so only use for PRs and nightly runs - exclude: - - os: ${{ github.event_name == 'push' && 'macos' || '' }} with: name: ${{ matrix.os }} needs-display: true os: ${{ matrix.os }} rerun-with-debug: true + remote-cache: true download-artifact-name: targets run: > [ -s bazel-targets-py.txt ] || echo //py/... > bazel-targets-py.txt; ./scripts/github-actions/bazel-test-if-targets.sh --config=gh-browser ${{ inputs.compile-manager && '--manager=host' || '' }} - --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && github.event_name == 'pull_request' && ',-edge' || '' }} + --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && (github.event_name == 'pull_request' || github.event_name == 'push') && ',-edge' || '' }} --target_pattern_file=bazel-targets-py.txt browser-tests: diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 2e32c4fe41f76..8f184e50bdaa6 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -28,6 +28,7 @@ on: permissions: contents: read + packages: read jobs: build: @@ -80,9 +81,6 @@ jobs: matrix: os: [windows, macos] tag_filters: ["unit,os-sensitive,se-manager,skip-rbe"] - # macOS runners are scarce, so only use for PRs and nightly runs - exclude: - - os: ${{ github.event_name == 'push' && 'macos' || '' }} include: # Edge has no linux-arm64 build - os: ubuntu-24.04-arm @@ -92,6 +90,7 @@ jobs: needs-display: true os: ${{ matrix.os }} rerun-with-debug: true + remote-cache: true download-artifact-name: targets run: > [ -s bazel-targets-rb.txt ] || echo //rb/... > bazel-targets-rb.txt; @@ -99,7 +98,7 @@ jobs: --config=gh-browser ${{ inputs.compile-manager && contains(matrix.tag_filters, 'se-manager') && '--manager=host' || '' }} --test_env=SKIP_PENDING=true - --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && github.event_name == 'pull_request' && ',-edge' || '' }} + --test_tag_filters=${{ matrix.tag_filters }}${{ matrix.os == 'macos' && (github.event_name == 'pull_request' || github.event_name == 'push') && ',-edge' || '' }} --target_pattern_file=bazel-targets-rb.txt os-tests-full: diff --git a/scripts/github-actions/remote-cache-summary.sh b/scripts/github-actions/remote-cache-summary.sh index f54788f2b30e9..eb782b02c95f2 100755 --- a/scripts/github-actions/remote-cache-summary.sh +++ b/scripts/github-actions/remote-cache-summary.sh @@ -25,7 +25,7 @@ awk "$strip"' [ -f build/bazel-console.log ] || exit 0 -IFS=$'\t' read -r invocation breakdown hits executed elapsed tests cached < <(awk "$strip"' +IFS=$'\t' read -r invocation breakdown hits executed elapsed tests cached binding < <(awk "$strip"' /Streaming build results to: / && !url { sub(/.*Streaming build results to: /, ""); url = $0 } /^INFO: [0-9]+ process(es)?: / { breakdown = $0; sub(/^INFO: /, "", breakdown); sub(/\.$/, "", breakdown) @@ -37,10 +37,16 @@ IFS=$'\t' read -r invocation breakdown hits executed elapsed tests cached < <(aw } } /^INFO: Elapsed time: / { elapsed = $4; sub(/s,?$/, "", elapsed) } - $1 ~ /^\/\// && / PASSED in / { tests++; if ($2 == "(cached)") cached++ } - END { printf "%s\t%s\t%d\t%d\t%s\t%d\t%d\n", (url ? url : "-"), (breakdown ? breakdown : "-"), hits, executed, (elapsed ? elapsed : 0), tests, cached } + $1 ~ /^\/\// && / PASSED in / { + tests++; if ($2 == "(cached)") cached++ + b = $1; sub(/^\/\//, "", b); sub(/[\/:].*/, "", b) + if (++count[b] > top) { top = count[b]; binding = b } + } + END { printf "%s\t%s\t%d\t%d\t%s\t%d\t%d\t%s\n", (url ? url : "-"), (breakdown ? breakdown : "-"), hits, executed, (elapsed ? elapsed : 0), tests, cached, (binding ? binding : "-") } ' build/bazel-console.log) +[ "$tests" -gt 0 ] || exit 0 + mkdir -p build/remote-cache jq -cn \ --arg recorded_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ @@ -48,6 +54,7 @@ jq -cn \ --arg run_attempt "${GITHUB_RUN_ATTEMPT:-}" \ --arg event "${GITHUB_EVENT_NAME:-}" \ --arg job "${JOB_NAME:-}" \ + --arg binding "$binding" \ --arg os "${RUNNER_OS:-}-${RUNNER_ARCH:-}" \ --arg pr "${PR_NUMBER:-}" \ --arg sha "${GITHUB_SHA:-}" \