Make authenticated builds publicly visible #4496
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Continuous integration | |
| on: | |
| push: | |
| pull_request: | |
| branches: master | |
| workflow_dispatch: # allows manual triggering | |
| schedule: | |
| - cron: '1 11 * * *' | |
| env: | |
| # Bump this number to invalidate the GH actions cache | |
| cache-version: 0 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
| jobs: | |
| examples-bindist: | |
| name: Build & Test Examples - bindist | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2022] | |
| bzlmod: [true, false] | |
| bazel: | |
| - "6.x" | |
| - "7.x" | |
| exclude: | |
| # TODO(cb) add full support for Bazel 7 | |
| - os: windows-2022 | |
| bazel: "7.x" | |
| env: | |
| USE_BAZEL_VERSION: ${{ matrix.bazel }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: ./.github/actions/free_disk_space_on_linux | |
| - name: Mount Bazel cache | |
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
| with: | |
| path: ~/repo-cache | |
| key: repo-cache-${{ runner.os }}-bindist-${{ env.cache-version }} | |
| - uses: tweag/configure-bazel-remote-cache-auth@144b0b915f13a418f5eafe2f68d19564ec136c62 # v0.1.1 | |
| with: | |
| buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }} | |
| bazelrc_path: .bazelrc.auth | |
| - uses: ./.github/actions/set_tcp_keepalive_time | |
| - uses: extractions/netrc@f6f1722d05ce2890aa86fd9654565b1214ac53a4 # v2 | |
| with: | |
| machine: api.github.com | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure | |
| shell: bash | |
| run: | | |
| case "${{ runner.os }}" in | |
| macOS) BUILD_CONFIG=macos-bindist;; | |
| Linux) BUILD_CONFIG=linux-bindist;; | |
| Windows) BUILD_CONFIG=ci-windows-bindist;; | |
| esac | |
| if [[ ${{ runner.os }} == Windows ]]; then | |
| output_root_setting="startup --output_user_root=C:/_bzl" | |
| # On windows, we use a separate remote cache for bzlmod, | |
| # because the c dependency analysis is leaking absolute paths which are different | |
| if ${{ matrix.bzlmod }}; then | |
| bzlmod_cache_silo_key='build --remote_default_exec_properties=bzlmod-cache-silo-key=bzlmod' | |
| else | |
| bzlmod_cache_silo_key='build --remote_default_exec_properties=bzlmod-cache-silo-key=workspace' | |
| fi | |
| else | |
| output_root_setting="" | |
| bzlmod_cache_silo_key="" | |
| fi | |
| cat >>.bazelrc.local <<EOF | |
| common --config=ci | |
| build --config=$BUILD_CONFIG | |
| $output_root_setting | |
| $bzlmod_cache_silo_key | |
| common --enable_bzlmod=${{ matrix.bzlmod }} | |
| EOF | |
| - name: Build | |
| shell: bash | |
| working-directory: examples | |
| run: | | |
| # Quote the package specifier so that it works on Windows | |
| bazelisk info output_path | |
| bazelisk build "//..." | |
| - name: Test | |
| shell: bash | |
| working-directory: examples | |
| run: | | |
| # Quote the package specifier so that it works on Windows | |
| bazelisk test "//..." | |
| - name: Setup tmate session | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| limit-access-to-actor: true | |