Skip to content

Commit 47077ca

Browse files
committed
Merge branch 'main' into fix-trapezoid-profile
2 parents c16fc0f + 5592607 commit 47077ca

1,753 files changed

Lines changed: 115692 additions & 26456 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
try-import %workspace%/user.bazelrc
22

3-
common --enable_bzlmod --enable_workspace
3+
common --enable_bzlmod
44
# Resolves to --config=linux on Linux, --config=macos on Mac, --windows on windows
55
common --enable_platform_specific_config
66

77
# Make bazel 8 work for us.
8-
common --enable_workspace
98
build --experimental_cc_static_library
109
build --experimental_cc_shared_library
1110

@@ -20,16 +19,10 @@ test --test_verbose_timeout_warnings
2019
import %workspace%/shared/bazel/compiler_flags/sanitizers.rc
2120
import %workspace%/shared/bazel/compiler_flags/linux_flags.rc
2221
import %workspace%/shared/bazel/compiler_flags/osx_flags.rc
23-
import %workspace%/shared/bazel/compiler_flags/roborio_flags.rc
2422
import %workspace%/shared/bazel/compiler_flags/systemcore_flags.rc
2523
import %workspace%/shared/bazel/compiler_flags/windows_flags.rc
2624
import %workspace%/shared/bazel/compiler_flags/coverage_flags.rc
2725

28-
# Alias toolchain names to what wpilibsuite uses for CI/Artifact naming
29-
build:athena --config=roborio
30-
build:linuxarm32 --config=raspibookworm32
31-
build:linuxarm64 --config=bookworm64
32-
3326
build:build_java --test_tag_filters=allwpilib-build-java --build_tag_filters=allwpilib-build-java
3427
build:build_cpp --test_tag_filters=+allwpilib-build-cpp --build_tag_filters=+allwpilib-build-cpp
3528
build:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example
@@ -44,6 +37,7 @@ build:build_buddy_bes --bes_backend=grpcs://remote.buildbuddy.io
4437
build:common_cache --remote_timeout=3600
4538
build:common_cache --remote_cache_compression
4639
build:common_cache --experimental_remote_cache_compression_threshold=100
40+
common:common_cache --experimental_remote_merkle_tree_cache
4741

4842
# Build Buddy Cache Setup
4943
build:build_buddy --config=common_cache
@@ -62,13 +56,35 @@ build:remote_cache --remote_cache=grpcs://gitlib-bazel.wpi.edu
6256

6357
common:remote_cache_readonly --noremote_upload_local_results
6458

59+
# Stubs for remote execution.
60+
build:remote --strategy=TsProject=remote,sandboxed
61+
build --strategy=CopyFile=remote,standalone
62+
build --strategy=CopyDirectory=remote,standalone
63+
build --strategy=CopyToDirectory=remote,standalone
64+
build --strategy=PyWriteBuildData=remote,standalone
65+
# All tests have a strategy of TestRunner. Enable standalone for only tests.
66+
# See the following for more details:
67+
# https://github.com/bazelbuild/bazel/issues/7480
68+
build:linux --strategy=TestRunner=remote,sandboxed,standalone
69+
build:macos --strategy=TestRunner=remote,sandboxed,standalone
70+
build:linux --strategy=NpmLifecycleHook=remote,sandboxed,standalone
71+
build:macos --strategy=NpmLifecycleHook=remote,sandboxed,standalone
72+
73+
common:remote --config=common_cache
74+
build:remote --incompatible_strict_action_env --experimental_inmemory_dotd_files --experimental_inmemory_jdeps_files --experimental_remote_merkle_tree_cache --incompatible_allow_tags_propagation
75+
# Specify your cluster as follows:
76+
# build:remote --remote_executor=grpcs://engflow.example.com --bes_backend=grpcs://engflow.example.com --bes_results_url=https://engflow.example.com/invocation/
77+
build:remote --jobs=100
78+
build:remote --remote_timeout=1500
79+
build:remote --spawn_strategy=remote,sandboxed
80+
build:remote --grpc_keepalive_time=30s
81+
6582
# This config should be used locally. It downloads more than the CI version
6683
build:remote_user --config=remote_cache
6784
build:remote_user --config=remote_cache_readonly
6885
build:remote_user --remote_download_toplevel
6986

