Skip to content

Commit 32191b1

Browse files
Add parallel build GitHub Actions workflow with build status badge (#10)
1 parent fb258c2 commit 32191b1

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/workflows/build.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
7+
jobs:
8+
build-02-creational:
9+
name: "Section 02: Creational Design Patterns (5 projects)"
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up JDK 25
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '25'
19+
distribution: 'temurin'
20+
cache: 'maven'
21+
22+
- name: Build all projects in section
23+
run: |
24+
set -e
25+
echo "Building Section 02: Creational Design Patterns"
26+
find section-02-creational-design-patterns -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 "Section 02 completed successfully"
34+
35+
build-03-structural:
36+
name: "Section 03: Structural Design Patterns (5 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 section
50+
run: |
51+
set -e
52+
echo "Building Section 03: Structural Design Patterns"
53+
find section-03-structural-design-patterns -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 "Section 03 completed successfully"
61+
62+
build-04-behavioral:
63+
name: "Section 04: Behavioral Design Patterns (11 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 section
77+
run: |
78+
set -e
79+
echo "Building Section 04: Behavioral Design Patterns"
80+
find section-04-behavioral-design-patterns -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 "Section 04 completed successfully"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Master Java Design Patterns
22

3+
![Build Status](https://github.com/darbyluv2code/master-java-design-patterns/actions/workflows/build.yml/badge.svg)
4+
35
Source code for the course: [Master Java Design Patterns](https://www.luv2code.com/master-java-design-patterns-github)
46

57
If you have questions or need tech support, post your questions to the [classroom discussion forum](https://www.luv2code.com/master-java-design-patterns-github).

0 commit comments

Comments
 (0)