Skip to content

Commit f1c500b

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/issue-10486-fatal-warnings-encode-decode
2 parents c567cad + 7875e91 commit f1c500b

424 files changed

Lines changed: 13229 additions & 7353 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build --javacopt=-Xep:SelfAssertion:WARN
66
# Disable prebuilt protoc on CI. On both main and release branches,
77
# PROTOBUF_VERSION ordinarily points to the next release, which doesn't
88
# exist and therefore doesn't have a prebuilt yet.
9-
#build --@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc=false
9+
build --@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc=false
1010

1111
# This flag works around some issues with Rust linking.
1212
build --@rules_rust//rust/settings:experimental_use_cc_common_link=True

.github/BUILD.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
load("@build_bazel_apple_support//xcode:xcode_config.bzl", "xcode_config")
22
load("@build_bazel_apple_support//xcode:xcode_version.bzl", "xcode_version")
3+
load("@rules_shell//shell:sh_test.bzl", "sh_test")
4+
5+
sh_test(
6+
name = "release_prep_test",
7+
srcs = ["workflows/release_prep_test.sh"],
8+
data = [
9+
"workflows/release_prep.sh",
10+
"@jq_toolchains//:resolved_toolchain",
11+
],
12+
env = {
13+
"JQ_BIN": "$(JQ_BIN)",
14+
},
15+
target_compatible_with = select({
16+
"@platforms//os:windows": ["@platforms//:incompatible"],
17+
"//conditions:default": [],
18+
}),
19+
toolchains = ["@jq_toolchains//:resolved_toolchain"],
20+
deps = ["@bazel_tools//tools/bash/runfiles"],
21+
)
322

