-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (125 loc) · 3.95 KB
/
tests.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
name: Run tests
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "30 8 * * *" # runs every day at 8:30 am
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
strategy:
matrix:
bazel-version:
- 6.x
- 7.x
runner:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- macos-13
- macos-14
- macos-15
- windows-2019
- windows-2022
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Look up cache if it's not a scheduled job
if: ${{ github.event_name != 'schedule' }}
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.cache
key: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ runner.os }}-${{ hashFiles('.bazelrc', 'WORKSPACE', 'MODULE.bazel') }}
restore-keys: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ runner.os }}-
- name: Set up
uses: ./.github/actions/setup
with:
bazel-version: ${{ matrix.bazel-version }}
- name: Run unit tests
shell: bash
run: ./development/cli/execute_tests.bash
example:
strategy:
matrix:
bazel-version:
- 6.x
- 7.x
runner:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- macos-13
- macos-14
- macos-15
- windows-2019
- windows-2022
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Look up cache if it's not a scheduled job
if: ${{ github.event_name != 'schedule' }}
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/examples/.cache
key: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ runner.os }}-${{ hashFiles('.bazelrc', 'WORKSPACE', 'MODULE.bazel', 'examples/.bazelrc', 'examples/WORKSPACE', 'examples/MODULE.bazel') }}
restore-keys: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ runner.os }}-
- name: Set up
uses: ./.github/actions/setup
with:
bazel-version: ${{ matrix.bazel-version }}
- name: Validate example
shell: bash
run: ./development/cli/validate_example.bash
style-check:
runs-on: ubuntu-latest
env:
bazel-version: 7.x
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Look up cache if it's not a scheduled job
if: ${{ github.event_name != 'schedule' }}
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.cache
key: ${{ github.repository }}-${{ github.job }}-${{ env.bazel-version }}-${{ runner.os }}-${{ hashFiles('.bazelrc', 'WORKSPACE', 'MODULE.bazel') }}
restore-keys: ${{ github.repository }}-${{ github.job }}-${{ env.bazel-version }}-${{ runner.os }}-
- name: Set up
uses: ./.github/actions/setup
with:
bazel-version: ${{ env.bazel-version }}
- name: Run formatters and linters
shell: bash
run: ./development/cli/style_check.bash
- name: Fail if some files are changed
shell: bash
run: |
if ! git diff --exit-code; then
echo "ERROR: Files are changed by formatters" >&2
exit 1
fi
all-tests-passable:
if: always()
needs:
- unit-test
- example
- style-check
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}