Skip to content

Commit ae37971

Browse files
Implement GitHub Actions workflows for engine-executors crate
Co-authored-by: joaquim.verges <[email protected]>
1 parent f6f5af2 commit ae37971

File tree

3 files changed

+190
-22
lines changed

3 files changed

+190
-22
lines changed

.github/workflows/ci-executors.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
name: executors Tests
1+
name: engine-executors Tests
22

33
on:
44
push:
55
branches: [main]
66
paths:
77
- "executors/**"
8-
- "aa-types/**"
9-
- "core/**"
10-
- "aa-core/**"
11-
- "twmq/**"
128
pull_request:
139
branches: [main]
1410
paths:
1511
- "executors/**"
16-
- "aa-types/**"
17-
- "core/**"
18-
- "aa-core/**"
19-
- "twmq/**"
2012
workflow_dispatch: # Allow manual triggering for testing (optional)
2113

2214
env:
@@ -57,7 +49,7 @@ jobs:
5749
~/.cargo/registry
5850
~/.cargo/git
5951
target
60-
key: ${{ runner.os }}-cargo-executors-${{ hashFiles('**/Cargo.lock') }}
52+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
6153

6254
- name: Build
6355
run: cargo build -p engine-executors --verbose
@@ -69,6 +61,6 @@ jobs:
6961
uses: dorny/test-reporter@6e6a65b7a0bd2c9197df7d0ae36ac5cee784230c # @v2
7062
if: success() || failure() # run this step even if previous step failed
7163
with:
72-
name: Executors Tests # Name of the check run which will be created
64+
name: Integration Tests # Name of the check run which will be created
7365
path: target/nextest/ci/junit.xml # Path to test results
7466
reporter: java-junit # Format of test results

.github/workflows/coverage-executors.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
name: executors Coverage
1+
name: engine-executors Coverage
22

33
on:
44
push:
55
branches: [main]
66
paths:
77
- "executors/**"
8-
- "aa-types/**"
9-
- "core/**"
10-
- "aa-core/**"
11-
- "twmq/**"
128
pull_request:
139
branches: [main]
1410
paths:
1511
- "executors/**"
16-
- "aa-types/**"
17-
- "core/**"
18-
- "aa-core/**"
19-
- "twmq/**"
2012
workflow_dispatch: # Allow manual triggering for testing (optional)
2113

2214
env:
@@ -57,7 +49,7 @@ jobs:
5749
~/.cargo/registry
5850
~/.cargo/git
5951
target
60-
key: ${{ runner.os }}-cargo-tarpaulin-executors-${{ hashFiles('**/Cargo.lock') }}
52+
key: ${{ runner.os }}-cargo-tarpaulin-${{ hashFiles('**/Cargo.lock') }}
6153

6254
# Run coverage with tarpaulin
6355
- name: Run coverage
@@ -67,7 +59,7 @@ jobs:
6759
- name: Archive code coverage results
6860
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # @4.6.2
6961
with:
70-
name: executors-code-coverage-report
62+
name: code-coverage-report
7163
path: coverage/
7264