423
# This information is extracted from the MacOS runner specs located at:
524
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
#!/usr/bin/env bash
2+
set -o errexit -o nounset -o pipefail
3+
4+
# --- begin runfiles.bash initialization ---
5+
if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
6+
if [[ -f "$0.runfiles_manifest" ]]; then
7+
export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest"
8+
elif [[ -f "$0.runfiles/MANIFEST" ]]; then
9+
export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST"
10+
elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
11+
export RUNFILES_DIR="$0.runfiles"
12+
fi
13+
fi
14+
if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
15+
source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash"
16+
elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
17+
source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \
18+
"$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)"
19+
else
20+
# Not running under Bazel; fall back to co-located script
21+
rlocation() { echo "$(cd "$(dirname "$0")" && pwd)/$(basename "$1")"; }
22+
fi
23+
# --- end runfiles.bash initialization ---
24+
25+
RELEASE_PREP=$(rlocation _main/.github/workflows/release_prep.sh)
26+
TEST_DIR=$(mktemp -d)
27+
trap 'rm -rf "$TEST_DIR"' EXIT
28+
29+
TAG="v99.0"
30+
PREFIX="protobuf-99.0"
31+
32+
##############################
33+
# Fixture: a git repo with a tag and the placeholder integrity file
34+
##############################
35+
cd "$TEST_DIR"
36+
git init -q
37+
git config user.email "test@test.com"
38+
git config user.name "Test"
39+
40+
mkdir -p bazel/private/oss/toolchains/prebuilt
41+
cat > bazel/private/oss/toolchains/prebuilt/tool_integrity.bzl <<'BZL'
42+
"Placeholder"
43+
RELEASE_VERSION = "v0.0.0"
44+
RELEASED_BINARY_INTEGRITY = {}
45+
BZL
46+
47+
echo "compatibility/ export-ignore" > .gitattributes
48+
mkdir -p compatibility
49+
echo "should be excluded" > compatibility/README
50+
echo "# protobuf" > README.md
51+
52+
git add -A
53+
git commit -q -m "initial"
54+
git tag "$TAG"
55+
56+
##############################
57+
# Fixture: the script needs GNU tar (--delete/--append); shim it
58+
##############################
59+
TAR=$(command -v gtar || command -v tar)
60+
mkdir -p "$TEST_DIR/.mock_bin"
61+
ln -sf "$TAR" "$TEST_DIR/.mock_bin/tar"
62+
63+
##############################
64+
# Fixture: put jq (from Bazel toolchain) on the PATH
65+
##############################
66+
ln -sf "$(rlocation ${JQ_BIN#"external/"})" "$TEST_DIR/.mock_bin/jq"
67+
68+
##############################
69+
# Fixture: mock curl returning a GitHub Releases API response
70+
##############################
71+
cat > "$TEST_DIR/.mock_bin/curl" <<'MOCK'
72+
#!/usr/bin/env bash
73+
cat <<'JSON'
74+
{
75+
"assets": [
76+
{
77+
"name": "protoc-99.0-linux-x86_64.zip",
78+
"digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
79+
},
80+
{
81+
"name": "protoc-99.0-osx-aarch_64.zip",
82+
"digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
83+
},
84+
{
85+
"name": "protoc-99.0-win64.zip",
86+
"digest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
87+
}
88+
]
89+
}
90+
JSON
91+
MOCK
92+
chmod +x "$TEST_DIR/.mock_bin/curl"
93+
export PATH="$TEST_DIR/.mock_bin:$PATH"
94+
95+
##############################
96+
# Run the script under test
97+
##############################
98+
bash "$RELEASE_PREP" "$TAG"
99+
100+
##############################
101+
# Assertions
102+
##############################
103+
ARCHIVE="$PREFIX.bazel.tar.gz"
104+
FAILURES=0
105+
106+
fail() {
107+
echo "FAIL: $1"
108+
FAILURES=$((FAILURES + 1))
109+
}
110+
111+
pass() {
112+
echo "PASS: $1"
113+
}
114+
115+
assert_file_exists() {
116+
[[ -f "$1" ]] && pass "$2" || fail "$2"
117+
}
118+
119+
assert_file_absent() {
120+
[[ ! -e "$1" ]] && pass "$2" || fail "$2"
121+
}
122+
123+
assert_contains() {
124+
if echo "$3" | grep -qF -- "$2"; then
125+
pass "$1"
126+
else
127+
fail "$1 — expected to find: $2"
128+
fi
129+
}
130+
131+
# 1. Archive is produced with the expected name
132+
assert_file_exists "$ARCHIVE" "archive file $ARCHIVE exists"
133+
134+
# 2. Archive is gzip-compressed
135+
if file "$ARCHIVE" | grep -q gzip; then
136+
pass "archive is gzip"
137+
else
138+
fail "archive is gzip"
139+
fi
140+
141+
# 3. Extract and inspect
142+
EXTRACT_DIR=$(mktemp -d)
143+
tar xzf "$ARCHIVE" -C "$EXTRACT_DIR"
144+
145+
# 4. Patched tool_integrity.bzl is present
146+
INTEGRITY="$EXTRACT_DIR/$PREFIX/bazel/private/oss/toolchains/prebuilt/tool_integrity.bzl"
147+
assert_file_exists "$INTEGRITY" "tool_integrity.bzl present in archive"
148+
149+
CONTENT=$(cat "$INTEGRITY")
150+
151+
# 5. RELEASE_VERSION matches the tag
152+
assert_contains "RELEASE_VERSION matches tag" "RELEASE_VERSION=\"$TAG\"" "$CONTENT"
153+
154+
# 6. RELEASED_BINARY_INTEGRITY is populated from mock curl
155+
assert_contains "integrity map present" "RELEASED_BINARY_INTEGRITY =" "$CONTENT"
156+
assert_contains "linux hash" \
157+
'"protoc-99.0-linux-x86_64.zip": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"' \
158+
"$CONTENT"
159+
assert_contains "osx hash" \
160+
'"protoc-99.0-osx-aarch_64.zip": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"' \
161+
"$CONTENT"
162+
assert_contains "win hash" \
163+
'"protoc-99.0-win64.zip": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"' \
164+
"$CONTENT"
165+
166+
# 7. Original placeholder content is NOT in the patched file
167+
if echo "$CONTENT" | grep -qF "v0.0.0"; then
168+
fail "placeholder content should be replaced"
169+
else
170+
pass "placeholder content replaced"
171+
fi
172+
173+
# 8. compatibility/ excluded from archive (via .gitattributes export-ignore)
174+
assert_file_absent "$EXTRACT_DIR/$PREFIX/compatibility" "compatibility/ excluded from archive"
175+
176+
# 9. Other repo files are included
177+
assert_file_exists "$EXTRACT_DIR/$PREFIX/README.md" "README.md included in archive"
178+
179+
# 10. All archive entries live under the expected prefix directory
180+
BAD_ENTRIES=$(tar tzf "$ARCHIVE" | grep -cv "^${PREFIX}/") || true
181+
if [[ "$BAD_ENTRIES" -eq 0 ]]; then
182+
pass "all entries under $PREFIX/ prefix"
183+
else
184+
fail "found $BAD_ENTRIES entries outside $PREFIX/ prefix"
185+
fi
186+
187+
rm -rf "$EXTRACT_DIR"
188+
189+
##############################
190+
echo
191+
if [[ "$FAILURES" -gt 0 ]]; then
192+
echo "$FAILURES test(s) FAILED"
193+
exit 1
194+
else
195+
echo "All tests passed"
196+
fi

