Skip to content

Commit

Permalink
Migrate to using bazel-contrub/setup-bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Jul 12, 2024
1 parent ca021de commit 67822a5
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 81 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: bazelbuild/setup-bazelisk@v2

- name: Mount bazel action cache
uses: actions/cache@v2
with:
path: "~/.cache/bazel"
key: bazel

- name: Mount bazel repo cache
uses: actions/cache@v2
- uses: bazel-contrib/[email protected]
with:
path: "~/.cache/bazel-repo"
key: bazel-repo
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: true
# Share repository cache between workflows.
repository-cache: true

- name: bzlmod tests and lints
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: (cd examples/tests_and_lints && bazel --bazelrc=../../.github/workflows/ci.bazelrc test --enable_bzlmod //...)
24 changes: 8 additions & 16 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,16 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: bazelbuild/setup-bazelisk@v2

- name: Mount bazel action cache
uses: actions/cache@v2
with:
path: "~/.cache/bazel"
key: bazel

- name: Mount bazel repo cache
uses: actions/cache@v2
- uses: bazel-contrib/[email protected]
with:
path: "~/.cache/bazel-repo"
key: bazel-repo

# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: true
# Share repository cache between workflows.
repository-cache: true

- name: Run format
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: ./tools/format.sh

- name: Check no changes
Expand Down
24 changes: 8 additions & 16 deletions .github/workflows/gazelle_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,14 @@ jobs:
distribution: "zulu"
java-version: "21"

- uses: bazelbuild/setup-bazelisk@v2

# - name: Mount bazel action cache
# uses: actions/cache@v2
# with:
# path: "~/.cache/bazel"
# key: bazel
#
# - name: Mount bazel repo cache
# uses: actions/cache@v2
# with:
# path: "~/.cache/bazel-repo"
# key: bazel-repo
- uses: bazel-contrib/[email protected]
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: true
# Share repository cache between workflows.
repository-cache: true

- name: bzlmod gazelle
# env:
# # Bazelisk will download bazel to here, ensure it is cached between runs.
# XDG_CACHE_HOME: ~/.cache/bazel-repo
run: (cd examples/gazelle && bazelisk --bazelrc=../../.github/workflows/ci.bazelrc run --enable_bzlmod //:gazelle && bazelisk --bazelrc=../../.github/workflows/ci.bazelrc test --enable_bzlmod //...)
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: bazel test //...
env:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
- name: Prepare release
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
Expand Down
24 changes: 8 additions & 16 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,14 @@ jobs:
distribution: "zulu"
java-version: "21"

- uses: bazelbuild/setup-bazelisk@v2

- name: Mount bazel action cache
uses: actions/cache@v2
with:
path: "~/.cache/bazel"
key: bazel

- name: Mount bazel repo cache
uses: actions/cache@v2
- uses: bazel-contrib/[email protected]
with:
path: "~/.cache/bazel-repo"
key: bazel-repo

# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: true
# Share repository cache between workflows.
repository-cache: true

- name: bazel test //... (Java ${{ matrix.java-major-version }})
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazelisk --bazelrc=.github/workflows/ci.bazelrc test ${{ matrix.flags }} //...
22 changes: 7 additions & 15 deletions .github/workflows/tests_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,14 @@ jobs:
distribution: "zulu"
java-version: "21"

- uses: bazelbuild/setup-bazelisk@v2

- name: Mount bazel action cache
uses: actions/cache@v2
with:
path: "~/.cache/bazel"
key: bazel

- name: Mount bazel repo cache
uses: actions/cache@v2
- uses: bazel-contrib/[email protected]
with:
path: "~/.cache/bazel-repo"
key: bazel-repo
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: true
# Share repository cache between workflows.
repository-cache: true

- name: bzlmod gazelle
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazelisk --bazelrc=.github/workflows/ci.bazelrc test //java/gazelle/...

0 comments on commit 67822a5

Please sign in to comment.