From 248dc5090f5c633a2988c8cb47c76dff4c49e698 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Mon, 27 Nov 2023 12:18:07 -0700 Subject: [PATCH 01/10] chore: update to use tweag/configure-bazel-remote-cache-auth --- .github/actions/configure_bazelrc/action.yaml | 21 ++++ .../actions/create_bazelrc_tmp/action.yaml | 26 +++++ .github/workflows/workflow.yaml | 96 ++++++++++++------- 3 files changed, 110 insertions(+), 33 deletions(-) create mode 100644 .github/actions/configure_bazelrc/action.yaml create mode 100644 .github/actions/create_bazelrc_tmp/action.yaml diff --git a/.github/actions/configure_bazelrc/action.yaml b/.github/actions/configure_bazelrc/action.yaml new file mode 100644 index 000000000..203638538 --- /dev/null +++ b/.github/actions/configure_bazelrc/action.yaml @@ -0,0 +1,21 @@ +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 + +runs: + using: composite + steps: + - shell: bash + env: + BAZELRC: ${{ inputs.bazelrc_path }} + run: | + cat >>"${BAZELRC}" <> "$GITHUB_OUTPUT" diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index f0a9910ef..b19db9df9 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -39,22 +39,35 @@ jobs: - uses: cachix/install-nix-action@v23 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 <> "$GITHUB_OUTPUT" + - 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}" <>$HOME/.bazelrc <>$HOME/.bazelrc < Date: Mon, 27 Nov 2023 12:40:46 -0700 Subject: [PATCH 02/10] Add debug code --- .github/workflows/workflow.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index b19db9df9..0010fdccc 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -36,15 +36,16 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + # DO NOT MERGE + # TODO: Remove CHUCK DEBUG + - name: CHUCK DEBUG + shell: bash + run: | + ls -l .github >&2 + tree >&2 .github - uses: cachix/install-nix-action@v23 with: nix_path: nixpkgs=./docs/nixpkgs.nix - # - name: Create working copy of .bazelrc for updates - # id: create_bazelrc_tmp - # run: | - # bazelrc_tmp=".bazelrc.ci.tmp" - # cp .bazelrc.ci "${bazelrc_tmp}" - # echo "BAZELRC_TMP=${bazelrc_tmp}" >> "$GITHUB_OUTPUT" - uses: ./.github/actions/create_bazelrc_tmp id: create_bazelrc_tmp with: From 63c4383a4e68aec4eaeee902b449eefc084509a5 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Mon, 27 Nov 2023 12:46:25 -0700 Subject: [PATCH 03/10] More debug --- .github/workflows/workflow.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 0010fdccc..fa7eed26d 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -41,8 +41,14 @@ jobs: - name: CHUCK DEBUG shell: bash run: | + echo >&2 ".github dir" ls -l .github >&2 - tree >&2 .github + 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 From 310755a65e5368bc5818cbcbdf4cb548d7ff6332 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Mon, 27 Nov 2023 12:50:56 -0700 Subject: [PATCH 04/10] More debug --- .github/workflows/workflow.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index fa7eed26d..779c3241a 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -41,6 +41,8 @@ jobs: - 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" From f8cac49a78444d1a875f27f61cb70f58b23c89de Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Mon, 27 Nov 2023 13:02:34 -0700 Subject: [PATCH 05/10] Consolidate bazelrc config to a single action --- .github/actions/configure_bazelrc/action.yaml | 26 +++++-- .../actions/create_bazelrc_tmp/action.yaml | 26 ------- .github/workflows/workflow.yaml | 74 +------------------ 3 files changed, 23 insertions(+), 103 deletions(-) delete mode 100644 .github/actions/create_bazelrc_tmp/action.yaml diff --git a/.github/actions/configure_bazelrc/action.yaml b/.github/actions/configure_bazelrc/action.yaml index 203638538..284bf92aa 100644 --- a/.github/actions/configure_bazelrc/action.yaml +++ b/.github/actions/configure_bazelrc/action.yaml @@ -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}" <> "$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}" <> "$GITHUB_OUTPUT" diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 779c3241a..7f5c55b1a 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -36,47 +36,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}" <>$HOME/.bazelrc < Date: Mon, 27 Nov 2023 13:06:01 -0700 Subject: [PATCH 06/10] Pass buildbuddy_api_key into action --- .github/actions/configure_bazelrc/action.yaml | 5 ++++- .github/workflows/workflow.yaml | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/configure_bazelrc/action.yaml b/.github/actions/configure_bazelrc/action.yaml index 284bf92aa..e5d56ca42 100644 --- a/.github/actions/configure_bazelrc/action.yaml +++ b/.github/actions/configure_bazelrc/action.yaml @@ -5,6 +5,9 @@ inputs: 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 @@ -22,7 +25,7 @@ runs: # TODO: Update with the correct tagged release. - uses: tweag/configure-bazel-remote-cache-auth@fix_output with: - buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }} + buildbuddy_api_key: ${{ inputs.buildbuddy_api_key }} bazelrc_path: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }} - shell: bash diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 7f5c55b1a..87cd8321d 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -40,6 +40,8 @@ jobs: with: nix_path: nixpkgs=./docs/nixpkgs.nix - 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: | @@ -84,6 +86,8 @@ jobs: with: nix_path: nixpkgs=./nixpkgs.nix - uses: ./.github/actions/configure_bazelrc + with: + buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }} - name: Build & test run: | skip() { From 5902d1f85dba2f25ab9c3e50778a44d825698c76 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Mon, 27 Nov 2023 13:12:45 -0700 Subject: [PATCH 07/10] More debug --- .github/actions/configure_bazelrc/action.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/configure_bazelrc/action.yaml b/.github/actions/configure_bazelrc/action.yaml index e5d56ca42..9e6f6534a 100644 --- a/.github/actions/configure_bazelrc/action.yaml +++ b/.github/actions/configure_bazelrc/action.yaml @@ -17,6 +17,9 @@ runs: env: BAZELRC: ${{ inputs.bazelrc_path }} run: | + # DEBUG BEGIN + set -x + # DEBUG END bazelrc_tmp="${BAZELRC}.tmp" cp "${BAZELRC}" "${bazelrc_tmp}" echo "bazelrc_tmp=${bazelrc_tmp}" >> "$GITHUB_OUTPUT" From 284e34f6557e5a84a6f3c08df9422169b1a567bc Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Mon, 27 Nov 2023 13:16:18 -0700 Subject: [PATCH 08/10] Reference outputs properly --- .github/actions/configure_bazelrc/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/configure_bazelrc/action.yaml b/.github/actions/configure_bazelrc/action.yaml index 9e6f6534a..e58e0d4d3 100644 --- a/.github/actions/configure_bazelrc/action.yaml +++ b/.github/actions/configure_bazelrc/action.yaml @@ -29,11 +29,11 @@ runs: - uses: tweag/configure-bazel-remote-cache-auth@fix_output with: buildbuddy_api_key: ${{ inputs.buildbuddy_api_key }} - bazelrc_path: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }} + bazelrc_path: ${{ steps.create_bazelrc_tmp.outputs.bazelrc_tmp }} - shell: bash env: - BAZELRC_TMP: ${{ steps.create_bazelrc_tmp.bazelrc_tmp }} + BAZELRC_TMP: ${{ steps.create_bazelrc_tmp.outputs.bazelrc_tmp }} run: | cat >>"${BAZELRC_TMP}" < Date: Mon, 27 Nov 2023 13:18:56 -0700 Subject: [PATCH 09/10] Remove debug code --- .github/actions/configure_bazelrc/action.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/actions/configure_bazelrc/action.yaml b/.github/actions/configure_bazelrc/action.yaml index e58e0d4d3..07b6e30ee 100644 --- a/.github/actions/configure_bazelrc/action.yaml +++ b/.github/actions/configure_bazelrc/action.yaml @@ -17,9 +17,6 @@ runs: env: BAZELRC: ${{ inputs.bazelrc_path }} run: | - # DEBUG BEGIN - set -x - # DEBUG END bazelrc_tmp="${BAZELRC}.tmp" cp "${BAZELRC}" "${bazelrc_tmp}" echo "bazelrc_tmp=${bazelrc_tmp}" >> "$GITHUB_OUTPUT" From ba810834fcc8f66aafe235881518430090c8bbb5 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Tue, 28 Nov 2023 17:34:02 -0700 Subject: [PATCH 10/10] Update to use v0 tag --- .github/actions/configure_bazelrc/action.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/configure_bazelrc/action.yaml b/.github/actions/configure_bazelrc/action.yaml index 07b6e30ee..ad72a50bb 100644 --- a/.github/actions/configure_bazelrc/action.yaml +++ b/.github/actions/configure_bazelrc/action.yaml @@ -20,10 +20,7 @@ runs: 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 + - 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 }}