From 41c67e2b4061c22ada2ec2981728618eb1a68127 Mon Sep 17 00:00:00 2001 From: Elvis Wianda Date: Thu, 28 Dec 2023 09:02:50 -0500 Subject: [PATCH] Implement bzlmod --- .bazelversion | 2 +- .github/workflows/ci.yaml | 21 ++++++ .github/workflows/workspace_snippet.sh | 16 ++++- .gitignore | 3 - MODULE.bazel | 30 +++++++++ WORKSPACE | 17 +++-- WORKSPACE.bzlmod | 0 deps.bzl | 90 ++++++++------------------ go.mod | 16 +++++ go.sum | 87 +++++++++++++++++++++++++ 10 files changed, 206 insertions(+), 76 deletions(-) create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bzlmod create mode 100644 go.mod create mode 100644 go.sum diff --git a/.bazelversion b/.bazelversion index 8a30e8f..19b860c 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -5.4.0 +6.4.0 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 56eb1a4..4ed2a14 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,3 +33,24 @@ jobs: # Bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo run: bazel test //... + test_bzlmod: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - name: Mount bazel caches + uses: actions/cache@v2 + with: + path: | + "~/.cache/bazel" + "~/.cache/bazel-repo" + key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', '**/*.js') }} + restore-keys: bazel-cache- + - name: bazel test //... --enable_bzlmod + env: + # Bazelisk will download bazel to here + XDG_CACHE_HOME: ~/.cache/bazel-repo + run: bazel test //... --enable_bzlmod diff --git a/.github/workflows/workspace_snippet.sh b/.github/workflows/workspace_snippet.sh index 3b90d07..b768e25 100755 --- a/.github/workflows/workspace_snippet.sh +++ b/.github/workflows/workspace_snippet.sh @@ -8,8 +8,22 @@ NAME=rules_nodejs_gazelle COMMIT=$(git rev-parse HEAD) PREFIX=${NAME}-${COMMIT} SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${COMMIT} | gzip | shasum -a 256 | awk '{print $1}') +INTEGRITY=$(git archive --format=tar --prefix=${PREFIX}/ ${COMMIT} | gzip | openssl dgst -sha256 -binary | openssl base64 -A) + +cat <