-
Notifications
You must be signed in to change notification settings - Fork 11
57 lines (47 loc) · 1.47 KB
/
ci.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
name: CI
on:
push:
branches:
- master
paths-ignore:
- 'ACKNOWLEDGMENTS'
- 'AUTHORS'
- 'COPYING'
- 'COPYING_ADDENDUM'
- 'docs/**'
- 'README.md'
pull_request:
branches:
- master
paths-ignore:
- 'ACKNOWLEDGMENTS'
- 'AUTHORS'
- 'COPYING'
- 'COPYING_ADDENDUM'
- 'docs/**'
- 'README.md'
jobs:
format:
runs-on: ubuntu-latest
env:
CLANG_FORMAT_VERSION: 13
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Install package dependencies
run: sudo apt-get install -y clang-format-${{ env.CLANG_FORMAT_VERSION }}
- name: Set git configuration
run: git config --global clangFormat.binary clang-format-${{ env.CLANG_FORMAT_VERSION }}
- name: Check formatting (push to feature branch)
if: github.ref != 'refs/heads/master' && github.event_name == 'push'
run: test/scripts/gh_format.sh origin/master
- name: Check formatting (push to master branch or pull request merge)
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: test/scripts/gh_format.sh ${{ github.event.before }}
- name: Check formatting (pull request)
if: github.event_name == 'pull_request'
run: test/scripts/gh_format.sh origin/${{ github.base_ref }}