Enable Bazel caching in GCS.

PiperOrigin-RevId: 446718586
pull/13171/head
Joshua Haberman 3 years ago committed by Copybara-Service
parent cb723e4fca
commit d14fee420c
  1. 9
      .github/workflows/bazel_tests.yml
  2. 6
      .github/workflows/python_tests.yml

@ -13,6 +13,8 @@ jobs:
ubuntu:
runs-on: ${{ matrix.os }}
env:
BAZEL_CACHE: --remote_cache=https://storage.googleapis.com/protobuf-bazel-cache --google_default_credentials
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
@ -29,10 +31,15 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Cloud SDK
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
export_environment_variables: true
- name: Setup Python venv
run: rm -rf /tmp/venv && python3 -m venv /tmp/venv
- name: Install dependencies
run: sudo apt update && sudo apt install -y ${{ matrix.install }}
if: matrix.install != ''
- name: Run tests
run: cd ${{ github.workspace }} && PATH=/tmp/venv/bin:$PATH CC=${{ matrix.CC }} bazel test --test_output=errors ... ${{ matrix.flags }}
run: cd ${{ github.workspace }} && PATH=/tmp/venv/bin:$PATH CC=${{ matrix.CC }} bazel test --test_output=errors $BAZEL_CACHE ... ${{ matrix.flags }}

@ -15,23 +15,23 @@ jobs:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: gcr.io/protobuf-build/bazel/linux@sha256:05a41edee21f620445ca01c46b9d33be2e4d06c3d8adced4341ac5abea754baa
BAZEL_CACHE: --remote_cache=https://storage.googleapis.com/protobuf-bazel-cache --google_default_credentials
steps:
- uses: actions/checkout@v2
- name: Set up Cloud SDK
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
export_environment_variables: true
- name: Use gcloud CLI
run: gcloud info
- name: Configure Docker
run: gcloud auth configure-docker
- name: Pull Docker Image
run: docker pull $DOCKER_IMAGE
- uses: actions/checkout@v2
- name: Build Wheels
run: cd ${{ github.workspace }} && docker run -v$PWD:/workspace $DOCKER_IMAGE build --crosstool_top=@com_google_protobuf//toolchain:clang_suite --symlink_prefix=/ -c dbg python/dist python/dist:test_wheel
run: cd ${{ github.workspace }} && docker run -e GOOGLE_APPLICATION_CREDENTIALS=/workspace/$(basename $GOOGLE_APPLICATION_CREDENTIALS) -v$PWD:/workspace $DOCKER_IMAGE build $BAZEL_CACHE --crosstool_top=@com_google_protobuf//toolchain:clang_suite --symlink_prefix=/ -c dbg python/dist python/dist:test_wheel
- name: Move Wheels
run: mkdir wheels && find _build/out -name 'protobuf*.whl' -exec mv '{}' wheels ';'
- uses: actions/upload-artifact@v3

Loading…
Cancel
Save