Skip to content

Commit 1ee203b

Browse files
mkruskal-googlezhangskz
authored andcommitted
Migrate bazel tests to protobuf-ci.
This will allow them to reuse our bazelrc and remote caching setup. This also silences the non-bzlmod windows test that's hitting the windows path length. PiperOrigin-RevId: 626390416
1 parent 58aab31 commit 1ee203b

14 files changed

+172
-123
lines changed

.github/workflows/staleness_check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
if: ${{ github.event.repository.full_name == 'protocolbuffers/protobuf' }}
2727
steps:
2828
- name: Checkout ${{ github.head_ref && 'PR' || matrix.branch }}
29-
uses: protocolbuffers/protobuf-ci/checkout@v2
29+
uses: protocolbuffers/protobuf-ci/checkout@v3
3030
with:
3131
ref: ${{ inputs.safe-checkout || github.head_ref || matrix.branch }}
3232

@@ -49,7 +49,7 @@ jobs:
4949
# In branches where automatic updates work as post-submits, we don't want to run staleness
5050
# tests along with user changes. Any stale files will be automatically fixed in a follow-up
5151
# commit.
52-
uses: protocolbuffers/protobuf-ci/bazel@v2
52+
uses: protocolbuffers/protobuf-ci/bazel@v3
5353
with:
5454
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
5555
bazel-cache: staleness

.github/workflows/test_bazel.yml

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,56 @@
1-
name: Bazel
1+
name: Bazel Tests
22

3-
# Controls when the action will run.
43
on:
5-
# Triggers the workflow on push or pull request events but only for the main branch
6-
push:
7-
branches: [main]
8-
pull_request:
9-
branches: [main]
10-
# Allows you to run this workflow manually from the Actions tab
11-
workflow_dispatch:
4+
workflow_call:
5+
inputs:
6+
safe-checkout:
7+
required: true
8+
description: "The SHA key for the commit we want to run over"
9+
type: string
1210

13-
concurrency:
14-
# Cancel previous actions from the same PR or branch except 'main' branch.
15-
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
16-
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
17-
cancel-in-progress: ${{ github.ref_name != 'main' }}
11+
permissions:
12+
contents: read
1813

1914
jobs:
20-
test:
21-
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6
22-
with:
23-
folders: '["examples"]'
15+
examples:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
runner: [ ubuntu, windows, macos ]
20+
bazelversion: [ '7.1.1' ]
21+
bzlmod: [true, false ]
22+
include:
23+
- runner: ubuntu
24+
bazelversion: '6.4.0'
25+
bzlmod: true
26+
- runner: ubuntu
27+
bazelversion: '6.4.0'
28+
bzlmod: false
29+
runs-on: ${{ matrix.runner }}-latest
30+
name: Examples ${{ matrix.runner }} ${{ matrix.bazelversion }}${{ matrix.bzlmod && ' (bzlmod)' || '' }}
31+
steps:
32+
- name: Checkout pending changes
33+
uses: protocolbuffers/protobuf-ci/checkout@v3
34+
with:
35+
ref: ${{ inputs.safe-checkout }}
36+
37+
- name: Windows startup flags
38+
if: runner.os == 'Windows'
39+
working-directory: examples
40+
shell: bash
41+
run: echo "startup --output_user_root=C:/ --windows_enable_symlinks" >> .bazelrc
42+
43+
- name: Configure Bazel version
44+
working-directory: examples
45+
shell: bash
46+
run: echo "${{ matrix.bazelversion }}" > .bazelversion
47+
48+
- name: Run tests
49+
uses: protocolbuffers/protobuf-ci/bazel@v3
50+
# TODO Silence this until we have a fix.
51+
if: runner.os != 'Windows' || matrix.bzlmod
52+
with:
53+
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
54+
bazel-cache: examples
55+
version: ${{ matrix.bazelversion }}
56+
bash: cd examples && bazel build //... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }}

