Skip to content

Commit b6eb759

Browse files
committed
hopefully improve CI speed a bit
1 parent a6bed76 commit b6eb759

File tree

2 files changed

+42
-23
lines changed

2 files changed

+42
-23
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,42 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14+
# 1. Checkout Code
1415
- name: Checkout repository
15-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1617

18+
# 2. Set up Rust
1719
- name: Set up Rust (nightly)
18-
uses: actions-rs/toolchain@v1
20+
uses: dtolnay/rust-toolchain@stable
1921
with:
2022
toolchain: nightly
21-
override: true
22-
components: rustc, rust-src, cargo
23+
components: rustc-dev llvm-tools, cargo
2324

25+
# 3. Cargo Caching (Crucial for speed)
26+
- name: Cache cargo dependencies
27+
uses: Swatinem/rust-cache@v2
28+
29+
# 4. Set up Java
2430
- name: Set up Java
25-
uses: actions/setup-java@v3
31+
uses: actions/setup-java@v4
2632
with:
2733
distribution: 'temurin'
2834
java-version: '21'
2935

36+
# 5. Set up Python
3037
- name: Set up Python
31-
uses: actions/setup-python@v4
38+
uses: actions/setup-python@v5
3239
with:
3340
python-version: '3.x'
3441

42+
# 6. Set up Gradle)
3543
- name: Set up Gradle
3644
uses: gradle/actions/setup-gradle@v4
3745

38-
- name: Install dependencies
39-
run: |
40-
sudo apt-get update
41-
sudo apt-get install -y make
42-
43-
- name: Build all components
44-
run: make all
46+
# 7. Build using the CI-specific make target
47+
- name: Build CI Target
48+
run: make ci # Use your optimized CI build command
4549

50+
# 8. Run tests
4651
- name: Run integration tests
47-
run: python3 Tester.py
48-
49-
- name: Cleanup
50-
if: always() # Ensure cleanup runs even if previous steps failed
51-
run: make clean
52+
run: python3 Tester.py

Makefile

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# === Phony Targets ===
22
.PHONY: all help clean rust-components rust clean-rust java-linker clean-java-linker \
33
shim-metadata-gen clean-shim-metadata-gen asm-processor clean-asm-processor \
4-
library clean-library gen-files clean-gen-files
4+
library clean-library gen-files clean-gen-files ci
55

66
# === Terminal Colors ===
77
GREEN := \033[1;32m
@@ -19,12 +19,18 @@ LIBRARY_JAR := $(LIBRARY_DIR)/build/libs/library-0.1.0.jar
1919
all: rust gen-files java-linker asm-processor
2020
@echo "$(GREEN)✨ Build complete! ✨$(RESET)"
2121

22+
# === CI Target ===
23+
# Running "make ci" sets IS_CI=1 and then behaves exactly like "make all"
24+
ci:
25+
$(MAKE) all IS_CI=1
26+
2227
# === Help ===
2328
help:
2429
@echo "$(CYAN)🛠️ Makefile for building the project$(RESET)"
2530
@echo ""
2631
@echo "Available targets:"
2732
@echo " make all - Build all components"
33+
@echo " make ci - Build all components in CI mode (skips rust-components and shim-metadata-gen)"
2834
@echo " make clean - Clean all components"
2935
@echo " make rust-components - Install needed Rust components"
3036
@echo " make rust - Build the Rust root project"
@@ -38,12 +44,18 @@ help:
3844
# === Needed rust components ===
3945
rust-components:
4046
@echo "$(CYAN)🔧 Installing Rust components...$(RESET)"
41-
rustup component add rust-src rustc-dev llvm-tools-preview
47+
rustup component add rustc-dev llvm-tools
4248

4349
# === Rust root project (Cargo) ===
50+
ifeq ($(IS_CI),1)
51+
rust: $(SHIM_METADATA_GEN_DIR)/core.json
52+
@echo "$(CYAN)📦 Building Rust root project...$(RESET)"
53+
cargo build
54+
else
4455
rust: $(SHIM_METADATA_GEN_DIR)/core.json rust-components
4556
@echo "$(CYAN)📦 Building Rust root project...$(RESET)"
4657
cargo build
58+
endif
4759

4860
clean-rust:
4961
@echo "$(CYAN)🧹 Cleaning Rust root project...$(RESET)"
@@ -60,8 +72,14 @@ clean-java-linker:
6072

6173
# === Library Shim Metadata Generator ===
6274
$(SHIM_METADATA_GEN_DIR)/core.json: library
63-
@echo "$(CYAN)🛠️ Generating library shim metadata...$(RESET)"
64-
cd $(SHIM_METADATA_GEN_DIR) && cargo run -- ../$(LIBRARY_JAR) ./core.json
75+
@if [ "$(IS_CI)" = "1" ]; then \
76+
echo "$(CYAN)CI mode: skipping shim-metadata-gen$(RESET)"; \
77+
elif [ -f $@ ]; then \
78+
echo "$(CYAN)core.json already exists, skipping shim-metadata-gen$(RESET)"; \
79+
else \
80+
echo "$(CYAN)🛠️ Generating library shim metadata...$(RESET)"; \
81+
cd $(SHIM_METADATA_GEN_DIR) && cargo run -- ../$(LIBRARY_JAR) ./core.json; \
82+
fi
6583

6684
clean-shim-metadata-gen:
6785
@echo "$(CYAN)🧹 Cleaning shim-metadata-gen...$(RESET)"
@@ -88,7 +106,7 @@ clean-library:
88106
@echo "$(CYAN)🧹 Cleaning library shim...$(RESET)"
89107
cd $(LIBRARY_DIR) && gradle clean
90108

91-
# === Generate files from templates ==
109+
# === Generate files from templates ===
92110
gen-files: clean-gen-files
93111
@echo "$(CYAN)🛠️ Generating files from templates...$(RESET)"
94112
python3 GenerateFiles.py

0 commit comments

Comments
 (0)