From 769ab10e3b9f5b9ccf9a46c786091960812938c2 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 1 Nov 2023 16:18:47 -0700 Subject: [PATCH] Fix windows 2019 build. setup-gcloud doesn't honor the environment variables set by setup-python, so we need to manually set CLOUDSDK_PYTHON before running it. PiperOrigin-RevId: 578674246 --- .github/workflows/test_cpp.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index 54b28006a9..55c061bc1b 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -366,6 +366,7 @@ jobs: -Dprotobuf_BUILD_EXAMPLES=ON vsversion: '2019' cache-prefix: windows-2019-cmake + # windows-2019 has python3.7 installed, which is incompatible with the latest gcloud python-version: '3.8' - name: Windows CMake 32-bit os: windows-2022 @@ -399,13 +400,6 @@ jobs: ref: ${{ inputs.safe-checkout }} submodules: recursive - - name: Install Python - if: ${{ matrix.python-version }} - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: ${{ matrix.python-version }} - cache: pip - - name: Setup MSVC if: ${{ runner.os == 'Windows' }} uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1 @@ -413,6 +407,17 @@ jobs: arch: ${{ matrix.windows-arch || 'x64' }} vsversion: ${{ matrix.vsversion }} + # Workaround for incompatibility between gcloud and windows-2019 runners. + - name: Install Python + if: ${{ matrix.python-version }} + uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: ${{ matrix.python-version }} + - name: Use custom python for gcloud + if: ${{ matrix.python-version }} + run: echo "CLOUDSDK_PYTHON=${Python3_ROOT_DIR}\\python3" >> $GITHUB_ENV + shell: bash + - name: Setup sccache uses: protocolbuffers/protobuf-ci/sccache@v2 with: