Skip to content

Commit 47cfe25

Browse files
committed
Reorganize build into 11 parallel jobs for faster execution
1 parent 5b9967d commit 47cfe25

File tree

1 file changed

+276
-14
lines changed

1 file changed

+276
-14
lines changed

.github/workflows/build.yml

Lines changed: 276 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
branches: [ main, master ]
66

77
jobs:
8-
build:
8+
build-01-overview:
9+
name: "Module 01: Spring Boot Overview (6 projects)"
910
runs-on: ubuntu-latest
1011

1112
steps:
@@ -18,24 +19,285 @@ jobs:
1819
distribution: 'temurin'
1920
cache: 'maven'
2021

21-
- name: Build all modules
22+
- name: Build all projects in module
2223
run: |
23-
set -e # Exit on first compilation error
24+
set -e
25+
echo "Building Module 01: Spring Boot Overview"
26+
find 01-spring-boot-overview -name pom.xml -not -path "*/target/*" | sort | while read pom; do
27+
echo "Building $(dirname $pom)"
28+
mvn clean compile -B -q -f "$pom" || {
29+
echo "Failed to compile $pom"
30+
exit 1
31+
}
32+
done
33+
echo "Module 01 completed successfully"
34+
35+
build-02-spring-core:
36+
name: "Module 02: Spring Core (9 projects)"
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Set up JDK 25
43+
uses: actions/setup-java@v4
44+
with:
45+
java-version: '25'
46+
distribution: 'temurin'
47+
cache: 'maven'
48+
49+
- name: Build all projects in module
50+
run: |
51+
set -e
52+
echo "Building Module 02: Spring Core"
53+
find 02-spring-boot-spring-core -name pom.xml -not -path "*/target/*" | sort | while read pom; do
54+
echo "Building $(dirname $pom)"
55+
mvn clean compile -B -q -f "$pom" || {
56+
echo "Failed to compile $pom"
57+
exit 1
58+
}
59+
done
60+
echo "Module 02 completed successfully"
61+
62+
build-03-hibernate-jpa-crud:
63+
name: "Module 03: Hibernate JPA CRUD (8 projects)"
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Set up JDK 25
70+
uses: actions/setup-java@v4
71+
with:
72+
java-version: '25'
73+
distribution: 'temurin'
74+
cache: 'maven'
75+
76+
- name: Build all projects in module
77+
run: |
78+
set -e
79+
echo "Building Module 03: Hibernate JPA CRUD"
80+
find 03-spring-boot-hibernate-jpa-crud -name pom.xml -not -path "*/target/*" | sort | while read pom; do
81+
echo "Building $(dirname $pom)"
82+
mvn clean compile -B -q -f "$pom" || {
83+
echo "Failed to compile $pom"
84+
exit 1
85+
}
86+
done
87+
echo "Module 03 completed successfully"
88+
89+
build-04-rest-crud:
90+
name: "Module 04: REST CRUD (20 projects)"
91+
runs-on: ubuntu-latest
92+
93+
steps:
94+
- uses: actions/checkout@v4
95+
96+
- name: Set up JDK 25
97+
uses: actions/setup-java@v4
98+
with:
99+
java-version: '25'
100+
distribution: 'temurin'
101+
cache: 'maven'
102+
103+
- name: Build all projects in module
104+
run: |
105+
set -e
106+
echo "Building Module 04: REST CRUD"
107+
find 04-spring-boot-rest-crud -name pom.xml -not -path "*/target/*" | sort | while read pom; do
108+
echo "Building $(dirname $pom)"
109+
mvn clean compile -B -q -f "$pom" || {
110+
echo "Failed to compile $pom"
111+
exit 1
112+
}
113+
done
114+
echo "Module 04 completed successfully"
115+
116+
build-05-rest-security:
117+
name: "Module 05: REST Security (8 projects)"
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
- uses: actions/checkout@v4
122+
123+
- name: Set up JDK 25
124+
uses: actions/setup-java@v4
125+
with:
126+
java-version: '25'
127+
distribution: 'temurin'
128+
cache: 'maven'
129+
130+
- name: Build all projects in module
131+
run: |
132+
set -e
133+
echo "Building Module 05: REST Security"
134+
find 05-spring-boot-rest-security -name pom.xml -not -path "*/target/*" | sort | while read pom; do
135+
echo "Building $(dirname $pom)"
136+
mvn clean compile -B -q -f "$pom" || {
137+
echo "Failed to compile $pom"
138+
exit 1
139+
}
140+
done
141+
echo "Module 05 completed successfully"
142+
143+
build-06-spring-mvc:
144+
name: "Module 06: Spring MVC (20 projects)"
145+
runs-on: ubuntu-latest
146+
147+
steps:
148+
- uses: actions/checkout@v4
149+
150+
- name: Set up JDK 25
151+
uses: actions/setup-java@v4
152+
with:
153+
java-version: '25'
154+
distribution: 'temurin'
155+
cache: 'maven'
24156

