-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (89 loc) · 2.45 KB
/
format-check.yml
File metadata and controls
106 lines (89 loc) · 2.45 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Code Format Check
on:
pull_request:
branches: [ main, master ]
paths:
- 'java-tests/**/*.java'
- 'java-tests/pom.xml'
- 'python-tests/**/*.py'
- 'go-tests/**/*.go'
- 'go-tests/go.mod'
- 'go-tests/go.sum'
push:
branches: [ main, master ]
paths:
- 'java-tests/**/*.java'
- 'java-tests/pom.xml'
- 'python-tests/**/*.py'
- 'go-tests/**/*.go'
- 'go-tests/go.mod'
- 'go-tests/go.sum'
jobs:
java-format-check:
name: Check Java Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Check code format with Spotless
run: |
cd java-tests
mvn spotless:check
- name: Format check failed
if: failure()
run: |
echo "❌ Java code format check failed!"
echo "Run: cd java-tests && mvn spotless:apply"
exit 1
python-format-check:
name: Check Python Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install formatting tools
run: pip install black flake8
- name: Check code format with black
run: |
cd python-tests
black --check tests/
- name: Check code style with flake8
run: |
cd python-tests
flake8 tests/ --max-line-length=100 --extend-ignore=E203,W503
- name: Format check failed
if: failure()
run: |
echo "❌ Python code format check failed!"
echo "Run: cd python-tests && black tests/"
exit 1
go-format-check:
name: Check Go Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Check code format with gofmt
run: |
cd go-tests
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "❌ Unformatted files:"
echo "$unformatted"
echo "Run: cd go-tests && gofmt -w ."
exit 1
fi