-
Notifications
You must be signed in to change notification settings - Fork 26
70 lines (56 loc) · 1.5 KB
/
ci.yml
File metadata and controls
70 lines (56 loc) · 1.5 KB
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
name: ci
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
clang-format-check:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Run clang-format check
run: |
clang-format --version
files=$(git ls-files '*.cc' '*.cpp' '*.h' '*.hpp')
[ -z "$files" ] || clang-format --dry-run --Werror $files
build:
name: Bazel tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: [clang-format-check] # Don't run build if format check fails
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Bazel
uses: bazel-contrib/setup-bazel@0.14.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: Install clang-format (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Install clang-format (macOS)
if: runner.os == 'macOS'
run: |
brew install clang-format
- name: Bazel tests
run: bazel test src:all