Skip to content

Commit

Permalink
Consolidate bazelrc config to a single action
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrindel committed Nov 27, 2023
1 parent eb8e5e7 commit 57df950
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 103 deletions.
26 changes: 21 additions & 5 deletions .github/actions/configure_bazelrc/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,35 @@ name: Configure bazelrc file and copy to $HOME/.bazelrc
inputs:
bazelrc_path:
type: string
description: The path to the bazelrc file to configure.
required: true
description: The path to the bazelrc file to use as the starting point.
default: '.bazelrc.ci'

runs:
using: composite
steps:
- shell: bash
- id: create_bazelrc_tmp
shell: bash
env:
BAZELRC: ${{ inputs.bazelrc_path }}
run: |
cat >>"${BAZELRC}" <<EOF
bazelrc_tmp="${BAZELRC}.tmp"
cp "${BAZELRC}" "${bazelrc_tmp}"
echo "bazelrc_tmp=${bazelrc_tmp}" >> "$GITHUB_OUTPUT"
# DO NOT MERGE!!!
# TODO: Update with the correct tagged release.
- uses: tweag/configure-bazel-remote-cache-auth@fix_output
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
bazelrc_path: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }}

- shell: bash
env:
BAZELRC_TMP: ${{ steps.create_bazelrc_tmp.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}" $HOME/.bazelrc
cp "${BAZELRC_TMP}" $HOME/.bazelrc
26 changes: 0 additions & 26 deletions .github/actions/create_bazelrc_tmp/action.yaml

This file was deleted.

74 changes: 2 additions & 72 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,47 +34,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# DO NOT MERGE
# TODO: Remove CHUCK DEBUG
- name: CHUCK DEBUG
shell: bash
run: |
echo >&2 "current dir"
pwd >&2
echo >&2 ".github dir"
ls -l .github >&2
echo >&2 ".github/actions dir"
ls -l .github/actions >&2
echo >&2 ".github/actions/create_bazelrc_tmp dir"
ls -l .github/actions/create_bazelrc_tmp >&2
echo >&2 ".github/actions/configure_bazelrc dir"
ls -l .github/actions/configure_bazelrc >&2
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=./docs/nixpkgs.nix
- uses: ./.github/actions/create_bazelrc_tmp
id: create_bazelrc_tmp
with:
bazelrc_path: .bazelrc.ci
# DO NOT MERGE!!!
# TODO: Update with the correct tagged release.
- uses: tweag/configure-bazel-remote-cache-auth@fix_output
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
bazelrc_path: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }}
- uses: ./.github/actions/configure_bazelrc/action.yaml
with:
bazelrc_path: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }}
# - name: Configure
# env:
# BAZELRC_TMP: ${{ steps.create_bazelrc_tmp.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
- uses: ./.github/actions/configure_bazelrc
- name: Start remote Nix server
if: matrix.withNixRemote && matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -118,40 +81,7 @@ jobs:
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=./nixpkgs.nix
# - uses: .github/actions/create_bazelrc_tmp
# id: create_bazelrc_tmp
# with:
# bazelrc_path: .bazelrc.ci
# - 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/create_bazelrc_tmp
id: create_bazelrc_tmp
with:
bazelrc_path: .bazelrc.ci
# DO NOT MERGE!!!
# TODO: Update with the correct tagged release.
- uses: tweag/configure-bazel-remote-cache-auth@fix_output
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
bazelrc_path: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }}
- uses: ./.github/actions/configure_bazelrc/action.yaml
with:
bazelrc_path: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }}
- uses: ./.github/actions/configure_bazelrc
- name: Build & test
run: |
skip() {
Expand Down

0 comments on commit 57df950

Please sign in to comment.