7087
common:ci --color=yes
71-
build:ci --config=remote_cache
7288
build:ci --remote_download_minimal
7389
build:ci --progress_report_interval=60 --show_progress_rate_limit=60
7490

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Setup Bazel Cache'
2+
description: 'Configures the Bazel remote cache. Prefers WPI bazel-remote (R/W), falls back to BuildBuddy, then readonly WPI cache.'
3+
4+
inputs:
5+
bazel_remote_username:
6+
description: 'WPI Bazel remote cache username'
7+
bazel_remote_password:
8+
description: 'WPI Bazel remote cache password'
9+
bazel_remote_url:
10+
description: 'WPI Bazel remote cache base URL (no credentials or protocol, e.g. gitlib-bazel.wpi.edu)'
11+
default: 'gitlib-bazel.wpi.edu'
12+
buildbuddy_token:
13+
description: 'BuildBuddy API token'
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Resolve Bazel cache configuration
19+
env:
20+
CACHE_USER: ${{ inputs.bazel_remote_username }}
21+
CACHE_PASS: ${{ inputs.bazel_remote_password }}
22+
REMOTE_URL: ${{ inputs.bazel_remote_url }}
23+
BB_TOKEN: ${{ inputs.buildbuddy_token }}
24+
shell: bash
25+
run: |
26+
if [ -n "${CACHE_USER}" ] && [ -n "${CACHE_PASS}" ]; then
27+
echo "WPI bazel-remote credentials detected; configuring R/W access"
28+
echo "build:remote_cache --remote_cache=grpcs://${CACHE_USER}:${CACHE_PASS}@${REMOTE_URL}" > bazel_auth.rc
29+
echo "build:ci --config=remote_cache" >> bazel_auth.rc
30+
elif [ -n "${BB_TOKEN}" ]; then
31+
echo "BuildBuddy token detected; configuring BuildBuddy cache"
32+
echo "build:build_buddy --remote_header=x-buildbuddy-api-key=${BB_TOKEN}" > bazel_auth.rc
33+
echo "build:ci --config=build_buddy" >> bazel_auth.rc
34+
else
35+
echo "No cache credentials detected; falling back to readonly WPI cache"
36+
echo "build:ci --config=remote_cache" > bazel_auth.rc
37+
echo "build:ci --config=remote_cache_readonly" >> bazel_auth.rc
38+
fi

.github/actions/setup-bazel-remote/action.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/actions/setup-build-buddy/action.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/bazel.yml

Lines changed: 84 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Bazel
22

3-
on: [pull_request, push]
3+
on: [merge_group, pull_request, push]
44