.github/workflows/test_bazel.yml

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -81,36 +81,6 @@ jobs:
8181
cd examples;
8282
bazel build //... @com_google_protobuf-examples-with-hyphen//... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} --enable_workspace=${{ !matrix.bzlmod }} ${{ matrix.toolchain_resolution }};
8383
84-
prebuilt-protoc:
85-
strategy:
86-
fail-fast: false
87-
matrix:
88-
runner: [ ubuntu, windows, macos ]
89-
bazelversion: [ '8.6.0', '9.0.0' ]
90-
bzlmod: [ true ]
91-
toolchain_resolution:
92-
# Default flags, uses from prebuilt protoc
93-
- ""
94-
runs-on: ${{ matrix.runner }}-latest
95-
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Prebuilt test ${{ matrix.runner }} ${{ matrix.bazelversion }} ${{ matrix.toolchain_resolution && ' (toolchain resolution)' || '' }}
96-
steps:
97-
- name: Checkout pending changes
98-
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
99-
uses: protocolbuffers/protobuf-ci/checkout@v5
100-
with:
101-
ref: ${{ inputs.safe-checkout }}
102-
103-
- name: Run tests
104-
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
105-
uses: protocolbuffers/protobuf-ci/bazel@v5
106-
with:
107-
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
108-
bazel-cache: examples-prebuilt-${{ matrix.bazelversion }}-${{ matrix.toolchain_resolution }}
109-
version: ${{ matrix.bazelversion }}
110-
bash: >
111-
cd examples/example_without_cc_toolchain;
112-
bazel build //... $BAZEL_FLAGS ${{ matrix.toolchain_resolution }};
113-
11484
bazel-tests-ubuntu:
11585
strategy:
11686
fail-fast: false # Don't cancel all jobs if one fails.
@@ -124,7 +94,7 @@ jobs:
12494
- name: Run tests
12595
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
12696
with:
127-
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671
97+
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
12898
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
12999
bazel-cache: "bazel-tests"
130100
bazel: test //bazel/...