.github/workflows/test_cpp.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ jobs:
4343
runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }}
4444
steps:
4545
- name: Checkout pending changes
46-
uses: protocolbuffers/protobuf-ci/checkout@v2
46+
uses: protocolbuffers/protobuf-ci/checkout@v3
4747
with:
4848
ref: ${{ inputs.safe-checkout }}
4949
- name: Run tests
50-
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
50+
uses: protocolbuffers/protobuf-ci/bazel-docker@v3
5151
with:
5252
image: ${{ matrix.image }}
5353
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -63,11 +63,11 @@ jobs:
6363
runs-on: ubuntu-latest
6464
steps:
6565
- name: Checkout pending changes
66-
uses: protocolbuffers/protobuf-ci/checkout@v2
66+
uses: protocolbuffers/protobuf-ci/checkout@v3
6767
with:
6868
ref: ${{ inputs.safe-checkout }}
6969
- name: Run tests
70-
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
70+
uses: protocolbuffers/protobuf-ci/bazel-docker@v3
7171
with:
7272
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:${{ matrix.version }}-6.3.0-63dd26c0c7a808d92673a3e52e848189d4ab0f17
7373
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -83,24 +83,24 @@ jobs:
8383
runs-on: ubuntu-latest
8484
steps:
8585
- name: Checkout pending changes
86-
uses: protocolbuffers/protobuf-ci/checkout@v2
86+
uses: protocolbuffers/protobuf-ci/checkout@v3
8787
with:
8888
ref: ${{ inputs.safe-checkout }}
8989
submodules: recursive
9090
- name: Cross compile protoc for ${{ matrix.arch }}
9191
id: cross-compile
92-
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v2
92+
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3
9393
with:
9494
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d
9595
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
9696
architecture: linux-${{ matrix.arch }}
9797
- name: Setup sccache
98-
uses: protocolbuffers/protobuf-ci/sccache@v2
98+
uses: protocolbuffers/protobuf-ci/sccache@v3
9999
with:
100100
cache-prefix: linux-release-${{ matrix.arch }}
101101
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
102102
- name: Run tests
103-
uses: protocolbuffers/protobuf-ci/docker@v2
103+
uses: protocolbuffers/protobuf-ci/docker@v3
104104
with:
105105
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:${{ matrix.arch }}-63dd26c0c7a808d92673a3e52e848189d4ab0f17
106106
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -135,18 +135,18 @@ jobs:
135135
runs-on: ubuntu-latest
136136
steps:
137137
- name: Checkout pending changes
138-
uses: protocolbuffers/protobuf-ci/checkout@v2
138+
uses: protocolbuffers/protobuf-ci/checkout@v3
139139
with:
140140
ref: ${{ inputs.safe-checkout }}
141141

142142
- name: Setup sccache
143-
uses: protocolbuffers/protobuf-ci/sccache@v2
143+
uses: protocolbuffers/protobuf-ci/sccache@v3
144144
with:
145145
cache-prefix: linux-cmake
146146
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
147147

148148
- name: Run tests
149-
uses: protocolbuffers/protobuf-ci/docker@v2
149+
uses: protocolbuffers/protobuf-ci/docker@v3
150150
with:
151151
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-63dd26c0c7a808d92673a3e52e848189d4ab0f17
152152
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -160,19 +160,19 @@ jobs:
160160
runs-on: ubuntu-latest
161161
steps:
162162
- name: Checkout pending changes
163-
uses: protocolbuffers/protobuf-ci/checkout@v2
163+
uses: protocolbuffers/protobuf-ci/checkout@v3
164164
with:
165165
ref: ${{ inputs.safe-checkout }}
166166
submodules: recursive
167167

168168
- name: Setup sccache
169-
uses: protocolbuffers/protobuf-ci/sccache@v2
169+
uses: protocolbuffers/protobuf-ci/sccache@v3
170170
with:
171171
cache-prefix: linux-cmake-install
172172
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
173173

174174
- name: Run tests
175-
uses: protocolbuffers/protobuf-ci/docker@v2
175+
uses: protocolbuffers/protobuf-ci/docker@v3
176176
with:
177177
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-63dd26c0c7a808d92673a3e52e848189d4ab0f17
178178
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -193,18 +193,18 @@ jobs:
193193
runs-on: ubuntu-latest
194194
steps:
195195
- name: Checkout pending changes
196-
uses: protocolbuffers/protobuf-ci/checkout@v2
196+
uses: protocolbuffers/protobuf-ci/checkout@v3
197197
with:
198198
ref: ${{ inputs.safe-checkout }}
199199

200200
- name: Setup sccache
201-
uses: protocolbuffers/protobuf-ci/sccache@v2
201+
uses: protocolbuffers/protobuf-ci/sccache@v3
202202
with:
203203
cache-prefix: linux-cmake-examples
204204
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
205205

206206
- name: Run tests
207-
uses: protocolbuffers/protobuf-ci/docker@v2
207+
uses: protocolbuffers/protobuf-ci/docker@v3
208208
with:
209209
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-63dd26c0c7a808d92673a3e52e848189d4ab0f17
210210
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -233,19 +233,19 @@ jobs:
233233
runs-on: ubuntu-latest
234234
steps:
235235
- name: Checkout pending changes
236-
uses: protocolbuffers/protobuf-ci/checkout@v2
236+
uses: protocolbuffers/protobuf-ci/checkout@v3
237237
with:
238238
ref: ${{ inputs.safe-checkout }}
239239
submodules: recursive
240240

