Skip to content

Commit a315eb8

Browse files
committed
Don't run 3rd party test by default. Still run in CI
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
1 parent 90e9bf2 commit a315eb8

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
PY_VER_MYPY: ${{matrix.py-ver-mypy-protobuf}}
5353
PYTHON_PROTOBUF_VERSION: ${{matrix.protobuf-version}}
5454
VALIDATE: 1
55+
TEST_THIRD_PARTY: 1
5556
run: |
5657
./run_test.sh
5758

run_test.sh

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PY_VER_MYPY_PROTOBUF_SHORT=$(echo "$PY_VER_MYPY_PROTOBUF" | cut -d. -f1-2)
88
PY_VER_MYPY=${PY_VER_MYPY:=3.12.12}
99
PY_VER_UNIT_TESTS="${PY_VER_UNIT_TESTS:=3.9.17 3.10.12 3.11.4 3.12.12 3.13.9 3.14.0}"
1010
PYTHON_PROTOBUF_VERSION=${PYTHON_PROTOBUF_VERSION:=6.32.1}
11+
TEST_THIRD_PARTY=${TEST_THIRD_PARTY:=0}
1112

1213
# Confirm UV installed
1314
if ! command -v uv &> /dev/null; then
@@ -150,14 +151,17 @@ MYPY_PROTOBUF_VENV=venv_$PY_VER_MYPY_PROTOBUF
150151
exit 1
151152
fi
152153

153-
# Generate 3rd party protos
154-
mkdir -p third_party/out/generated_googleapis
155-
# Known conflict with extensions proto in googleapis - skip that one
156-
find third_party/googleapis -name "*.proto" \
157-
! -path "third_party/googleapis/google/cloud/compute/v1/compute.proto" \
158-
! -path "third_party/googleapis/google/cloud/compute/v1beta/compute.proto" \
159-
! -path "third_party/googleapis/google/cloud/compute/v1small/compute_small.proto" \
160-
-print0 | xargs -0 "$PROTOC" --proto_path=third_party/googleapis --mypy_out=third_party/out/generated_googleapis --mypy_grpc_out=third_party/out/generated_googleapis --python_out=third_party/out/generated_googleapis
154+
# if TEST_THIRD_PARTY is set to 1 then generate
155+
if [[ "$TEST_THIRD_PARTY" == "1" ]]; then
156+
# Generate 3rd party protos
157+
mkdir -p third_party/out/generated_googleapis
158+
# Known conflict with extensions proto in googleapis - skip that one
159+
find third_party/googleapis -name "*.proto" \
160+
! -path "third_party/googleapis/google/cloud/compute/v1/compute.proto" \
161+
! -path "third_party/googleapis/google/cloud/compute/v1beta/compute.proto" \
162+
! -path "third_party/googleapis/google/cloud/compute/v1small/compute_small.proto" \
163+
-print0 | xargs -0 "$PROTOC" --proto_path=third_party/googleapis --mypy_out=third_party/out/generated_googleapis --mypy_grpc_out=third_party/out/generated_googleapis --python_out=third_party/out/generated_googleapis
164+
fi
161165
)
162166

163167
ERROR_FILE=$(mktemp)
@@ -194,9 +198,11 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
194198
GOOGLE_PROTOBUF=( test/generated/google/protobuf )
195199
MYPYPATH=$MYPYPATH:test/generated PYTHONPATH=test/generated mypy --explicit-package-bases ${CUSTOM_TYPESHED_DIR_ARG:+"$CUSTOM_TYPESHED_DIR_ARG"} --report-deprecated-as-note --python-executable="$UNIT_TESTS_VENV"/bin/python --python-version="$PY_VER_MYPY_TARGET" "${GOOGLE_PROTOBUF[@]}"
196200

197-
# Run googleapis mypy
198-
GOOGLEAPIS=( third_party/out/generated_googleapis )
199-
MYPYPATH=$MYPYPATH:third_party/out/generated_googleapis mypy --explicit-package-bases ${CUSTOM_TYPESHED_DIR_ARG:+"$CUSTOM_TYPESHED_DIR_ARG"} --report-deprecated-as-note --python-executable="$UNIT_TESTS_VENV"/bin/python --python-version="$PY_VER_MYPY_TARGET" "${GOOGLEAPIS[@]}"
201+
if [[ "$TEST_THIRD_PARTY" == "1" ]]; then
202+
# Run googleapis mypy
203+
GOOGLEAPIS=( third_party/out/generated_googleapis )
204+
MYPYPATH=$MYPYPATH:third_party/out/generated_googleapis mypy --explicit-package-bases ${CUSTOM_TYPESHED_DIR_ARG:+"$CUSTOM_TYPESHED_DIR_ARG"} --report-deprecated-as-note --python-executable="$UNIT_TESTS_VENV"/bin/python --python-version="$PY_VER_MYPY_TARGET" "${GOOGLEAPIS[@]}"
205+
fi
200206

201207
export MYPYPATH=$MYPYPATH:test/generated
202208

@@ -251,8 +257,8 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
251257
done
252258

253259

254-
# Clean up googleapis
255-
rm -rf third_party/out/generated_googleapis
260+
# Clean up third_party
261+
rm -rf third_party/out/*
256262

257263
# Report all errors at the end
258264
if [ -s "$ERROR_FILE" ]; then

0 commit comments

Comments
 (0)