.github/workflows/test_cpp.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ jobs:
3737
- { name: No-RTTI, flags: --cxxopt=-fno-rtti, continuous-only: true }
3838
include:
3939
# Set defaults
40-
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:8.0.1-d415763a389bb62a6f126b08c992e83f9f7dc1b4
40+
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:8.0.1-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
4141
- targets: //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests
4242
# Override cases with custom images
4343
- config: { name: "Bazel8", flags: --cxxopt="-Wno-self-assign-overloaded" }
4444
cache_key: Bazel8
45-
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-d415763a389bb62a6f126b08c992e83f9f7dc1b4"
45+
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.6.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c"
4646
targets: "//src/... //third_party/utf8_range/..."
4747
- config: { name: "Bazel9", flags: "--cxxopt=-Wno-self-assign-overloaded" }
4848
cache_key: Bazel9
49-
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671"
49+
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c"
5050
targets: "//src/... //third_party/utf8_range/..."
5151
- config: { name: "TCMalloc" }
5252
cache_key: TcMalloc
53-
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:8.0.1-d415763a389bb62a6f126b08c992e83f9f7dc1b4"
53+
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:8.0.1-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12"
5454
targets: "//src/... //third_party/utf8_range/..."
5555
- config: { name: "aarch64", flags: "--platforms=//build_defs:linux-aarch_64" }
5656
cache_key: aarch64-bazel8
5757
targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test //third_party/utf8_range/..."
58-
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-aarch64-168f9c9d015a0fa16611e1e9eede796fe9bfbb69"
58+
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-aarch64-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12"
5959
name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.config.name }}
6060
runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }}
6161
steps:
@@ -122,7 +122,7 @@ jobs:
122122
id: cross-compile
123123
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
124124
with:
125-
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-d415763a389bb62a6f126b08c992e83f9f7dc1b4
125+
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.6.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c
126126
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
127127
architecture: linux-${{ matrix.arch }}
128128
- name: Setup sccache
@@ -135,7 +135,7 @@ jobs:
135135
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
136136
uses: protocolbuffers/protobuf-ci/docker@v5
137137
with:
138-
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-${{ matrix.arch }}-168f9c9d015a0fa16611e1e9eede796fe9bfbb69
138+
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-${{ matrix.arch }}-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
139139
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
140140
entrypoint: bash
141141
command: >
@@ -573,3 +573,27 @@ jobs:
573573
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
574574
shell: bash
575575
run: sccache -s
576+
577+
linux-abseil-head:
578+
name: ${{ inputs.continuous-prefix }} Linux Abseil HEAD
579+
runs-on: ubuntu-latest
580+
steps:
581+
- name: Checkout pending changes
582+
if: ${{ inputs.continuous-run }}
583+
uses: protocolbuffers/protobuf-ci/checkout@v5
584+
with:
585+
ref: ${{ inputs.safe-checkout }}
586+
- name: Checkout Abseil HEAD
587+
if: ${{ inputs.continuous-run }}
588+
uses: actions/checkout@v5
589+
with:
590+
repository: abseil/abseil-cpp
591+
path: abseil-cpp-head
592+
- name: Run tests
593+
if: ${{ inputs.continuous-run }}
594+
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
595+
with:
596+
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671
597+
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
598+
bazel-cache: cpp_linux/abseil_head
599+
bazel: test //src/... --override_module=abseil-cpp=abseil-cpp-head

.github/workflows/test_csharp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Run tests
2828
uses: protocolbuffers/protobuf-ci/docker@v5
2929
with:
30-
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-8.0.100-05b57cb3d33f45f689c1dace146b6b9619d78872
30+
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-8.0.100-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
3131
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
3232
entrypoint: /bin/bash
3333
command: >-
@@ -43,7 +43,7 @@ jobs:
4343
- name: Run conformance tests
4444
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
4545
with:
46-
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-8.0.100-05b57cb3d33f45f689c1dace146b6b9619d78872
46+
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-8.0.100-a6ca8ba8e77d63471b4ad05f8643e1fc58b30e12
4747
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
4848
bazel-cache: csharp_linux
4949
bazel: test //csharp:conformance_test --action_env=PATH --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel

.github/workflows/test_hpb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
include:
2424
- targets: "//hpb/... //hpb_generator/..."
25-
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671"
25+
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-9dca0d9417f43f5f1e97e59969fb0f3e6ae3bd9c"
2626
- bazel_cmd: "test"
2727

2828
name: Linux ${{ matrix.config.name }}

0 commit comments

Comments
 (0)