Skip to content

Commit 6446568

Browse files
committed
Run clang-format check during CI
Signed-off-by: Adrian Reber <areber@redhat.com>
1 parent acbbc28 commit 6446568

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/lint.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Run code linter
2+
3+
on: [push, pull_request]
4+
5+
# Cancel any preceding run on the pull request.
6+
concurrency:
7+
group: lint-test-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: ${{ github.ref != 'refs/heads/criu-dev' }}
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
container:
14+
image: registry.fedoraproject.org/fedora:latest
15+
steps:
16+
- name: Install tools
17+
run: sudo dnf -y install git make clang-tools-extra which git-clang-format
18+
19+
- uses: actions/checkout@v4
20+
21+
- name: Set git safe directory
22+
# https://github.com/actions/checkout/issues/760
23+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
24+
25+
- name: Run make indent
26+
run: |
27+
if [ -z "${{github.base_ref}}" ]; then
28+
git fetch --deepen=1
29+
git clang-format --style file --extensions c,h "HEAD~1"
30+
else
31+
git fetch origin ${{github.base_ref}}
32+
git clang-format --style file --extensions c,h origin/${{github.base_ref}}
33+
fi

src/cd-paranoia.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ static void cleanup(void) {
643643
}
644644
if (reportfile_open) {
645645
if (reportfile)
646-
fclose(reportfile);
646+
fclose(reportfile);
647647
reportfile = NULL;
648648
}
649649
}

0 commit comments

Comments
 (0)