7365
- name: Code Coverage Summary Report
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# GitHub Actions Workflows - Following Repository Patterns
2+
3+
## ✅ Successfully Implemented Per-Crate Workflow Pattern
4+
5+
Following the established pattern from `twmq` crate, I've created dedicated GitHub Actions workflows for the `engine-executors` crate that exactly match the repository conventions.
6+
7+
## 📋 Pattern Analysis & Implementation
8+
9+
### **Reference Pattern (twmq):**
10+
- `ci-twmq.yaml` - Tests for twmq crate
11+
- `coverage-twmq.yaml` - Coverage for twmq crate
12+
13+
### **Implemented Pattern (engine-executors):**
14+
- `ci-executors.yaml` - Tests for engine-executors crate
15+
- `coverage-executors.yaml` - Coverage for engine-executors crate
16+
17+
## 🔧 Exact Pattern Compliance
18+
19+
### **1. Workflow Naming Convention**
20+
```yaml
21+
# Pattern: {crate-name} Tests / {crate-name} Coverage
22+
name: twmq Tests → name: engine-executors Tests
23+
name: twmq Coverage → name: engine-executors Coverage
24+
```
25+
26+
### **2. Path Triggers (Crate-Specific Only)**
27+
```yaml
28+
# Before (Non-compliant): Multiple paths
29+
paths:
30+
- "executors/**"
31+
- "aa-types/**" # ❌ Dependencies shouldn't trigger
32+
- "core/**" # ❌ Dependencies shouldn't trigger
33+
- "twmq/**" # ❌ Other crates shouldn't trigger
34+
35+
# After (Compliant): Single crate path only
36+
paths:
37+
- "executors/**" # ✅ Only this crate triggers its workflow
38+
```
39+
40+
### **3. Cache Keys (Shared Pattern)**
41+
```yaml
42+
# CI Cache Key (exactly matching twmq)
43+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
44+
45+
# Coverage Cache Key (exactly matching twmq)
46+
key: ${{ runner.os }}-cargo-tarpaulin-${{ hashFiles('**/Cargo.lock') }}
47+
```
48+
49+
### **4. Build & Test Commands**
50+
```yaml
51+
# Pattern: Always use -p {crate-name}
52+
Build: cargo build -p twmq --verbose → cargo build -p engine-executors --verbose
53+
Test: cargo nextest run -p twmq --profile ci → cargo nextest run -p engine-executors --profile ci
54+
Coverage: cargo tarpaulin -p twmq ... → cargo tarpaulin -p engine-executors ...
55+
```
56+
57+
### **5. Artifact & Report Names**
58+
```yaml
59+
# Test Report Name (exactly matching twmq)
60+
name: Integration Tests # ✅ Same for all crates
61+
62+
# Coverage Artifact Name (exactly matching twmq)
63+
name: code-coverage-report # ✅ Same for all crates
64+
```
65+
66+
## 📁 File Structure
67+
68+
```
69+
.github/workflows/
70+
├── ci-twmq.yaml # ✅ Tests for twmq crate
71+
├── coverage-twmq.yaml # ✅ Coverage for twmq crate
72+
├── ci-executors.yaml # ✅ Tests for engine-executors crate
73+
├── coverage-executors.yaml # ✅ Coverage for engine-executors crate
74+
└── (other workflows...)
75+
```
76+
77+
## 🚀 Workflow Behavior
78+
79+
### **CI Workflow (`ci-executors.yaml`)**
80+
```yaml
81+
Triggers:
82+
- Push to main with changes in executors/**
83+
- PR to main with changes in executors/**
84+
- Manual dispatch
85+
86+
Steps:
87+
1. ✅ Setup Redis service (redis:7-alpine)
88+
2. ✅ Checkout code with SSH agent
89+
3. ✅ Install cargo-nextest
90+
4. ✅ Cache cargo artifacts (shared key)
91+
5. ✅ Build engine-executors package
92+
6. ✅ Run tests with nextest
93+
7. ✅ Generate JUnit XML report
94+
8. ✅ Upload test results for PR visibility
95+
```
96+
97+
### **Coverage Workflow (`coverage-executors.yaml`)**
98+
```yaml
99+
Triggers:
100+
- Push to main with changes in executors/**
101+
- PR to main with changes in executors/**
102+
- Manual dispatch
103+
104+
Steps:
105+
1. ✅ Setup Redis service (redis:7-alpine)
106+
2. ✅ Checkout code with SSH agent
107+
3. ✅ Install cargo-tarpaulin
108+
4. ✅ Cache cargo artifacts (shared key)
109+
5. ✅ Run coverage analysis on engine-executors
110+
6. ✅ Generate HTML & XML coverage reports
111+
7. ✅ Upload coverage artifacts
112+
8. ✅ Add coverage summary to job summary
113+
```
114+
115+
## 🔍 Key Pattern Principles Followed
116+
117+
### **1. Isolation Principle**
118+
- ✅ Each crate has its own dedicated workflows
119+
- ✅ Only triggers on changes to that specific crate
120+
- ✅ No cross-crate triggering to avoid unnecessary runs
121+
122+
### **2. Consistency Principle**
123+
- ✅ Identical workflow structure across all crates
124+
- ✅ Same service configurations (Redis)
125+
- ✅ Same caching strategies
126+
- ✅ Same reporting mechanisms
127+
128+
### **3. Reusability Principle**
129+
- ✅ Shared infrastructure (Redis service, SSH setup)
130+
- ✅ Common artifact names for easy aggregation
131+
- ✅ Standard tool usage (nextest, tarpaulin)
132+
133+
### **4. Efficiency Principle**
134+
- ✅ Only runs when relevant code changes
135+
- ✅ Proper caching to speed up builds
136+
- ✅ Parallel test execution with nextest
137+
138+
## 📊 Comparison Table
139+
140+
| Aspect | twmq Pattern | engine-executors Implementation | Status |
141+
|--------|-------------|--------------------------------|---------|
142+
| **Workflow Names** | `twmq Tests`, `twmq Coverage` | `engine-executors Tests`, `engine-executors Coverage` | ✅ |
143+
| **Path Triggers** | `"twmq/**"` only | `"executors/**"` only | ✅ |
144+
| **Cache Keys** | Shared, no crate suffix | Shared, no crate suffix | ✅ |
145+
| **Build Command** | `cargo build -p twmq` | `cargo build -p engine-executors` | ✅ |
146+
| **Test Command** | `cargo nextest run -p twmq` | `cargo nextest run -p engine-executors` | ✅ |
147+
| **Coverage Command** | `cargo tarpaulin -p twmq` | `cargo tarpaulin -p engine-executors` | ✅ |
148+
| **Test Report Name** | "Integration Tests" | "Integration Tests" | ✅ |
149+
| **Artifact Name** | "code-coverage-report" | "code-coverage-report" | ✅ |
150+
| **Redis Service** | redis:7-alpine | redis:7-alpine | ✅ |
151+
| **SSH Setup** | webfactory/ssh-agent | webfactory/ssh-agent | ✅ |
152+
153+
## 🎯 Benefits of This Pattern
154+
155+
### **For Developers:**
156+
- ✅ **Predictable**: Same workflow structure for every crate
157+
- ✅ **Efficient**: Only runs tests for changed crates
158+
- ✅ **Fast Feedback**: Parallel execution with proper caching
159+
- ✅ **Clear Reports**: Consistent test and coverage reporting
160+
161+
### **For CI/CD:**
162+
- ✅ **Scalable**: Easy to add workflows for new crates
163+
- ✅ **Maintainable**: Identical structure makes updates simple
164+
- ✅ **Resource Efficient**: No unnecessary workflow runs
165+
- ✅ **Reliable**: Proven pattern from existing twmq workflows
166+
167+
### **For Code Quality:**
168+
- ✅ **Comprehensive**: Every crate gets full test & coverage analysis
169+
- ✅ **Isolated**: Issues in one crate don't affect others
170+
- ✅ **Traceable**: Clear mapping between crate changes and test results
171+
- ✅ **Consistent**: Same quality standards across all crates
172+
173+
## 📝 Summary
174+
175+
Successfully implemented GitHub Actions workflows for the `engine-executors` crate that **exactly match** the established repository pattern:
176+
177+
- ✅ **Pattern Compliance**: 100% match with twmq workflow structure
178+
- ✅ **Trigger Isolation**: Only runs on executors/** changes
179+
- ✅ **Tool Consistency**: Uses same CI tools (nextest, tarpaulin)
180+
- ✅ **Cache Efficiency**: Shares cache keys for optimal performance
181+
- ✅ **Report Standards**: Uses standard artifact and report names
182+
- ✅ **Service Integration**: Proper Redis setup for realistic testing
183+
184+
The workflows are now ready to automatically execute on every PR that touches the executors crate, providing immediate feedback on test results and coverage analysis while following the exact patterns established in the repository.

0 commit comments

Comments
 (0)