241241
- name: Setup sccache
242-
uses: protocolbuffers/protobuf-ci/sccache@v2
242+
uses: protocolbuffers/protobuf-ci/sccache@v3
243243
with:
244244
cache-prefix: linux-cmake-gcc
245245
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
246246

247247
- name: Run tests
248-
uses: protocolbuffers/protobuf-ci/docker@v2
248+
uses: protocolbuffers/protobuf-ci/docker@v3
249249
with:
250250
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:12.2-6.3.0-63dd26c0c7a808d92673a3e52e848189d4ab0f17
251251
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -264,19 +264,19 @@ jobs:
264264
runs-on: ubuntu-latest
265265
steps:
266266
- name: Checkout pending changes
267-
uses: protocolbuffers/protobuf-ci/checkout@v2
267+
uses: protocolbuffers/protobuf-ci/checkout@v3
268268
with:
269269
ref: ${{ inputs.safe-checkout }}
270270
submodules: recursive
271271

272272
- name: Setup sccache
273-
uses: protocolbuffers/protobuf-ci/sccache@v2
273+
uses: protocolbuffers/protobuf-ci/sccache@v3
274274
with:
275275
cache-prefix: linux-cmake-submodules
276276
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
277277

278278
- name: Run tests
279-
uses: protocolbuffers/protobuf-ci/docker@v2
279+
uses: protocolbuffers/protobuf-ci/docker@v3
280280
with:
281281
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-63dd26c0c7a808d92673a3e52e848189d4ab0f17
282282
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
@@ -289,19 +289,19 @@ jobs:
289289
runs-on: ubuntu-latest
290290
steps:
291291
- name: Checkout pending changes
292-
uses: protocolbuffers/protobuf-ci/checkout@v2
292+
uses: protocolbuffers/protobuf-ci/checkout@v3
293293
with:
294294
ref: ${{ inputs.safe-checkout }}
295295
submodules: recursive
296296

297297
- name: Setup sccache
298-
uses: protocolbuffers/protobuf-ci/sccache@v2
298+
uses: protocolbuffers/protobuf-ci/sccache@v3
299299
with:
300300
cache-prefix: linux-cmake-32-bit
301301
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
302302

303303
- name: Run tests
304-
uses: protocolbuffers/protobuf-ci/docker@v2
304+
uses: protocolbuffers/protobuf-ci/docker@v3
305305
with:
306306
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/32bit@sha256:8275360dc5d676f3470872d79087901c0e4153453976bea908a92c82e8d209ea
307307
platform: linux/386
@@ -348,11 +348,11 @@ jobs:
348348
runs-on: ${{ matrix.os }}
349349
steps:
350350
- name: Checkout pending changes
351-
uses: protocolbuffers/protobuf-ci/checkout@v2
351+
uses: protocolbuffers/protobuf-ci/checkout@v3
352352
with:
353353
ref: ${{ inputs.safe-checkout }}
354354
- name: Run tests
355-
uses: protocolbuffers/protobuf-ci/bazel@v2
355+
uses: protocolbuffers/protobuf-ci/bazel@v3
356356
with:
357357
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
358358
bazel: ${{ matrix.bazel }}
@@ -414,7 +414,7 @@ jobs:
414414
runs-on: ${{ matrix.os }}
415415
steps:
416416
- name: Checkout pending changes
417-
uses: protocolbuffers/protobuf-ci/checkout@v2
417+
uses: protocolbuffers/protobuf-ci/checkout@v3
418418
with:
419419
ref: ${{ inputs.safe-checkout }}
420420
submodules: recursive
@@ -438,15 +438,15 @@ jobs:
438438
shell: bash
439439

440440
- name: Setup sccache
441-
uses: protocolbuffers/protobuf-ci/sccache@v2
441+
uses: protocolbuffers/protobuf-ci/sccache@v3
442442
with:
443443
cache-prefix: ${{ matrix.cache-prefix }}
444444
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
445445

446446
# Install phase.
447447
- name: Configure CMake for install
448448
if: matrix.install-flags
449-
uses: protocolbuffers/protobuf-ci/bash@v2
449+
uses: protocolbuffers/protobuf-ci/bash@v3
450450
with:
451451
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
452452
command: cmake . ${{ matrix.install-flags }} ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON
@@ -468,7 +468,7 @@ jobs:
468468
run: cmake --build . --target clean && rm CMakeCache.txt
469469

470470
- name: Configure CMake
471-
uses: protocolbuffers/protobuf-ci/bash@v2
471+
uses: protocolbuffers/protobuf-ci/bash@v3
472472
with:
473473
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
474474
command: cmake . ${{ matrix.flags }} ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON

0 commit comments

Comments
 (0)