name: "macos"

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:

  build-and-test-macos:
    name: Build and Test (macOS)
    runs-on: macos-latest
    env:
      BAZEL: bazelisk-darwin-amd64
    steps:
    - uses: actions/checkout@v2

    - name: Mount bazel cache
      uses: actions/cache@v2
      with:
        # See https://docs.bazel.build/versions/master/output_directories.html
        path: "/private/var/tmp"
        key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE.bazel') }}
        restore-keys: ${{ runner.os }}-bazel

    - name: Install bazelisk
      run: |
        curl -sLO "https://github.com/bazelbuild/bazelisk/releases/latest/download/$BAZEL"
        chmod +x $BAZEL

    - name: Build
      run: ./$BAZEL build -c opt --host_copt=-DGRPC_BAZEL_BUILD //...

    - name: Test
      run: ./$BAZEL test -c opt --host_copt=-DGRPC_BAZEL_BUILD --test_output=errors //...

name: "macos"

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:

  build-and-test-macos:
    name: Build and Test (macOS)
    runs-on: macos-latest
    env:
      BAZEL: bazelisk-darwin-amd64
    steps:
    - uses: actions/checkout@v2

    - name: Update environment variables
      run: |
        echo "USER=${USER}" >> ${GITHUB_ENV}

    - name: Mount bazel cache
      uses: actions/cache@v2
      with:
        # See https://docs.bazel.build/versions/master/output_directories.html
        path: /private/var/tmp/_bazel_${{ env.USER }}
        key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE.bazel') }}
        restore-keys: ${{ runner.os }}-bazel

    - name: Install bazelisk
      run: |
        curl -sLO "https://github.com/bazelbuild/bazelisk/releases/latest/download/$BAZEL"
        chmod +x $BAZEL

    - name: Build
      run: ./$BAZEL build -c opt --host_copt=-DGRPC_BAZEL_BUILD //...

    - name: Test
      run: ./$BAZEL test -c opt --host_copt=-DGRPC_BAZEL_BUILD --test_output=errors //...

Make cache look at the user's build only.
[macOS] Make cache look at the user's build only.

PiperOrigin-RevId: 344643147
