Skip to content

Commit 096e5a9

Browse files
committed
feat: add pre-commit Github Actions workflow
1 parent 6f4feee commit 096e5a9

2 files changed

Lines changed: 87 additions & 13 deletions

File tree

.editorconfig

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1-
[*.{kt,kts}]
2-
indent_size=4
1+
root = true
2+
3+
[*]
4+
tab_width = 4
5+
end_of_line = lf
6+
max_line_length = 100
7+
ij_visual_guides = 100
38
insert_final_newline = true
4-
ij_kotlin_imports_layout=*
5-
ktlint_code_style=intellij_idea
6-
ktlint_function_naming_ignore_when_annotated_with = Composable
7-
max_line_length = 120
9+
trim_trailing_whitespace = true
10+
11+
[*.{js,py,html}]
12+
charset = utf-8
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yml,yaml}]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[Makefile]
22+
indent_style = tab
823

9-
# Do not apply the general rule to generated files
10-
[**/generated/**/*.{kt,kts}]
11-
indent_size = unset
12-
max_line_length = unset
13-
insert_final_newline = unset
24+
[.flake8]
25+
indent_style = space
26+
indent_size = 2
1427

15-
[**/*{t,T}est/kotlin/**.kt]
16-
ktlint_standard_class-signature = disabled
28+
[*.py]
29+
indent_style = space
30+
indent_size = 4

.github/workflows/pre-commit.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Lint with Pre-commit
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
gradle-code-quality:
11+
name: Gradle Code Quality
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
java-version: [21, 25]
17+
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v5
25+
26+
- name: Set up JDK ${{ matrix.java-version }}
27+
uses: actions/setup-java@v5
28+
with:
29+
distribution: temurin
30+
java-version: ${{ matrix.java-version }}
31+
32+
- name: Setup Gradle
33+
uses: gradle/actions/setup-gradle@v5
34+
with:
35+
build-scan-publish: true
36+
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
37+
build-scan-terms-of-use-agree: "yes"
38+
39+
- name: Set up Python (for pre-commit)
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: '3.13'
43+
44+
- name: Install pre-commit
45+
run: pip install pre-commit
46+
47+
- name: Run pre-commit hooks
48+
id: precommit
49+
run: |
50+
chmod +x ./gradlew
51+
pre-commit run --all-files --show-diff-on-failure --color always
52+
53+
- name: Upload reports
54+
if: always()
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: reports-jdk-${{ matrix.java-version }}
58+
path: |
59+
build/reports/
60+
**/build/reports/

0 commit comments

Comments
 (0)