| 1 |
name: Bazel Tests |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- main |
| 10 |
workflow_dispatch: |
| 11 |
|
| 12 |
jobs: |
| 13 |
|
| 14 |
ubuntu: |
| 15 |
runs-on: ${{ matrix.os }} |
| 16 |
env: |
| 17 |
BAZEL_CACHE: --remote_cache=https://storage.googleapis.com/protobuf-bazel-cache |
| 18 |
|
| 19 |
strategy: |
| 20 |
fail-fast: false # Don't cancel all jobs if one fails. |
| 21 |
matrix: |
| 22 |
include: |
| 23 |
- { CC: clang, os: ubuntu-20.04, flags: "" } |
| 24 |
- { CC: clang, os: ubuntu-20.04, flags: "-c opt" } # Some warnings only fire with -c opt |
| 25 |
- { CC: gcc, os: ubuntu-20.04, flags: "-c opt" } |
| 26 |
- { CC: clang, os: ubuntu-20.04, flags: "--//:fasttable_enabled=true -- -cmake:test_generated_files" } |
| 27 |
- { CC: clang, os: ubuntu-20.04, flags: "--config=asan -c dbg -- -benchmarks:benchmark -python/..." } |
| 28 |
- { CC: clang, os: ubuntu-20.04, flags: "--config=ubsan -c dbg -- -benchmarks:benchmark -python/... -upb/bindings/lua/...", install: "libunwind-dev" } |
| 29 |
- { CC: clang, os: ubuntu-20.04, flags: "--copt=-m32 --linkopt=-m32 -- -... benchmarks:benchmark ", install: "g++-multilib" } |
| 30 |
- { CC: clang, os: macos-11, flags: "" } |
| 31 |
|
| 32 |
steps: |
| 33 |
- uses: actions/checkout@v2 |
| 34 |
- name: Set up Cloud SDK |
| 35 |
uses: google-github-actions/auth@v0 |
| 36 |
with: |
| 37 |
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} |
| 38 |
export_environment_variables: true |
| 39 |
if: ${{ github.repository_owner == 'protocolbuffers' }} |
| 40 |
- name: Set up Bazel read/write caching |
| 41 |
run: echo "BAZEL_CACHE_AUTH=--google_default_credentials" >> $GITHUB_ENV |
| 42 |
if: ${{ github.repository_owner == 'protocolbuffers' }} |
| 43 |
- name: Set up Bazel read-only caching |
| 44 |
run: echo "BAZEL_CACHE_AUTH=--remote_upload_local_results=false" >> $GITHUB_ENV |
| 45 |
if: ${{ github.repository_owner != 'protocolbuffers' }} |
| 46 |
- name: Setup Python venv |
| 47 |
run: rm -rf /tmp/venv && python3 -m venv /tmp/venv |
| 48 |
- name: Install dependencies |
| 49 |
run: sudo apt update && sudo apt install -y ${{ matrix.install }} |
| 50 |
if: matrix.install != '' |
| 51 |
- name: Run tests |
| 52 |
run: cd ${{ github.workspace }} && PATH=/tmp/venv/bin:$PATH CC=${{ matrix.CC }} bazel test --test_output=errors $BAZEL_CACHE $BAZEL_CACHE_AUTH ... ${{ matrix.flags }} |