25-
# Store the root directory
26-
ROOT_DIR=$(pwd)
157+
- name: Build all projects in module
158+
run: |
159+
set -e
160+
echo "Building Module 06: Spring MVC"
161+
find 06-spring-boot-spring-mvc -name pom.xml -not -path "*/target/*" | sort | while read pom; do
162+
echo "Building $(dirname $pom)"
163+
mvn clean compile -B -q -f "$pom" || {
164+
echo "Failed to compile $pom"
165+
exit 1
166+
}
167+
done
168+
echo "Module 06 completed successfully"
169+
170+
build-07-mvc-crud:
171+
name: "Module 07: MVC CRUD (7 projects)"
172+
runs-on: ubuntu-latest
173+
174+
steps:
175+
- uses: actions/checkout@v4
176+
177+
- name: Set up JDK 25
178+
uses: actions/setup-java@v4
179+
with:
180+
java-version: '25'
181+
distribution: 'temurin'
182+
cache: 'maven'
183+
184+
- name: Build all projects in module
185+
run: |
186+
set -e
187+
echo "Building Module 07: MVC CRUD"
188+
find 07-spring-boot-spring-mvc-crud -name pom.xml -not -path "*/target/*" | sort | while read pom; do
189+
echo "Building $(dirname $pom)"
190+
mvn clean compile -B -q -f "$pom" || {
191+
echo "Failed to compile $pom"
192+
exit 1
193+
}
194+
done
195+
echo "Module 07 completed successfully"
27196
28-
# Find all pom.xml files and build them
29-
find . -name pom.xml -not -path "*/target/*" | while read pom; do
30-
PROJECT_DIR=$(dirname "$pom")
31-
echo "Building $PROJECT_DIR"
197+
build-08-mvc-security:
198+
name: "Module 08: MVC Security (13 projects)"
199+
runs-on: ubuntu-latest
200+
201+
steps:
202+
- uses: actions/checkout@v4
203+
204+
- name: Set up JDK 25
205+
uses: actions/setup-java@v4
206+
with:
207+
java-version: '25'
208+
distribution: 'temurin'
209+
cache: 'maven'
32210

33-
# Change to project directory and compile
34-
cd "$ROOT_DIR/$PROJECT_DIR"
35-
mvn clean compile -B -q || {
36-
echo "Failed to compile $PROJECT_DIR"
211+
- name: Build all projects in module
212+
run: |
213+
set -e
214+
echo "Building Module 08: MVC Security"
215+
find 08-spring-boot-spring-mvc-security -name pom.xml -not -path "*/target/*" | sort | while read pom; do
216+
echo "Building $(dirname $pom)"
217+
mvn clean compile -B -q -f "$pom" || {
218+
echo "Failed to compile $pom"
37219
exit 1
38220
}
39221
done
222+
echo "Module 08 completed successfully"
223+
224+
build-09-jpa-advanced-mappings:
225+
name: "Module 09: JPA Advanced Mappings (23 projects)"
226+
runs-on: ubuntu-latest
227+
228+
steps:
229+
- uses: actions/checkout@v4
40230

41-
echo "All modules compiled successfully"
231+
- name: Set up JDK 25
232+
uses: actions/setup-java@v4
233+
with:
234+
java-version: '25'
235+
distribution: 'temurin'
236+
cache: 'maven'
237+
238+
- name: Build all projects in module
239+
run: |
240+
set -e
241+
echo "Building Module 09: JPA Advanced Mappings"
242+
find 09-spring-boot-jpa-advanced-mappings -name pom.xml -not -path "*/target/*" | sort | while read pom; do
243+
echo "Building $(dirname $pom)"
244+
mvn clean compile -B -q -f "$pom" || {
245+
echo "Failed to compile $pom"
246+
exit 1
247+
}
248+
done
249+
echo "Module 09 completed successfully"
250+
251+
build-10-aop:
252+
name: "Module 10: AOP (24 projects)"
253+
runs-on: ubuntu-latest
254+
255+
steps:
256+
- uses: actions/checkout@v4
257+
258+
- name: Set up JDK 25
259+
uses: actions/setup-java@v4
260+
with:
261+
java-version: '25'
262+
distribution: 'temurin'
263+
cache: 'maven'
264+
265+
- name: Build all projects in module
266+
run: |
267+
set -e
268+
echo "Building Module 10: AOP"
269+
find 10-spring-boot-aop -name pom.xml -not -path "*/target/*" | sort | while read pom; do
270+
echo "Building $(dirname $pom)"
271+
mvn clean compile -B -q -f "$pom" || {
272+
echo "Failed to compile $pom"
273+
exit 1
274+
}
275+
done
276+
echo "Module 10 completed successfully"
277+
278+
build-11-whats-new:
279+
name: "Module 11: What's New in Spring Boot 4 (7 projects)"
280+
runs-on: ubuntu-latest
281+
282+
steps:
283+
- uses: actions/checkout@v4
284+
285+
- name: Set up JDK 25
286+
uses: actions/setup-java@v4
287+
with:
288+
java-version: '25'
289+
distribution: 'temurin'
290+
cache: 'maven'
291+
292+
- name: Build all projects in module
293+
run: |
294+
set -e
295+
echo "Building Module 11: What's New in Spring Boot 4"
296+
find 11-whats-new-in-spring-boot-4 -name pom.xml -not -path "*/target/*" | sort | while read pom; do
297+
echo "Building $(dirname $pom)"
298+
mvn clean compile -B -q -f "$pom" || {
299+
echo "Failed to compile $pom"
300+
exit 1
301+
}
302+
done
303+
echo "Module 11 completed successfully"

0 commit comments

Comments
 (0)