Skip to content

Commit 40f51bc

Browse files
committed
refactor CI configuration for improved clarity and performance
1 parent b6eb759 commit 40f51bc

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ jobs:
2020
uses: dtolnay/rust-toolchain@stable
2121
with:
2222
toolchain: nightly
23-
components: rustc-dev llvm-tools, cargo
24-
25-
# 3. Cargo Caching (Crucial for speed)
26-
- name: Cache cargo dependencies
27-
uses: Swatinem/rust-cache@v2
23+
components: rustc-dev llvm-tools cargo
2824

2925
# 4. Set up Java
3026
- name: Set up Java
@@ -39,14 +35,22 @@ jobs:
3935
with:
4036
python-version: '3.x'
4137

42-
# 6. Set up Gradle)
38+
# 6. Set up Gradle
4339
- name: Set up Gradle
4440
uses: gradle/actions/setup-gradle@v4
4541

46-
# 7. Build using the CI-specific make target
42+
# 7. Make just the files needed to cargo cache
43+
- name: Make Gen Files
44+
run: make gen-files
45+
46+
# 8. Cargo Caching (Crucial for speed)
47+
- name: Cache cargo dependencies
48+
uses: Swatinem/rust-cache@v2
49+
50+
# 9. Build using the CI-specific make target
4751
- name: Build CI Target
4852
run: make ci # Use your optimized CI build command
4953

50-
# 8. Run tests
54+
# 10. Run tests
5155
- name: Run integration tests
5256
run: python3 Tester.py

Makefile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ LIBRARY_DIR := library
1616
LIBRARY_JAR := $(LIBRARY_DIR)/build/libs/library-0.1.0.jar
1717

1818
# === Default Target ===
19+
ifeq ($(IS_CI),1)
20+
all: rust java-linker asm-processor
21+
@echo "$(GREEN)✨ Build complete in CI mode! ✨$(RESET)"
22+
else
1923
all: rust gen-files java-linker asm-processor
2024
@echo "$(GREEN)✨ Build complete! ✨$(RESET)"
25+
endif
2126

2227
# === CI Target ===
23-
# Running "make ci" sets IS_CI=1 and then behaves exactly like "make all"
2428
ci:
2529
$(MAKE) all IS_CI=1
2630

@@ -89,22 +93,38 @@ clean-shim-metadata-gen:
8993
# === ASM Processor (Gradle) ===
9094
asm-processor:
9195
@echo "$(CYAN)⚙️ Building ASM processor...$(RESET)"
96+
ifeq ($(IS_CI),1)
97+
cd $(ASM_PROCESSOR_DIR) && gradle --no-daemon shadowJar
98+
else
9299
cd $(ASM_PROCESSOR_DIR) && gradle shadowJar
100+
endif
93101

94102
clean-asm-processor:
95103
@echo "$(CYAN)🧹 Cleaning ASM processor...$(RESET)"
104+
ifeq ($(IS_CI),1)
105+
cd $(ASM_PROCESSOR_DIR) && gradle --no-daemon clean
106+
else
96107
cd $(ASM_PROCESSOR_DIR) && gradle clean
108+
endif
97109

98110
# === Standard Library Shim (Gradle) ===
99111
library: $(LIBRARY_JAR)
100112

101113
$(LIBRARY_JAR):
102114
@echo "$(CYAN)📚 Building standard library shim...$(RESET)"
115+
ifeq ($(IS_CI),1)
116+
cd $(LIBRARY_DIR) && gradle --no-daemon build && cd build/distributions && unzip -o library-0.1.0.zip
117+
else
103118
cd $(LIBRARY_DIR) && gradle build && cd build/distributions && unzip -o library-0.1.0.zip
119+
endif
104120

105121
clean-library:
106122
@echo "$(CYAN)🧹 Cleaning library shim...$(RESET)"
123+
ifeq ($(IS_CI),1)
124+
cd $(LIBRARY_DIR) && gradle --no-daemon clean
125+
else
107126
cd $(LIBRARY_DIR) && gradle clean
127+
endif
108128

109129
# === Generate files from templates ===
110130
gen-files: clean-gen-files
@@ -118,4 +138,4 @@ clean-gen-files:
118138

119139
# === Clean All ===
120140
clean: clean-rust clean-java-linker clean-asm-processor clean-library clean-shim-metadata-gen clean-gen-files
121-
@echo "$(GREEN)🧼 All clean!$(RESET)"
141+
@echo "$(GREEN)🧼 All clean!$(RESET)"

0 commit comments

Comments
 (0)