-
Notifications
You must be signed in to change notification settings - Fork 14
66 lines (53 loc) · 2.2 KB
/
check_format.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
#
# Distributed Linear Algebra with Future (DLAF)
#
# Copyright (c) 2018-2024, ETH Zurich
# All rights reserved.
#
# Please, refer to the LICENSE file in the root directory.
# SPDX-License-Identifier: BSD-3-Clause
#
name: Check format
on:
- pull_request
jobs:
check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/javascript-action@v1
- name: Install tools
run: |
# Need non buggy version of clang-format-18 (See #1174).
wget -qO llvm.key https://apt.llvm.org/llvm-snapshot.gpg.key
echo "ce6eee4130298f79b0e0f09a89f93c1bc711cd68e7e3182d37c8e96c5227e2f0 llvm.key" > check.sha256
shasum -c check.sha256
cat llvm.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list > /dev/null
sudo apt-get update
sudo apt-get install --no-install-recommends clang-format-18 python3 python3-pip
pip3 install --break-system-packages black==24.4.2
pip3 install --break-system-packages cmakelang==0.6.13
- name: Fetch master
run: git fetch --no-tags --depth=1 origin +refs/heads/master:refs/heads/master
# Fails if there are tabs in source files.
- name: Check formatting
run: ./.github/format.sh
- name: Check scripts formatting
if: always()
run: black --line-length 105 scripts/
# Fails if there are differences.
- name: Formatting issues
if: always()
run: git diff --color --exit-code
- name: Check include guards
if: always()
run: |
find . test -type f '(' -name "*.h" -o -name "*.h.in" ')' \
| xargs -I{} sh -c \
"egrep -sq '^#pragma once' {} || echo {}" \
> pragma-once.check
for filepath in `cat pragma-once.check`; do \
echo "::error file=$filepath,line=1::missing include guard in $filepath"; \
done
test ! -s pragma-once.check