55
concurrency:
66
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
@@ -12,28 +12,29 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
include:
15-
- { name: "Linux System Core", classifier: "linuxsystemcore", os: ubuntu-24.04, action: "build" }
16-
- { name: "Linux System Core Debug", classifier: "linuxsystemcoredebug", os: ubuntu-24.04, action: "build" }
17-
- { name: "Linux System Core Static", classifier: "linuxsystemcorestatic", os: ubuntu-24.04, action: "build" }
18-
- { name: "Linux System Core Static Debug", classifier: "linuxsystemcorestaticdebug", os: ubuntu-24.04, action: "build" }
19-
- { name: "Linux x86-64", classifier: "linuxx86-64,headers,sources", os: ubuntu-24.04, action: "test" }
20-
- { name: "Linux x86-64 Debug", classifier: "linuxx86-64debug", os: ubuntu-24.04, action: "test" }
21-
- { name: "Linux x86-64 Static", classifier: "linuxx86-64static", os: ubuntu-24.04, action: "test" }
22-
- { name: "Linux x86-64 Static Debug", classifier: "linuxx86-64staticdebug", os: ubuntu-24.04, action: "test" }
15+
- { name: "Linux System Core", classifier: "linuxsystemcore", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
16+
- { name: "Linux System Core Debug", classifier: "linuxsystemcoredebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
17+
- { name: "Linux System Core Static", classifier: "linuxsystemcorestatic", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
18+
- { name: "Linux System Core Static Debug", classifier: "linuxsystemcorestaticdebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
19+
- { name: "Linux x86-64", classifier: "linuxx86-64,headers,sources", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
20+
- { name: "Linux x86-64 Debug", classifier: "linuxx86-64debug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
21+
- { name: "Linux x86-64 Static", classifier: "linuxx86-64static", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
22+
- { name: "Linux x86-64 Static Debug", classifier: "linuxx86-64staticdebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
2323

24-
- { name: "macOS", classifier: "osxuniversal,osxuniversaldebug,headers,sources,osxuniversalstatic,osxuniversalstaticdebug,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug", os: macOS-15, action: "test" }
24+
- { name: "macOS", classifier: "osxuniversal,osxuniversaldebug,headers,sources,osxuniversalstatic,osxuniversalstaticdebug,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug", os: macOS-15, container: "", action: "test" }
2525

26-
- { name: "Windows x86-64", classifier: "windowsx86-64,windowsx86-64static,headers,sources", os: windows-2022, action: "test" }
27-
- { name: "Windows x86-64 Debug", classifier: "windowsx86-64debug,windowsx86-64staticdebug", os: windows-2022, action: "test" }
26+
- { name: "Windows x86-64", classifier: "windowsx86-64,windowsx86-64static,headers,sources", os: windows-2022, container: "", action: "test" }
27+
- { name: "Windows x86-64 Debug", classifier: "windowsx86-64debug,windowsx86-64staticdebug", os: windows-2022, container: "", action: "test" }
2828

29-
- { name: "Windows ARM64", classifier: "windowsarm64,windowsarm64static", os: windows-2022, action: "build" }
30-
- { name: "Windows ARM64 Debug", classifier: "windowsarm64debug,windowsarm64staticdebug", os: windows-2022, action: "build" }
29+
- { name: "Windows ARM64", classifier: "windowsarm64,windowsarm64static", os: windows-2022, container: "", action: "build" }
30+
- { name: "Windows ARM64 Debug", classifier: "windowsarm64debug,windowsarm64staticdebug", os: windows-2022, container: "", action: "build" }
3131

32-
- { name: "Windows System Core", classifier: "linuxsystemcore,linuxsystemcorestatic", os: windows-2022, action: "build" }
33-
- { name: "Windows System Core Debug", classifier: "linuxsystemcoredebug,linuxsystemcorestaticdebug", os: windows-2022, action: "build" }
32+
- { name: "Windows System Core", classifier: "linuxsystemcore,linuxsystemcorestatic", os: windows-2022, container: "", action: "build" }
33+
- { name: "Windows System Core Debug", classifier: "linuxsystemcoredebug,linuxsystemcorestaticdebug", os: windows-2022, container: "", action: "build" }
3434

3535
name: "${{ matrix.action == 'test' && 'Test' || 'Build' }} ${{ matrix.name }}"
3636
runs-on: ${{ matrix.os }}
37+
container: ${{ matrix.container }}
3738
steps:
3839
- name: Check disk free space pre-cleanup
3940
run: df -h
@@ -66,16 +67,23 @@ jobs:
6667
- uses: actions/checkout@v6
6768
with: { fetch-depth: 0 }
6869

69-
- id: Setup_bazel_remote
70-
uses: ./.github/actions/setup-bazel-remote
70+
- id: Setup_bazel_cache
71+
uses: ./.github/actions/setup-bazel-cache
7172
with:
72-
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
73-
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
73+
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
74+
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
75+
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
7476

7577
- name: Install apt dependencies
7678
if: runner.os == 'Linux'
7779
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev avahi-daemon
7880

81+
- name: Setup avahi-daemon
82+
if: runner.os == 'Linux'
83+
run: |
84+
sudo service dbus start
85+
sudo avahi-daemon -D
86+
7987
- if: runner.os == 'Linux'
8088
uses: bazel-contrib/setup-bazel@0.15.0
8189
with:
@@ -106,23 +114,10 @@ jobs:
106114
name: "buildifier"
107115
runs-on: ubuntu-24.04
108116
steps:
109-
- name: Set up Go 1.15.x
110-
uses: actions/setup-go@v6
111-
with:
112-
cache: false
113-
go-version: 1.15.x
114-
id: go
115-
116-
- name: Install Buildifier
117-
run: |
118-
cd $(mktemp -d)
119-
GO111MODULE=on go get github.com/bazelbuild/buildtools/buildifier@6.0.0
120-
121117
- uses: actions/checkout@v6
122-
with: { fetch-depth: 0 }
123118

124119
- name: Run buildifier
125-
run: buildifier -warnings all --lint=fix -r .
120+
run: bazel run //:buildifier.fix
126121

127122
- name: Check Output
128123
run: git --no-pager diff --exit-code HEAD
@@ -165,14 +160,15 @@ jobs:
165160
- uses: actions/checkout@v6
166161
with: { fetch-depth: 0 }
167162

168-
- id: Setup_bazel_remote
169-
uses: ./.github/actions/setup-bazel-remote
163+
- id: Setup_bazel_cache
164+
uses: ./.github/actions/setup-bazel-cache
170165
with:
171-
username: ${{ secrets.BAZEL_CACHE_USERNAME }}
172-
password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
166+
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
167+
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
168+
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
173169

174170
- name: Run Non-RobotPy pregeneration
175-
run: bazel run //:write_pregenerated_files
171+
run: bazel run --config=ci //:write_pregenerated_files
176172

177173
- name: Check Output
178174
run: git --no-pager diff --exit-code HEAD
@@ -194,21 +190,23 @@ jobs:
194190
- uses: actions/checkout@v6
195191
with: { fetch-depth: 0 }
196192

197-
- id: Setup_build_buddy
198-
uses: ./.github/actions/setup-build-buddy
193+
- id: Setup_bazel_cache
194+
uses: ./.github/actions/setup-bazel-cache
199195
with:
200-
token: ${{ secrets.BUILDBUDDY_API_KEY }}
196+
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
197+
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
198+
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
201199

202200
# You should ensure the headers are correct before trying to pregen files
203201
- name: Test Scan Headers
204-
run: bazel test //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
202+
run: bazel test --config=ci //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
205203
shell: bash
206204

207205
- name: Run yaml file generation
208-
run: bazel run //:write_robotpy_update_yaml_files
206+
run: bazel run --config=ci //:write_robotpy_update_yaml_files
209207

210208
- name: Run build file generation
211-
run: bazel run //:write_robotpy_generated_pybind_files
209+
run: bazel run --config=ci //:write_robotpy_generated_pybind_files
212210

213211
- name: Check Output
214212
run: git --no-pager diff --exit-code HEAD
@@ -222,3 +220,44 @@ jobs:
222220
name: robotpy-pregeneration-fixes
223221
path: robotpy-pregeneration.patch
224222
if: ${{ failure() }}
223+
224+
# RobotPy does not want to run the additional python linting that wpiformat
225+
# implements, only the black linter. Here we run black on only the files
226+
# that get transferred to the upstream mostrobotpy repository
227+
robotpy_format:
228+
name: "RobotPy Formatting"
229+
runs-on: ubuntu-24.04
230+
steps:
231+
- uses: actions/checkout@v6
232+
with:
233+
fetch-depth: 0
234+
- name: Set up Python 3.12
235+
uses: actions/setup-python@v6
236+
with:
237+
python-version: '3.12'
238+
- name: Install black
239+
run: |
240+
python -m venv ${{ runner.temp }}/black
241+
# Keep version in sync with .github/workflows/lint-format.yml
242+
${{ runner.temp }}/black/bin/pip3 install black
243+
- name: Run black on RobotPy files
244+
run: |
245+
shopt -s globstar
246+
${{ runner.temp }}/black/bin/black **/src/main/python/**/*.py **/src/test/python/**/*.py robotpyExamples --force-exclude "thirdparty"
247+
- name: Check output
248+
run: git --no-pager diff --exit-code HEAD
249+
- name: Generate diff
250+
run: git diff HEAD > robotpy-format-fixes.patch
251+
if: ${{ failure() }}
252+
- uses: actions/upload-artifact@v7
253+
with:
254+
archive: false
255+
path: robotpy-format-fixes.patch
256+
if: ${{ failure() }}
257+
- name: Write to job summary
258+
run: |
259+
echo '```diff' >> $GITHUB_STEP_SUMMARY
260+
cat robotpy-format-fixes.patch >> $GITHUB_STEP_SUMMARY
261+
echo '' >> $GITHUB_STEP_SUMMARY
262+
echo '```' >> $GITHUB_STEP_SUMMARY
263+
if: ${{ failure() }}

0 commit comments

Comments
 (0)