Skip to content

Commit ad68cb0

Browse files
authored
Add github workflows (#2)
- Add pre-commit workflow - Add format workflow - Add clang-tidy workflow - Add test workflow
1 parent a21b540 commit ad68cb0

5 files changed

Lines changed: 91 additions & 4 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build & Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Install Clang 17
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install -y clang-17 clang-tidy-17
17+
- name: Configure build
18+
run: |
19+
CC=clang-17 CXX=clang++-17 cmake -B build \
20+
-DCMAKE_BUILD_TYPE=Debug \
21+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
22+
- name: Build
23+
run: |
24+
cmake --build build -- -j$(nproc)
25+
- name: Run tests
26+
run: |
27+
build/src/test/pdf-test-main
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: clang-format
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
clang-format:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{ github.head_ref }}
15+
fetch-depth: 2
16+
- uses: jayllyz/clang-format-action@v1
17+
with:
18+
clang-version: 17
19+
- name: Commit changes
20+
uses: stefanzweifel/git-auto-commit-action@v5
21+
with:
22+
commit_message: "style: clang format files"
23+
branch: ${{ github.head_ref }}

.github/workflows/clang-tidy.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: clang-tidy
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
tidy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Install Clang 17
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install -y clang-17 clang-tidy-17
17+
- name: Configure build
18+
run: |
19+
CC=clang-17 CXX=clang++-17 cmake -B build \
20+
-DCMAKE_BUILD_TYPE=Debug \
21+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
22+
- name: Run clang-tidy
23+
run: |
24+
find . -iname '*.c' | \
25+
xargs clang-tidy-17 \
26+
-extra-arg="-UTEST" \
27+
--config-file=./.clang-tidy \
28+
-p build

.github/workflows/pre-commit.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: pre-commit/action@v3.0.1

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ repos:
66
- id: end-of-file-fixer
77
- id: check-yaml
88
- id: check-added-large-files
9-
- repo: https://github.com/pocc/pre-commit-hooks
10-
rev: v1.3.5
11-
hooks:
12-
- id: clang-format
139
- repo: https://github.com/crate-ci/typos
1410
rev: v1.16.5
1511
hooks:

0 commit comments

Comments
 (0)