Skip to content

Commit e3520bc

Browse files
authored
ci: move full tests and cross-platform builds to BuildBuddy (#119)
Move full root and example tests to BuildBuddy RBE. Cross-build rule outputs for all five supported target platforms; keep native macOS, Windows, and Linux ARM64 smoke tests in Actions. The active `main` ruleset now requires both BuildBuddy checks, the smoke aggregate, and Verify Hooks. Removed its stale Trunk bypass because GitHub rejected ruleset updates with that uninstalled app. Validation: all required checks passed on this head, including authenticated BuildBuddy runs and native smoke tests. Local suites, 15 cross-platform builds, Linux execution-toolchain analysis, actionlint, buildifier, shell syntax, and smoke-gate failure cases also passed.
1 parent d355b0d commit e3520bc

9 files changed

Lines changed: 163 additions & 52 deletions

File tree

‎.bazelrc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ common --config=ruleset
1111
# Take care to document any settings that you expect users to apply.
1212
# Settings that apply only to CI are in .github/workflows/ci.bazelrc
1313

14+
import %workspace%/tools/buildbuddy.bazelrc
15+
1416
# Load any settings specific to the current user.
1517
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
1618
# This needs to be last statement in this

‎.github/workflows/ci.yaml‎

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,28 @@ on:
44
branches: [main]
55
pull_request:
66
branches: [main]
7+
merge_group:
78
workflow_dispatch:
89
concurrency:
910
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1011
cancel-in-progress: ${{ github.ref_name != 'main' }}
1112
jobs:
12-
test:
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
os: [ubuntu-latest, macos-latest]
17-
folder:
18-
- "."
19-
- "examples/simple"
20-
- "examples/aggregate"
21-
runs-on: ${{ matrix.os }}
13+
macos-cli-smoke:
14+
runs-on: macos-latest
2215
steps:
2316
- uses: actions/checkout@v7
2417
- uses: bazel-contrib/setup-bazel@0.19.0
2518
with:
2619
bazelisk-cache: true
27-
disk-cache: ${{ github.workflow }}
20+
disk-cache: ${{ github.workflow }}-macos
2821
repository-cache: true
2922

30-
- name: Test ${{ matrix.folder }}
31-
working-directory: ${{ matrix.folder }}
32-
run: bazel test //...
33-
34-
- name: Run FormatJS CLI from a consumer workspace
35-
if: matrix.folder == 'examples/simple'
36-
working-directory: ${{ matrix.folder }}
23+
- name: Run macOS CLI from a consumer workspace
24+
working-directory: examples/simple
3725
run: bazel run @rules_formatjs//cli -- --version
3826

39-
- name: Upload test logs
40-
if: failure()
41-
uses: actions/upload-artifact@v7
42-
with:
43-
name: test-logs-${{ matrix.os }}-${{ hashFiles(matrix.folder) }}
44-
path: |
45-
${{ matrix.folder }}/bazel-testlogs/**/test.log
46-
${{ matrix.folder }}/bazel-testlogs/**/test.xml
47-
if-no-files-found: warn
48-
retention-days: 7
27+
- name: Smoke test extraction and compilation
28+
run: bazel test //tests/arguments:test_fixtures_0_test //tests/arguments:test_fixtures_1_test
4929

5030
linux-arm64-smoke:
5131
runs-on: ubuntu-24.04-arm
@@ -94,3 +74,13 @@ jobs:
9474
- name: Extract messages from a large source list
9575
shell: bash
9676
run: bazel test //tests/arguments:large_source_list_test
77+
78+
ci:
79+
if: always()
80+
needs: [macos-cli-smoke, linux-arm64-smoke, windows-cli-smoke]
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Require every native smoke test
84+
env:
85+
RESULTS: ${{ toJSON(needs) }}
86+
run: jq -e 'all(.[]; .result == "success")' <<< "$RESULTS"

‎.github/workflows/verify-hooks.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches: [main]
55
pull_request:
66
branches: [main]
7+
merge_group:
78
jobs:
89
verify-hooks:
910
runs-on: ubuntu-latest

‎buildbuddy.yaml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
actions:
2+
- name: "Test all targets"
3+
container_image: "ubuntu-20.04"
4+
triggers:
5+
push:
6+
branches: ["main", "gh-readonly-queue/*"]
7+
pull_request:
8+
branches: ["main"]
9+
resource_requests:
10+
memory: 4GB
11+
disk: 16GB
12+
steps:
13+
- run: |
14+
set -euo pipefail
15+
for workspace in . examples/simple examples/aggregate; do
16+
(
17+
cd "$workspace"
18+
bazel test --config=bb-workflow //...
19+
bazel run --config=bb-workflow @rules_formatjs//cli -- --version
20+
)
21+
done
22+
23+
- name: "Cross-build all platforms"
24+
container_image: "ubuntu-20.04"
25+
triggers:
26+
push:
27+
branches: ["main", "gh-readonly-queue/*"]
28+
pull_request:
29+
branches: ["main"]
30+
resource_requests:
31+
memory: 4GB
32+
disk: 16GB
33+
steps:
34+
# FormatJS CLI runs on the execution platform, regardless of target platform.
35+
- run: |
36+
set -euo pipefail
37+
for workspace in . examples/simple examples/aggregate; do
38+
(
39+
cd "$workspace"
40+
bazel query 'kind("formatjs_(extract|compile|aggregate|cli_executable) rule", //...)' > /tmp/formatjs-cross-targets
41+
mapfile -t targets < /tmp/formatjs-cross-targets
42+
test "${#targets[@]}" -gt 0
43+
for platform in linux_x86_64 linux_aarch64 macos_x86_64 macos_aarch64 windows_x86_64; do
44+
bazel build --config=bb-workflow \
45+
--platforms="@rules_formatjs//platforms:$platform" "${targets[@]}"
46+
done
47+
)
48+
done

‎docs/ci.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# CI
2+
3+
BuildBuddy runs full tests in the root workspace, `examples/simple`, and
4+
`examples/aggregate`. A separate action cross-builds extraction, compilation,
5+
aggregation, and CLI targets for Linux x64/ARM64, macOS x64/ARM64, and Windows x64.
6+
The CLI is prebuilt; these builds check target-platform independence while
7+
running build tools on Linux.
8+
9+
GitHub Actions runs native CLI smoke tests on macOS, Windows, and Linux ARM64.
10+
Windows also checks extraction from a large source list.
11+
12+
Link `formatjs/rules_formatjs` in the FormatJS BuildBuddy organization's Workflows
13+
page. Workflow authentication comes from BuildBuddy; GitHub Actions needs no
14+
BuildBuddy secret.
15+
16+
The active `main` ruleset requires these checks:
17+
18+
- `Test all targets` (BuildBuddy app, ID 317600)
19+
- `Cross-build all platforms` (BuildBuddy app, ID 317600)
20+
- `ci` (GitHub Actions, ID 15368; requires every native smoke job)
21+
- `verify-hooks` (GitHub Actions, ID 15368)
22+
23+
Keep these names in sync with workflow files and repository settings. Missing,
24+
failed, cancelled, or skipped native jobs cannot pass the `ci` gate. Both CI
25+
systems also handle merge-queue commits.

‎examples/aggregate/.bazelrc‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,7 @@ build --experimental_profile_include_target_label
1616
build --experimental_profile_include_primary_output
1717
common --bes_upload_mode=fully_async
1818

19-
# BuildBuddy CI configuration
20-
# https://www.buildbuddy.io/docs/rbe-github-actions
21-
build:ci --build_metadata=ROLE=CI
22-
build:ci --build_metadata=VISIBILITY=PUBLIC
23-
build:ci --config=remote
24-
25-
build:remote --bes_backend=grpcs://formatjs.buildbuddy.io
26-
build:remote --bes_results_url=https://formatjs.buildbuddy.io/invocation/
27-
build:remote --define=EXECUTOR=remote
28-
build:remote --jobs=50
29-
build:remote --remote_cache=grpcs://formatjs.buildbuddy.io
30-
build:remote --remote_timeout=10m
19+
import %workspace%/../../tools/buildbuddy.bazelrc
3120

3221
# Try to import a user-specific .bazelrc
3322
try-import %workspace%/.bazelrc.user

‎examples/simple/.bazelrc‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,7 @@ build --experimental_profile_include_target_label
1616
build --experimental_profile_include_primary_output
1717
common --bes_upload_mode=fully_async
1818

19-
# BuildBuddy CI configuration
20-
# https://www.buildbuddy.io/docs/rbe-github-actions
21-
build:ci --build_metadata=ROLE=CI
22-
build:ci --build_metadata=VISIBILITY=PUBLIC
23-
build:ci --config=remote
24-
25-
build:remote --bes_backend=grpcs://formatjs.buildbuddy.io
26-
build:remote --bes_results_url=https://formatjs.buildbuddy.io/invocation/
27-
build:remote --define=EXECUTOR=remote
28-
build:remote --jobs=50
29-
build:remote --remote_cache=grpcs://formatjs.buildbuddy.io
30-
build:remote --remote_timeout=10m
19+
import %workspace%/../../tools/buildbuddy.bazelrc
3120

3221
# Try to import a user-specific .bazelrc
3322
try-import %workspace%/.bazelrc.user

‎platforms/BUILD.bazel‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
platform(
4+
name = "buildbuddy_linux_x86_64",
5+
constraint_values = [
6+
"@platforms//cpu:x86_64",
7+
"@platforms//os:linux",
8+
],
9+
exec_properties = {
10+
"Arch": "amd64",
11+
"OSFamily": "Linux",
12+
"container-image": "docker://gcr.io/flame-public/rbe-ubuntu22-04:latest",
13+
},
14+
)
15+
16+
platform(
17+
name = "linux_x86_64",
18+
constraint_values = [
19+
"@platforms//cpu:x86_64",
20+
"@platforms//os:linux",
21+
],
22+
)
23+
24+
platform(
25+
name = "linux_aarch64",
26+
constraint_values = [
27+
"@platforms//cpu:aarch64",
28+
"@platforms//os:linux",
29+
],
30+
)
31+
32+
platform(
33+
name = "macos_x86_64",
34+
constraint_values = [
35+
"@platforms//cpu:x86_64",
36+
"@platforms//os:osx",
37+
],
38+
)
39+
40+
platform(
41+
name = "macos_aarch64",
42+
constraint_values = [
43+
"@platforms//cpu:aarch64",
44+
"@platforms//os:osx",
45+
],
46+
)
47+
48+
platform(
49+
name = "windows_x86_64",
50+
constraint_values = [
51+
"@platforms//cpu:x86_64",
52+
"@platforms//os:windows",
53+
],
54+
)

‎tools/buildbuddy.bazelrc‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Shared with consumer workspaces via --bazelrc.
2+
build:bb-workflow --build_metadata=ROLE=BB_WORKFLOW
3+
build:bb-workflow --build_metadata=VISIBILITY=PUBLIC
4+
build:bb-workflow --config=rbe
5+
6+
build:rbe --extra_execution_platforms=@rules_formatjs//platforms:buildbuddy_linux_x86_64
7+
build:rbe --platforms=@rules_formatjs//platforms:buildbuddy_linux_x86_64
8+
build:rbe --bes_backend=grpcs://formatjs.buildbuddy.io
9+
build:rbe --bes_results_url=https://formatjs.buildbuddy.io/invocation/
10+
build:rbe --remote_cache=grpcs://formatjs.buildbuddy.io
11+
build:rbe --remote_executor=grpcs://formatjs.buildbuddy.io
12+
build:rbe --remote_timeout=10m
13+
build:rbe --jobs=50

0 commit comments

Comments
 (0)