Skip to content

Commit 27e02e2

Browse files
committed
chore(ci): optimize CI workflows for parallel builds and improve concurrency settings
1 parent 14331ca commit 27e02e2

6 files changed

Lines changed: 44 additions & 92 deletions

File tree

.github/workflows/build-feature.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,15 @@ on:
88
- 2.*
99
pull_request:
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
build:
13-
strategy:
14-
matrix:
15-
os: [ubuntu-latest]
17+
runs-on: ubuntu-latest
1618

17-
runs-on: ${{ matrix.os }}
1819
steps:
19-
20-
- name: free disk space
21-
continue-on-error: true
22-
run: |
23-
df -h
24-
sudo swapoff -a
25-
sudo rm -f /swapfile
26-
sudo apt clean
27-
if [ -n "$(docker image ls -q)" ]; then
28-
docker rmi -f $(docker image ls -aq) || true
29-
fi
30-
df -h
31-
3220
- uses: actions/checkout@v6
3321

3422
- name: Set up JDK
@@ -46,8 +34,10 @@ jobs:
4634
cache: 'npm'
4735
cache-dependency-path: '**/package-lock.json'
4836

49-
- name: Build with Maven
50-
run: ./mvnw -B --no-transfer-progress install -P coverage
37+
- name: Build with Maven (parallel modules, no coverage)
38+
run: ./mvnw -B -T 1C --no-transfer-progress install
39+
# -T 1C = 1 thread per CPU core for parallel module builds
40+
# Coverage skipped for faster PR feedback; main branch builds have coverage
5141

5242
- name: Upload surefire reports
5343
if: always()

.github/workflows/build-main.yml

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ on:
88
- 2.*
99
- 3.*
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
12-
build:
13-
strategy:
14-
matrix:
15-
os: [ ubuntu-latest ]
16+
build-and-publish:
17+
runs-on: ubuntu-latest
1618

17-
runs-on: ${{ matrix.os }}
1819
steps:
1920
- uses: actions/checkout@v6
2021

@@ -33,8 +34,9 @@ jobs:
3334
cache: 'npm'
3435
cache-dependency-path: '**/package-lock.json'
3536

36-
- name: Build with Maven
37-
run: ./mvnw -B --no-transfer-progress install -P coverage
37+
- name: Build with Maven (parallel modules)
38+
run: ./mvnw -B -T 1C --no-transfer-progress install -P coverage
39+
# -T 1C = 1 thread per CPU core for parallel module builds
3840

3941
- name: Upload surefire reports
4042
if: always()
@@ -53,42 +55,20 @@ jobs:
5355
- name: Upload coverage to Codecov
5456
uses: codecov/codecov-action@v6
5557

56-
publish-snapshot:
57-
needs: build
58-
runs-on: ubuntu-latest
59-
60-
steps:
61-
- uses: actions/checkout@v6
62-
63-
- name: Set up JDK
64-
uses: actions/setup-java@v5
65-
with:
66-
distribution: 'temurin'
67-
java-version: '17'
68-
cache: 'maven'
69-
cache-dependency-path: '**/pom.xml'
70-
71-
- name: Set up Node
72-
uses: actions/setup-node@v6
73-
with:
74-
node-version: '24'
75-
cache: 'npm'
76-
cache-dependency-path: '**/package-lock.json'
77-
78-
- name: Publish SNAPSHOT version to GitHub Packages (we can skip tests, since we only deploy, if the build workflow succeeded)
79-
run: ./mvnw -B deploy --no-transfer-progress -DskipTests
58+
- name: Publish SNAPSHOT version to GitHub Packages
59+
run: ./mvnw -B -T 1C deploy --no-transfer-progress -DskipTests
8060
env:
8161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8262

83-
- name: Extract Maven project version for Asciidoc GitHub Pages directory naming
84-
run: echo ::set-output name=version::$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
63+
- name: Extract Maven project version
64+
run: echo "version=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> "$GITHUB_OUTPUT"
8565
id: project
8666

8767
- name: Show extracted Maven project version
8868
run: echo ${{ steps.project.outputs.version }}
8969

9070
- name: Build documentation with Maven
91-
run: ./mvnw -B --no-transfer-progress site
71+
run: ./mvnw -B --no-transfer-progress -pl spring-boot-admin-docs site
9272

9373
- name: Deploy documentation to GitHub Pages
9474
uses: JamesIves/github-pages-deploy-action@v4.8.0

.github/workflows/deploy-documentation.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
type: boolean
1414
default: false
1515

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: false # Don't cancel documentation deploys in progress
19+
1620
env:
1721
VERSION: ${{ github.event.inputs.releaseversion }}
1822

