Skip to content

Commit 81102b1

Browse files
committed
ci: refactor: update Makefile & ci-test.yml
1 parent 6ef5762 commit 81102b1

File tree

2 files changed

+54
-26
lines changed

2 files changed

+54
-26
lines changed

.github/workflows/ci-test.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
1-
name: CI - Tests
1+
name: CI - Format
22
on:
33
push:
44
branches: ["**"]
55
pull_request:
66
branches: ["**"]
77
workflow_dispatch:
8+
89
jobs:
9-
test:
10-
runs-on: ubuntu-latest
11-
permissions:
12-
contents: read
10+
format:
11+
runs-on: ${{ matrix.os }}
12+
timeout-minutes: 20
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
1318
steps:
1419
- name: Checkout code
1520
uses: actions/checkout@v6.0.1
21+
1622
- name: Set up JDK 21
1723
uses: actions/setup-java@v5
1824
with:
19-
distribution: temurin
20-
java-version: 21
21-
cache: gradle
22-
- name: Grant execute permission for Gradle wrapper
23-
run: chmod +x gradlew
24-
- name: Cache Gradle dependencies
25-
uses: actions/cache@v5
26-
with:
27-
path: |
28-
~/.gradle/caches
29-
~/.gradle/wrapper
30-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
31-
restore-keys: |
32-
${{ runner.os }}-gradle-
33-
- name: Run tests
34-
run: make ci-test
25+
java-version: '21'
26+
distribution: 'corretto'
27+
28+
- name: Check code formatting (Unix)
29+
if: runner.os != 'Windows'
30+
run: make ci-format
31+
32+
- name: Check code formatting (Windows)
33+
if: runner.os == 'Windows'
34+
shell: cmd
35+
run: make ci-format
36+
37+
- name: Verify format scripts exist
38+
if: runner.os == 'Windows'
39+
shell: cmd
40+
run: |
41+
if exist format.bat (echo format.bat found) else (echo Warning: format.bat not found)
42+
if exist format.sh (echo format.sh found) else (echo Warning: format.sh not found)

Makefile

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ else ifeq ($(UNAME_S),Linux)
1717
DETECTED_OS := Linux
1818
else ifeq ($(UNAME_S),Darwin)
1919
DETECTED_OS := MacOS
20+
else ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
21+
DETECTED_OS := Windows
22+
else ifeq ($(findstring MSYS,$(UNAME_S)),MSYS)
23+
DETECTED_OS := Windows
24+
else ifeq ($(findstring CYGWIN,$(UNAME_S)),CYGWIN)
25+
DETECTED_OS := Windows
2026
else
2127
DETECTED_OS := Unknown
2228
endif
@@ -64,12 +70,24 @@ test-integration: ## Run integration tests only
6470
##@ Code Quality
6571

6672
format: ## Format code (Java and YAML)
67-
@chmod +x format.sh
68-
@./format.sh
73+
@if [ -f "format.sh" ]; then \
74+
chmod +x format.sh && ./format.sh; \
75+
elif [ -f "format.bat" ]; then \
76+
cmd //c format.bat; \
77+
else \
78+
echo "Error: No format script found (format.sh or format.bat)"; \
79+
exit 1; \
80+
fi
6981

7082
format-check: ## Verify code formatting
71-
@chmod +x format.sh
72-
@./format.sh
83+
@if [ -f "format.sh" ]; then \
84+
chmod +x format.sh && ./format.sh; \
85+
elif [ -f "format.bat" ]; then \
86+
cmd //c format.bat; \
87+
else \
88+
echo "Error: No format script found (format.sh or format.bat)"; \
89+
exit 1; \
90+
fi
7391
@git diff --exit-code || (echo "Formatting issues detected. Run 'make format' to fix." && exit 1)
7492

7593
lint: ## Run linting checks
@@ -200,10 +218,12 @@ install: ## Install and verify development tools
200218
@test -f google-java-format-1.28.0-all-deps.jar || \
201219
curl -L -o google-java-format-1.28.0-all-deps.jar \
202220
https://github.com/google/google-java-format/releases/download/v1.28.0/google-java-format-1.28.0-all-deps.jar
203-
@chmod +x format.sh yamlfmt 2>/dev/null || true
221+
@if [ -f "format.sh" ]; then chmod +x format.sh; fi
222+
@if [ -d "yamlfmt" ]; then chmod +x yamlfmt/* 2>/dev/null || true; fi
204223

205224
verify: ## Verify development environment
206225
@echo "Detected OS: $(DETECTED_OS)"
226+
@echo "Format script: $(FORMAT_SCRIPT)"
207227
@java -version
208228
@$(GRADLE) --version
209229
@docker --version

0 commit comments

Comments
 (0)