-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.2 KB
/
bazel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Bazel
on:
workflow_dispatch:
pull_request:
branches: [ main ]
push:
branches: [ main ]
jobs:
bazel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Bazel
uses: bazelbuild/setup-bazelisk@v3
- name: Restore cache
id: restore-cache
uses: actions/cache/restore@v3
with:
path: "~/.cache/bazel"
key: bazel-${{ hashFiles(
'**/*.go',
'go.sum',
'MODULE.bazel.lock',
'**/BUILD.bazel',
'**/*.bzl',
'WORKSPACE'
) }}
restore-keys: bazel-
- name: Check BUILD files
run: |
bazel run //:gazelle_diff
- name: Build
run: |
bazel build //...
- name: Test
run: |
bazel test --test_output=errors //...
- name: Save cache
# Only on merge to main and if previously missed
if: |
github.ref == 'refs/heads/main' &&
github.event_name != 'pull_request' &&
steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: "~/.cache/bazel"
key: ${{ steps.restore-cache.outputs.cache-primary-key }}