-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (78 loc) · 2.91 KB
/
clang-format.yml
File metadata and controls
90 lines (78 loc) · 2.91 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
# Copyright (C) 2022 Sky UK
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
name: clang-format
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" and "release/*" branches
push:
branches: ["master", "release/*"]
pull_request:
branches: ["master", "release/*"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This runs the clang-format program and processes the results
run-clang-format:
name: Run clang-format
# Runs on ubuntu
runs-on: ubuntu-24.04
# Timeout after
timeout-minutes: 2
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout repo
uses: actions/checkout@v4
# Setup github for python 3.8
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.8
# Install dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install clang-format-18
# Run the prgram with rialto config
- name: Run clang-format
run: |
find . -regex '.*\.\(cpp\|hpp\|cu\|c\|h\)' -exec clang-format-18 -style=file -n --Werror {} \; &> clang-format_errors.log
# Process the clang-format errors and generate a junit xml file
# Generate a failure if errors detected
- name: Process clang-format results
id: create-clang-format-xml
if: failure() || success()
run: python scripts/clang-format/process_clang-format_errors.py
# Report the errors on failure using the xml file
- name: Check results
uses: dorny/test-reporter@v1
if: failure()
with:
name: Clang-format errors
path: clang-format_errors.xml
reporter: java-junit
# Upload logs on failure
- name: Upload logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: |
clang-format_errors.log
clang-format_errors.xml