Skip to content

Commit

Permalink
Merge pull request #455 from tweag/cg/use_config_bazel_remote_cache_auth
Browse files Browse the repository at this point in the history
chore: update to use `tweag/configure-bazel-remote-cache-auth`
  • Loading branch information
mergify[bot] authored Nov 29, 2023
2 parents 3a8141a + 45d2af8 commit 21c4ea4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 33 deletions.
37 changes: 37 additions & 0 deletions .github/actions/configure_bazelrc/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Configure bazelrc file and copy to $HOME/.bazelrc

inputs:
bazelrc_path:
type: string
description: The path to the bazelrc file to use as the starting point.
default: '.bazelrc.ci'
buildbuddy_api_key:
type: string
description: Buildbuddy API key

runs:
using: composite
steps:
- id: create_bazelrc_tmp
shell: bash
env:
BAZELRC: ${{ inputs.bazelrc_path }}
run: |
bazelrc_tmp="${BAZELRC}.tmp"
cp "${BAZELRC}" "${bazelrc_tmp}"
echo "bazelrc_tmp=${bazelrc_tmp}" >> "$GITHUB_OUTPUT"
- uses: tweag/configure-bazel-remote-cache-auth@v0
with:
buildbuddy_api_key: ${{ inputs.buildbuddy_api_key }}
bazelrc_path: ${{ steps.create_bazelrc_tmp.outputs.bazelrc_tmp }}

- shell: bash
env:
BAZELRC_TMP: ${{ steps.create_bazelrc_tmp.outputs.bazelrc_tmp }}
run: |
cat >>"${BAZELRC_TMP}" <<EOF
common --config=ci
# no-op flag to avoid "ERROR: Config value 'ci' is not defined in any .rc file"
common:ci --announce_rc=false
EOF
cp "${BAZELRC_TMP}" $HOME/.bazelrc
39 changes: 6 additions & 33 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,9 @@ jobs:
- uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=./docs/nixpkgs.nix
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
cp .bazelrc.ci $HOME/.bazelrc
if [ -z "$BUILDBUDDY_API_KEY" ]; then
cache_setting='build --noremote_upload_local_results'
else
cache_setting="build --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY"
fi
cat >>$HOME/.bazelrc <<EOF
common --config=ci
$cache_setting
# no-op flag to avoid "ERROR: Config value 'ci' is not defined in any .rc file"
common:ci --announce_rc=false
EOF
- uses: ./.github/actions/configure_bazelrc
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Start remote Nix server
if: matrix.withNixRemote && matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -98,23 +85,9 @@ jobs:
- uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=./nixpkgs.nix
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
cp .bazelrc.ci $HOME/.bazelrc
cp .bazelrc.ci $HOME/.bazelrc
if [ -z "$BUILDBUDDY_API_KEY" ]; then
cache_setting='build --noremote_upload_local_results'
else
cache_setting="build --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY"
fi
cat >>$HOME/.bazelrc <<EOF
common --config=ci
$cache_setting
# no-op flag to avoid "ERROR: Config value 'ci' is not defined in any .rc file"
common:ci --announce_rc=false
EOF
- uses: ./.github/actions/configure_bazelrc
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Build & test
run: |
skip() {
Expand Down

0 comments on commit 21c4ea4

Please sign in to comment.