Skip to content

Commit 41614ed

Browse files
Merge pull request #2161 from j2kun:ci-cache-key
PiperOrigin-RevId: 800597258
2 parents cd0dd55 + 168b711 commit 41614ed

File tree

3 files changed

+19
-62
lines changed

3 files changed

+19
-62
lines changed

.github/workflows/build_and_test.yml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
check-cache:
1515
runs-on:
1616
labels: ubuntu-22.04-8core
17-
outputs:
18-
runner: ${{ steps.runner.outputs.runner }}
1917
steps:
2018
- name: Check out repository code
2119
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
@@ -26,50 +24,37 @@ jobs:
2624
with:
2725
path: |
2826
~/.cache/bazel
29-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
27+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
3028
restore-keys: |
31-
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
29+
${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
3230
lookup-only: true
33-
- name: Select runner
34-
id: runner
35-
env:
36-
CACHE_HIT: ${{ steps.cache.outputs.cache-hit == 'true' }}
37-
run: |
38-
set -euo pipefail
39-
40-
if [[ "${CACHE_HIT}" == "true" ]]; then
41-
echo "runner=ubuntu-22.04-8core" >> "$GITHUB_OUTPUT"
42-
else
43-
echo "runner=ubuntu-22.04-32core" >> "$GITHUB_OUTPUT"
44-
fi
4531

4632
build-and-test:
4733
needs: check-cache
4834
runs-on:
49-
labels: ${{ needs.check-cache.outputs.runner }}
35+
labels: ubuntu-22.04-32core
5036
steps:
5137
- name: Install dependencies
5238
run: |
53-
sudo apt-get update
5439
sudo apt-get install -y libomp-dev
5540
- name: Check out repository code
5641
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
5742
with:
58-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
43+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
5944

6045
- name: Cache bazel build artifacts
6146
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # pin@v4.2.0
6247
with:
6348
path: |
6449
~/.cache/bazel
65-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
50+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
6651
restore-keys: |
67-
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
52+
${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
6853
6954
- name: "Run `bazel build`"
7055
run: |
71-
bazel build --incompatible_strict_action_env -c opt //...
56+
bazel build -c opt //...
7257
7358
- name: "Run `bazel test`"
7459
run: |
75-
bazel test --incompatible_strict_action_env -c opt //...
60+
bazel test -c opt //...

.github/workflows/build_and_test_macos.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
if: github.event_name != 'pull_request' || github.event.label.name == 'ci:macos'
1515
runs-on:
1616
labels: macos-15
17-
outputs:
18-
runner: ${{ steps.runner.outputs.runner }}
1917
steps:
2018
- name: Check out repository code
2119
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
@@ -26,42 +24,30 @@ jobs:
2624
with:
2725
path: |
2826
~/.cache/bazel
29-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
27+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
3028
restore-keys: |
31-
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
29+
${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
3230
lookup-only: true
33-
- name: Select runner
34-
id: runner
35-
env:
36-
CACHE_HIT: ${{ steps.cache.outputs.cache-hit == 'true' }}
37-
run: |
38-
set -euo pipefail
39-
40-
if [[ "${CACHE_HIT}" == "true" ]]; then
41-
echo "runner=macos-15" >> "$GITHUB_OUTPUT"
42-
else
43-
echo "runner=macos-15" >> "$GITHUB_OUTPUT"
44-
fi
4531

4632
build-and-test:
4733
if: github.event_name != 'pull_request' || github.event.label.name == 'ci:macos'
4834
needs: check-cache
4935
runs-on:
50-
labels: ${{ needs.check-cache.outputs.runner }}
36+
labels: macos-15
5137
steps:
5238
- name: Check out repository code
5339
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
5440
with:
55-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
41+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
5642

5743
- name: Cache bazel build artifacts
5844
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # pin@v4.2.0
5945
with:
6046
path: |
6147
~/.cache/bazel
62-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
48+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
6349
restore-keys: |
64-
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
50+
${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
6551
6652
- name: Install coreutils
6753
run: brew install coreutils

.github/workflows/docs.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ jobs:
1313
check-cache:
1414
runs-on:
1515
labels: ubuntu-22.04-8core
16-
outputs:
17-
runner: ${{ steps.runner.outputs.runner }}
1816
steps:
1917
- name: Check out repository code
2018
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
@@ -25,27 +23,15 @@ jobs:
2523
with:
2624
path: |
2725
~/.cache/bazel
28-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
26+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
2927
restore-keys: |
30-
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
28+
${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
3129
lookup-only: true
32-
- name: Select runner
33-
id: runner
34-
env:
35-
CACHE_HIT: ${{ steps.cache.outputs.cache-hit == 'true' }}
36-
run: |
37-
set -euo pipefail
38-
39-
if [[ "${CACHE_HIT}" == "true" ]]; then
40-
echo "runner=ubuntu-22.04-8core" >> "$GITHUB_OUTPUT"
41-
else
42-
echo "runner=ubuntu-22.04-32core" >> "$GITHUB_OUTPUT"
43-
fi
4430

4531
build-and-deploy:
4632
needs: check-cache
4733
runs-on:
48-
labels: ${{ needs.check-cache.outputs.runner }}
34+
labels: ubuntu-22.04-32core
4935
permissions:
5036
contents: write
5137
steps:
@@ -58,9 +44,9 @@ jobs:
5844
with:
5945
path: |
6046
~/.cache/bazel
61-
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
47+
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
6248
restore-keys: |
63-
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
49+
${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
6450
6551
# This requires building mlir-tblgen, but may not require a full llvm build
6652
# as a result. It results in the files being added to their respective

0 commit comments

Comments
 (0)