From 4b381be638ae4084d217360e1d78b875ea63721e Mon Sep 17 00:00:00 2001 From: David Bernard Date: Thu, 29 Apr 2021 19:58:13 +0200 Subject: [PATCH 1/4] Add example for Bazel --- examples.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples.md b/examples.md index 05482ce..7319a10 100644 --- a/examples.md +++ b/examples.md @@ -39,6 +39,7 @@ - [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods) - [Swift - Swift Package Manager](#swift---swift-package-manager) - [Swift - Mint](#swift---mint) +- [* - Bazel](#---bazel) ## C# - NuGet @@ -657,3 +658,17 @@ steps: restore-keys: | ${{ runner.os }}-mint- ``` + +## * - Bazel + +Bazel cache has a good handle to check if cached content should be rebuild or not based on its inputs like a hash(command + files). So using the latest cache of the branch is enough, no need to suffix with `hashFiles('**/...')`. + +```yaml +- name: Cache Bazel + uses: actions/cache@v2 + with: + path: | + ~/.cache/bazelisk + ~/.cache/bazel + key: ${{ runner.os }}-bazel +``` From ef11f54eee2bfc69a7adcf6cd1b0423068dce940 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sat, 11 Mar 2023 19:40:53 +0100 Subject: [PATCH 2/4] Fix example for Bazel --- examples.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/examples.md b/examples.md index 7319a10..4136623 100644 --- a/examples.md +++ b/examples.md @@ -661,14 +661,18 @@ steps: ## * - Bazel -Bazel cache has a good handle to check if cached content should be rebuild or not based on its inputs like a hash(command + files). So using the latest cache of the branch is enough, no need to suffix with `hashFiles('**/...')`. - ```yaml - name: Cache Bazel - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | - ~/.cache/bazelisk - ~/.cache/bazel - key: ${{ runner.os }}-bazel + ~/.cache/bazel # Linux + /private/var/tmp/_bazel_runner/ # macOS + # TODO Add Windows if you know where it is, based on https://bazel.build/remote/output-directories + key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }} + restore-keys: | + ${{ runner.os }}-bazel- +- run: bazelisk test //... ``` + +[`bazelisk`](https://github.com/bazelbuild/bazelisk) does not have be to separately downloaded and installed because it's already included in GitHub's `ubuntu-latest` base image. From 4b8460cbff54c080fe0d466350af7753cbef5894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vorburger=20=E2=9B=91=EF=B8=8F?= Date: Mon, 13 Mar 2023 10:52:18 +0100 Subject: [PATCH 3/4] Create separate Linux/macOS examples for Bazel --- examples.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/examples.md b/examples.md index 4136623..4a07f6b 100644 --- a/examples.md +++ b/examples.md @@ -661,18 +661,32 @@ steps: ## * - Bazel +[`bazelisk`](https://github.com/bazelbuild/bazelisk) does not have be to separately downloaded and installed because it's already included in GitHub's `ubuntu-latest` base image. + +### Linux + ```yaml - name: Cache Bazel uses: actions/cache@v3 with: path: | - ~/.cache/bazel # Linux - /private/var/tmp/_bazel_runner/ # macOS - # TODO Add Windows if you know where it is, based on https://bazel.build/remote/output-directories + ~/.cache/bazel key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }} restore-keys: | ${{ runner.os }}-bazel- - run: bazelisk test //... ``` -[`bazelisk`](https://github.com/bazelbuild/bazelisk) does not have be to separately downloaded and installed because it's already included in GitHub's `ubuntu-latest` base image. +### macOS + +```yaml +- name: Cache Bazel + uses: actions/cache@v3 + with: + path: | + /private/var/tmp/_bazel_runner/ + key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }} + restore-keys: | + ${{ runner.os }}-bazel- +- run: bazelisk test //... +``` From 6f1f1e10f3bad9846e298e7670d605f5674ddd17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vorburger=20=E2=9B=91=EF=B8=8F?= Date: Mon, 13 Mar 2023 14:26:31 +0100 Subject: [PATCH 4/4] Clarify that macos-latest image has bazelisk --- examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples.md b/examples.md index 4a07f6b..1bcde91 100644 --- a/examples.md +++ b/examples.md @@ -661,7 +661,7 @@ steps: ## * - Bazel -[`bazelisk`](https://github.com/bazelbuild/bazelisk) does not have be to separately downloaded and installed because it's already included in GitHub's `ubuntu-latest` base image. +[`bazelisk`](https://github.com/bazelbuild/bazelisk) does not have be to separately downloaded and installed because it's already included in GitHub's `ubuntu-latest` and `macos-latest` base images. ### Linux