-
Notifications
You must be signed in to change notification settings - Fork 731
263 lines (220 loc) · 9.95 KB
/
Copy pathbazel.yml
File metadata and controls
263 lines (220 loc) · 9.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
name: Bazel
on: [merge_group, pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { name: "Linux System Core", classifier: "linuxsystemcore", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux System Core Debug", classifier: "linuxsystemcoredebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux System Core Static", classifier: "linuxsystemcorestatic", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux System Core Static Debug", classifier: "linuxsystemcorestaticdebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux x86-64", classifier: "linuxx86-64,headers,sources", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "Linux x86-64 Debug", classifier: "linuxx86-64debug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "Linux x86-64 Static", classifier: "linuxx86-64static", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "Linux x86-64 Static Debug", classifier: "linuxx86-64staticdebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "macOS", classifier: "osxuniversal,osxuniversaldebug,headers,sources,osxuniversalstatic,osxuniversalstaticdebug,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug", os: macOS-15, container: "", action: "test" }
- { name: "Windows x86-64", classifier: "windowsx86-64,windowsx86-64static,headers,sources", os: windows-2025, container: "", action: "test" }
- { name: "Windows x86-64 Debug", classifier: "windowsx86-64debug,windowsx86-64staticdebug", os: windows-2025, container: "", action: "test" }
- { name: "Windows ARM64", classifier: "windowsarm64,windowsarm64static", os: windows-2025, container: "", action: "build" }
- { name: "Windows ARM64 Debug", classifier: "windowsarm64debug,windowsarm64staticdebug", os: windows-2025, container: "", action: "build" }
- { name: "Windows System Core", classifier: "linuxsystemcore,linuxsystemcorestatic", os: windows-2025, container: "", action: "build" }
- { name: "Windows System Core Debug", classifier: "linuxsystemcoredebug,linuxsystemcorestaticdebug", os: windows-2025, container: "", action: "build" }
name: "${{ matrix.action == 'test' && 'Test' || 'Build' }} ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Check disk free space pre-cleanup
run: df -h
- name: Free disk space (Linux)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Free disk space (macOS)
if: runner.os == 'macOS'
# CodeQL: 5G
# go: 748M
# Android: 12G
run: |
rm -rf /Users/runner/hostedtoolcache/CodeQL
rm -rf /Users/runner/hostedtoolcache/go
rm -rf /Users/runner/Library/Android
- name: Check disk free space post-cleanup
run: df -h
- uses: actions/checkout@v7
with: { fetch-depth: 0 }
- id: Setup_bazel_cache
uses: ./.github/actions/setup-bazel-cache
with:
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Install apt dependencies
if: runner.os == 'Linux'
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
- name: Setup avahi-daemon
if: runner.os == 'Linux'
run: |
sudo service dbus start
sudo avahi-daemon -D
- if: runner.os == 'Linux'
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
repository-cache: true
bazelisk-version: 1.x
- name: bazel ${{ matrix.action }}
run: |
ACTION='${{ matrix.action }}'
if [ "${ACTION}" = "build" ]; then
TARGETS=:publish
else
TARGETS=...
fi
if [ "${{ runner.os }}" = "Windows" ]; then
bazel --output_user_root=D:\\bazelroot ${ACTION} ${TARGETS} --config=ci -c opt --repo_env=WPI_PUBLISH_CLASSIFIER_FILTER='${{ matrix.classifier }}'
else
bazel ${ACTION} ${TARGETS} --config=ci -c opt --repo_env=WPI_PUBLISH_CLASSIFIER_FILTER='${{ matrix.classifier }}'
fi
shell: bash
- name: Check disk free space
if: always()
run: df -h
buildifier:
name: "buildifier"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Run buildifier
run: bazel run //:buildifier.fix
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > ${{ matrix.platform }}-bazel-lint-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
archive: false
path: "*-bazel-lint-fixes.patch"
if: ${{ failure() }}
mod-lock:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Check lockfile
run: bazel mod deps --lockfile_mode=error
- run: bazel mod deps --lockfile_mode=update
if: ${{ failure() }}
- name: Generate diff
run: git diff HEAD > bazel-mod-lock-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
archive: false
path: "bazel-mod-lock-fixes.patch"
if: ${{ failure() }}
non_robotpy_pregeneration:
name: "Non-RobotPy Pregen"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with: { fetch-depth: 0 }
- id: Setup_bazel_cache
uses: ./.github/actions/setup-bazel-cache
with:
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Run Non-RobotPy pregeneration
run: bazel run --config=ci //:write_pregenerated_files
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > non-robotpy-pregeneration.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
name: non-robotpy-pregeneration-fixes
path: non-robotpy-pregeneration.patch
if: ${{ failure() }}
robotpy_pregeneration:
name: "Robotpy Pregeneration"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with: { fetch-depth: 0 }
- id: Setup_bazel_cache
uses: ./.github/actions/setup-bazel-cache
with:
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
# You should ensure the headers are correct before trying to pregen files
- name: Test Scan Headers
run: bazel test --config=ci //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
shell: bash
- name: Run yaml file generation
run: bazel run --config=ci //:write_robotpy_update_yaml_files
- name: Run build file generation
run: bazel run --config=ci //:write_robotpy_generated_pybind_files
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > robotpy-pregeneration.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
name: robotpy-pregeneration-fixes
path: robotpy-pregeneration.patch
if: ${{ failure() }}
# RobotPy does not want to run the additional python linting that wpiformat
# implements, only the black linter. Here we run black on only the files
# that get transferred to the upstream mostrobotpy repository
robotpy_format:
name: "RobotPy Formatting"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install black
run: |
python -m venv ${{ runner.temp }}/black
# Keep version in sync with .github/workflows/lint-format.yml
${{ runner.temp }}/black/bin/pip3 install black
- name: Run black on RobotPy files
run: |
shopt -s globstar
${{ runner.temp }}/black/bin/black **/src/main/python/**/*.py **/src/test/python/**/*.py robotpyExamples --force-exclude "thirdparty"
- name: Check output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > robotpy-format-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
archive: false
path: robotpy-format-fixes.patch
if: ${{ failure() }}
- name: Write to job summary
run: |
echo '```diff' >> $GITHUB_STEP_SUMMARY
cat robotpy-format-fixes.patch >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if: ${{ failure() }}