-
Notifications
You must be signed in to change notification settings - Fork 71
44 lines (40 loc) · 1.18 KB
/
format-ubuntu.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
name: Check code formatting (Ubuntu)
on:
push:
branches:
- main
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [ published, edited ]
jobs:
build:
name: ${{ matrix.config.os }} formatting
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config: [
{
os: ubuntu-22.04,
checkCodeFormat: true,
},
]
env:
COMPILER_CACHE_VERSION: 1
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CTCACHE_DIR: ${{ github.workspace }}/compiler-cache/ctcache
steps:
- uses: actions/checkout@v4
- name: Check code format
run: |
if [ "${{ matrix.config.checkCodeFormat }}" != "true" ]; then
exit 0
fi
set +x -euo pipefail
sudo apt-get update && sudo apt-get install -y clang-format-14 black
./scripts/format/clang_format.sh
./scripts/format/black.sh
git diff --name-only
git diff --exit-code || (echo "Code formatting failed" && exit 1)