name: Build on macOS on: push: branches: - master # Updated to strictly track master pull_request: workflow_dispatch: jobs: Mac-Build: if: github.repository_owner != 'The-OpenROAD-Project-private' runs-on: macos-latest steps: - name: Setup xcode uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0 with: xcode-version: latest-stable - name: Check out repository code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: 'recursive' # 1. RESTORE: All jobs (PRs, manual runs, master) get to read the cache - name: Restore Bazel Disk Cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/.cache/bazel-disk-cache key: ${{ runner.os }}-bazel-${{ github.sha }} restore-keys: | ${{ runner.os }}-bazel- - name: Install Bazelisk run: brew install bazelisk - name: Build OpenROAD env: BAZEL_CACHE_PASSWORD: ${{ secrets.BAZEL_CACHE_PASSWORD }} run: | # When the secret is present (push / dispatch / private repo PR) # add authed gRPC + Remote Asset API + uploads on top of the # .bazelrc anon HTTPS read-only cache. Fork PRs have no secret # and just use the anon read path. REMOTE_FLAGS=() if [ -n "${BAZEL_CACHE_PASSWORD}" ]; then TOKEN_B64=$(printf 'ci:%s' "${BAZEL_CACHE_PASSWORD}" | base64 | tr -d '\n') # Mask the derived token so it cannot leak in build logs. # GH auto-masks the raw secret but not base64-of-secret. echo "::add-mask::${TOKEN_B64}" REMOTE_FLAGS=( --remote_cache=grpcs://bazel.precisioninno.com:443 --experimental_remote_downloader=grpcs://bazel.precisioninno.com:443 --remote_upload_local_results=true --remote_header="Authorization=Basic ${TOKEN_B64}" ) fi # Trace the bazelisk invocation so we can confirm remote flags are # present. TOKEN_B64 is already masked above, so it prints as ***. set -x bazelisk build \ "${REMOTE_FLAGS[@]}" \ --disk_cache=~/.cache/bazel-disk-cache \ --experimental_disk_cache_gc_max_size=5G \ --//:platform=gui //:openroad # 2. SAVE: Only executes if this is a push/merge directly to the master branch - name: Save Bazel Disk Cache if: github.ref == 'refs/heads/master' && github.event_name == 'push' uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/.cache/bazel-disk-cache key: ${{ runner.os }}-bazel-${{ github.sha }}