forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (57 loc) · 2.3 KB
/
kotlin-style.yaml
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
67
68
69
70
name: Kotlin
on:
pull_request:
paths:
- "**/*.kt"
- ".github/workflows/kotlin-style.yaml"
- "kotlin-detect-config.yaml"
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true
jobs:
detekt:
name: Static code analysis
runs-on: ubuntu-latest
steps:
- name: "checkout"
uses: actions/checkout@v4
- name: "detekt"
uses: natiginfo/[email protected]
# Detekt seems not to like circular symlinks, so we set up
# explicit paths below
#
# In particular, if symlinks exist and recurse, detekt tries to
# follow, so for example `examples/android/CHIPTest` as a path
# will never end (and eventually run out of HEAP) because
# `examples/android/CHIPTest/third_party/connectedhomeip` is
# circular
with:
args: --parallel --build-upon-default-config --config kotlin-detect-config.yaml --input examples/android/CHIPTest/app,examples/android/CHIPTool,examples/java-matter-controller/java,src/controller/java
ktlint:
name: "Format check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Download ktfmt
run: |
cd /tmp
wget "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.44/ktfmt-0.44-jar-with-dependencies.jar"
- name: Format kotlin files
run: |
find src examples -name '*.kt' \
| xargs java -jar /tmp/ktfmt-0.44-jar-with-dependencies.jar --google-style
- name: Ensure git works in current working directory
run: git config --global --add safe.directory `pwd`
- name: Check for uncommited changes
run: |
git add .
# Show the full diff
git diff-index -p HEAD --
# Also show just the files that are different, to make it easy
# to tell at a glance what might be going on. And throw in
# --exit-code to make this job fail if there is a difference.
git diff-index --exit-code HEAD --