@@ -43,8 +47,8 @@ jobs:
4347
- name: Set projects Maven version to GitHub Action GUI set version
4448
run: ./mvnw versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
4549

46-
- name: Build with Maven
47-
run: ./mvnw -B --no-transfer-progress package -DskipTests
50+
- name: Build with Maven (parallel modules)
51+
run: ./mvnw -B -T 1C --no-transfer-progress package -DskipTests
4852

4953
- name: Build documentation with Maven
5054
run: ./mvnw -B --no-transfer-progress -pl spring-boot-admin-docs site

.github/workflows/release-to-maven-central.yml

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
type: boolean
1313
default: false
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: false # Don't cancel releases in progress
18+
1519
env:
1620
VERSION: ${{ github.event.inputs.releaseversion }}
1721

@@ -21,18 +25,6 @@ jobs:
2125
steps:
2226
- run: echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}"
2327

24-
- name: free disk space
25-
continue-on-error: true
26-
run: |
27-
df -h
28-
sudo swapoff -a
29-
sudo rm -f /swapfile
30-
sudo apt clean
31-
if [ -n "$(docker image ls -q)" ]; then
32-
docker rmi -f $(docker image ls -aq) || true
33-
fi
34-
df -h
35-
3628
- uses: actions/checkout@v6
3729

3830
- name: Set up settings.xml for Maven Central Repository
@@ -51,21 +43,18 @@ jobs:
5143
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
5244
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
5345

54-
- name: Cache node modules
55-
uses: actions/cache@v5
56-
env:
57-
cache-name: cache-node-modules
46+
- name: Set up Node
47+
uses: actions/setup-node@v6
5848
with:
59-
path: ~/.npm
60-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
61-
restore-keys: |
62-
${{ runner.os }}-build-${{ env.cache-name }}-
49+
node-version: '24'
50+
cache: 'npm'
51+
cache-dependency-path: '**/package-lock.json'
6352

6453
- name: Set projects Maven version to GitHub Action GUI set version
6554
run: ./mvnw versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
6655

67-
- name: Publish package
68-
run: ./mvnw -B deploy --no-transfer-progress -P central-deploy -DskipTests
56+
- name: Publish package (parallel modules)
57+
run: ./mvnw -B -T 1C deploy --no-transfer-progress -P central-deploy -DskipTests
6958
env:
7059
#TODO: This is a workaround for NEXUS-27902 which uses XStream that fails on JVM >16
7160
JDK_JAVA_OPTIONS: "--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED"
@@ -74,7 +63,7 @@ jobs:
7463
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
7564

7665
- name: Build documentation with Maven
77-
run: ./mvnw -B --no-transfer-progress -pl spring-boot-admin-docs site
66+
run: ./mvnw -B --no-transfer-progress -pl spring-boot-admin-docs site
7867

7968
- name: Deploy documentation to GitHub Pages for version ${{ github.event.inputs.releaseversion }}
8069
uses: JamesIves/github-pages-deploy-action@v4.8.0
@@ -109,18 +98,6 @@ jobs:
10998
steps:
11099
- uses: actions/checkout@v6
111100

112-
- name: free disk space
113-
continue-on-error: true
114-
run: |
115-
df -h
116-
sudo swapoff -a
117-
sudo rm -f /swapfile
118-
sudo apt clean
119-
if [ -n "$(docker image ls -q)" ]; then
120-
docker rmi -f $(docker image ls -aq) || true
121-
fi
122-
df -h
123-
124101
- name: Generate changelog
125102
id: changelog
126103
uses: metcalfc/changelog-generator@v4.7.0
@@ -135,5 +112,3 @@ jobs:
135112
token: ${{ secrets.GITHUB_TOKEN }}
136113
draft: false
137114
prerelease: ${{ contains(github.event.inputs.releaseversion, '-') }}
138-
139-

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@
363363
<configuration>
364364
<parallel>classesAndMethods</parallel>
365365
<useUnlimitedThreads>false</useUnlimitedThreads>
366+
<threadCount>4</threadCount>
367+
<perCoreThreadCount>true</perCoreThreadCount>
366368
<redirectTestOutputToFile>true</redirectTestOutputToFile>
367369
<rerunFailingTestsCount>2</rerunFailingTestsCount>
368370
<includes>

spring-boot-admin-server-ui/vite.config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default defineConfig(({ mode }) => {
6060
TZ: 'Europe/Berlin',
6161
},
6262
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
63+
maxWorkers: 4,
6364
},
6465
root: frontendDir,
6566
build: {

0 commit comments

Comments
 (0)