Skip to content

Commit bb06c0a

Browse files
authored
Merge pull request #107 from microsphere-projects/dev-1.x
Enhance Maven workflow and update dependencies for compatibility
2 parents 95cf770 + 030cf33 commit bb06c0a

11 files changed

Lines changed: 124 additions & 37 deletions

File tree

.github/workflows/maven-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
name: Maven Build
1010

11+
permissions:
12+
contents: read
13+
1114
on:
1215
push:
1316
branches: [ 'dev-1.x' ]
@@ -18,6 +21,7 @@ jobs:
1821
build:
1922
runs-on: ubuntu-latest
2023
strategy:
24+
max-parallel: 7
2125
matrix:
2226
java: [ '8', '11' , '17' , '21' , '25' ]
2327
maven-profile-spring-boot: [ 'spring-boot-2.1' , 'spring-boot-2.2' , 'spring-boot-2.3',

.github/workflows/maven-publish.yml

Lines changed: 92 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ on:
2121
jobs:
2222
build:
2323
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
2426
if: ${{ inputs.revision }}
2527
steps:
2628
- name: Validate version format
@@ -60,12 +62,12 @@ jobs:
6062
SIGN_KEY: ${{ secrets.OSS_SIGNING_KEY }}
6163
SIGN_KEY_PASS: ${{ secrets.OSS_SIGNING_PASSWORD }}
6264

63-
6465
release:
6566
runs-on: ubuntu-latest
6667
needs: build
6768
permissions:
6869
contents: write
70+
models: read
6971
steps:
7072
- name: Checkout Source
7173
uses: actions/checkout@v5
@@ -83,14 +85,96 @@ jobs:
8385
git push origin ${{ inputs.revision }}
8486
fi
8587
88+
- name: Generate Release Notes with Copilot
89+
env:
90+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: |
92+
CURRENT_TAG="${{ inputs.revision }}"
93+
94+
# Find the previous tag (the one before the current tag)
95+
PREV_TAG=$(git describe --tags --abbrev=0 --exclude="${CURRENT_TAG}" HEAD 2>/dev/null || echo "")
96+
97+
# Collect commits between the previous tag and HEAD
98+
if [ -n "$PREV_TAG" ]; then
99+
COMMITS=$(git log --oneline "${PREV_TAG}..HEAD" 2>/dev/null || echo "No commits found")
100+
SINCE_LABEL="$PREV_TAG"
101+
else
102+
COMMITS=$(git log --oneline -50 2>/dev/null || echo "No commits found")
103+
SINCE_LABEL="the beginning"
104+
fi
105+
106+
# Export for Python (avoids shell-escaping issues with multiline content)
107+
export CURRENT_TAG_DATA="$CURRENT_TAG"
108+
export PREV_TAG_DATA="$SINCE_LABEL"
109+
export COMMITS_DATA="$COMMITS"
110+
111+
# Call GitHub Copilot via GitHub Models API and capture the summary
112+
SUMMARY=$(python3 << 'PYEOF'
113+
import json, os, urllib.request, sys
114+
115+
current_tag = os.environ['CURRENT_TAG_DATA']
116+
prev_tag = os.environ['PREV_TAG_DATA']
117+
commits = os.environ['COMMITS_DATA']
118+
token = os.environ['GH_TOKEN']
119+
120+
prompt = (
121+
f"Generate concise release notes for version {current_tag}.\n\n"
122+
f"Commits since {prev_tag}:\n{commits}\n\n"
123+
"Format the output as markdown with sections if present for New Features, Bug Fixes, "
124+
"Documentations, Dependency Updates, Test Improvements, Build and Workflow Enhancements "
125+
"and Other Changes(excludes Full Changelog).\n\n"
126+
"Be concise and clear."
127+
)
128+
129+
payload = json.dumps({
130+
"model": "gpt-4o",
131+
"messages": [{"role": "user", "content": prompt}]
132+
}).encode()
133+
134+
req = urllib.request.Request(
135+
"https://models.inference.ai.azure.com/chat/completions",
136+
data=payload,
137+
headers={
138+
"Content-Type": "application/json",
139+
"Authorization": f"Bearer {token}"
140+
}
141+
)
142+
143+
try:
144+
with urllib.request.urlopen(req) as resp:
145+
data = json.loads(resp.read())
146+
print(data["choices"][0]["message"]["content"])
147+
except Exception as e:
148+
print(f"Failed to generate summary via Copilot: {e}", file=sys.stderr)
149+
print(f"_Release notes generation failed. Raw commits since {prev_tag}:_\n\n```\n{commits}\n```")
150+
PYEOF
151+
)
152+
153+
# Append the summary (with version header) to release-notes.md
154+
NOTES_FILE="release-notes.md"
155+
if [ ! -f "$NOTES_FILE" ]; then
156+
printf "# Release Notes\n\n" > "$NOTES_FILE"
157+
fi
158+
159+
FULL_CHANGELOG="**Full Changelog**: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/compare/$PREV_TAG...$CURRENT_TAG"
160+
161+
printf "## v%s\n\n%s\n\n" "$CURRENT_TAG" "$SUMMARY" >> "$NOTES_FILE"
162+
printf "%s" "$FULL_CHANGELOG" >> "$NOTES_FILE"
163+
164+
# Write the current release notes to a temp file for the Create Release step
165+
printf "%s\n\n" "$SUMMARY" > /tmp/current-release-notes.md
166+
printf "%s" "$FULL_CHANGELOG" >> /tmp/current-release-notes.md
167+
168+
echo "Release notes generated and appended to $NOTES_FILE"
169+
86170
- name: Create Release
87171
run: |
88-
if gh release view "v${{ inputs.revision }}" >/dev/null 2>&1; then
89-
echo "Release v${{ inputs.revision }} already exists, skipping."
172+
if gh release view "${{ inputs.revision }}" >/dev/null 2>&1; then
173+
echo "Release ${{ inputs.revision }} already exists, skipping."
90174
else
91-
gh release create v${{ inputs.revision }} \
92-
--title "v${{ inputs.revision }}" \
93-
--generate-notes \
175+
gh release create ${{ inputs.revision }} \
176+
--title "${{ inputs.revision }}" \
177+
--notes-file /tmp/current-release-notes.md \
94178
--latest
95179
fi
96180
env:
@@ -111,7 +195,7 @@ jobs:
111195
run: |
112196
git config user.name "github-actions[bot]"
113197
git config user.email "github-actions[bot]@users.noreply.github.com"
114-
git add pom.xml
198+
git add pom.xml release-notes.md
115199
git diff --cached --quiet && echo "No changes to commit" || \
116200
git commit -m "chore: bump version to next patch after publishing ${{ inputs.revision }}" && git push
117201
@@ -127,4 +211,4 @@ jobs:
127211
echo "::error::Merge conflict detected when merging release-1.x into dev-1.x. Manual intervention required."
128212
exit 1
129213
fi
130-
git push origin dev-1.x
214+
git push origin dev-1.x
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
wrapperVersion=3.3.4
22
distributionType=only-script
3-
distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.14/binaries/apache-maven-3.9.14-bin.zip
3+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.15/apache-maven-3.9.15-bin.zip

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
![Maven](https://img.shields.io/maven-central/v/io.github.microsphere-projects/microsphere-spring-boot.svg)
1010
![License](https://img.shields.io/github/license/microsphere-projects/microsphere-spring-boot.svg)
1111

12-
1312
Microsphere Spring Boot is a collection of libraries that extends Spring Boot's capabilities with additional features
1413
focused on configuration management, application diagnostics, and enhanced monitoring. The project is structured as a
1514
multi-module Maven project that follows Spring Boot's conventions while providing value-added functionality.
@@ -41,6 +40,7 @@ The easiest way to get started is by adding the Microsphere Spring Boot BOM (Bil
4140
pom.xml:
4241

4342
```xml
43+
4444
<dependencyManagement>
4545
<dependencies>
4646
...
@@ -61,12 +61,13 @@ pom.xml:
6161

6262
| **Branches** | **Purpose** | **Latest Version** |
6363
|--------------|--------------------------------------------------|--------------------|
64-
| **0.2.x** | Compatible with Spring Boot 3.0.x - 3.5.x, 4.0.x | 0.2.10 |
65-
| **0.1.x** | Compatible with Spring Boot 2.0.x - 2.7.x | 0.1.10 |
64+
| **0.2.x** | Compatible with Spring Boot 3.0.x - 3.5.x, 4.0.x | 0.2.11 |
65+
| **0.1.x** | Compatible with Spring Boot 2.0.x - 2.7.x | 0.1.11 |
6666

6767
Then add the specific modules you need:
6868

6969
```xml
70+
7071
<dependencies>
7172
<!-- Microsphere Spring Boot Core -->
7273
<dependency>
@@ -131,7 +132,8 @@ We welcome your contributions! Please read [Code of Conduct](./CODE_OF_CONDUCT.m
131132

132133
## Reporting Issues
133134

134-
* Before you log a bug, please search the [issues](https://github.com/microsphere-projects/microsphere-spring-boot/issues)
135+
* Before you log a bug, please search
136+
the [issues](https://github.com/microsphere-projects/microsphere-spring-boot/issues)
135137
to see if someone has already reported the problem.
136138
* If the issue doesn't already
137139
exist, [create a new issue](https://github.com/microsphere-projects/microsphere-spring-boot/issues/new).

microsphere-spring-boot-actuator/src/main/java/io/microsphere/spring/boot/actuate/autoconfigure/ActuatorAutoConfiguration.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package io.microsphere.spring.boot.actuate.autoconfigure;
1818

19-
import io.micrometer.core.instrument.MeterRegistry;
2019
import io.microsphere.annotation.ConfigurationProperty;
2120
import io.microsphere.spring.boot.actuate.MonitoredThreadPoolTaskScheduler;
2221
import org.springframework.beans.factory.annotation.Value;
@@ -87,6 +86,12 @@ public class ActuatorAutoConfiguration {
8786
*/
8887
public static final String ACTUATOR_TASK_SCHEDULER_SERVICE_BEAN_NAME = "actuatorTaskScheduler";
8988

89+
/**
90+
* The class name of {@link io.micrometer.core.instrument.MeterRegistry}
91+
* @see io.micrometer.core.instrument.MeterRegistry
92+
*/
93+
static final String METER_REGISTRY_CLASS_NAME = "io.micrometer.core.instrument.MeterRegistry";
94+
9095
/**
9196
* Creates a {@link MonitoredThreadPoolTaskScheduler} bean for actuator tasks, configured
9297
* with the given pool size and thread name prefix.
@@ -103,7 +108,7 @@ public class ActuatorAutoConfiguration {
103108
* @param threadNamePrefix the prefix for thread names created by the scheduler
104109
* @return a configured {@link ThreadPoolTaskScheduler} instance
105110
*/
106-
@ConditionalOnBean(MeterRegistry.class)
111+
@ConditionalOnBean(type = METER_REGISTRY_CLASS_NAME)
107112
@Bean(name = ACTUATOR_TASK_SCHEDULER_SERVICE_BEAN_NAME, destroyMethod = "shutdown")
108113
public ThreadPoolTaskScheduler actuatorTaskScheduler(
109114
@Value(TASK_SCHEDULER_POOL_SIZE_VALUE_EXPRESSION) int poolSize,

microsphere-spring-boot-actuator/src/test/java/io/microsphere/spring/boot/actuate/autoconfigure/ActuatorAutoConfigurationTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package io.microsphere.spring.boot.actuate.autoconfigure;
1818

19+
import io.micrometer.core.instrument.MeterRegistry;
1920
import org.junit.jupiter.api.ClassOrderer.OrderAnnotation;
2021
import org.junit.jupiter.api.DisplayName;
2122
import org.junit.jupiter.api.Nested;
@@ -31,6 +32,7 @@
3132

3233
import static io.microsphere.spring.boot.actuate.autoconfigure.ActuatorAutoConfiguration.ACTUATOR_TASK_SCHEDULER_SERVICE_BEAN_NAME;
3334
import static io.microsphere.spring.boot.actuate.autoconfigure.ActuatorAutoConfiguration.DEFAULT_TASK_SCHEDULER_POOL_SIZE;
35+
import static io.microsphere.spring.boot.actuate.autoconfigure.ActuatorAutoConfiguration.METER_REGISTRY_CLASS_NAME;
3436
import static io.microsphere.spring.boot.actuate.autoconfigure.ActuatorAutoConfiguration.TASK_SCHEDULER_POOL_SIZE_PROPERTY_NAME;
3537
import static io.microsphere.spring.boot.actuate.autoconfigure.ActuatorAutoConfiguration.TASK_SCHEDULER_THREAD_NAME_PREFIX_PROPERTY_NAME;
3638
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -53,6 +55,9 @@ void testConstants() {
5355
assertEquals("1", DEFAULT_TASK_SCHEDULER_POOL_SIZE);
5456
assertEquals("microsphere.spring.boot.actuator.task-scheduler.pool-size", TASK_SCHEDULER_POOL_SIZE_PROPERTY_NAME);
5557
assertEquals("microsphere.spring.boot.actuator.task-scheduler.thread-name-prefix", TASK_SCHEDULER_THREAD_NAME_PREFIX_PROPERTY_NAME);
58+
assertEquals("io.micrometer.core.instrument.MeterRegistry", METER_REGISTRY_CLASS_NAME);
59+
// test for strong type check
60+
assertEquals(MeterRegistry.class.getName(), METER_REGISTRY_CLASS_NAME);
5661
}
5762

5863
@Order(1)
@@ -61,7 +66,8 @@ void testConstants() {
6166
@SpringBootTest(
6267
webEnvironment = NONE,
6368
classes = {
64-
MeterRegistryPresent.class
69+
MeterRegistryPresent.class,
70+
ActuatorAutoConfigurationTest.class
6571
}, properties = {
6672
"microsphere.spring.boot.actuator.task-scheduler.pool-size=2",
6773
"microsphere.spring.boot.actuator.task-scheduler.thread-name-prefix=my-prefix",
@@ -104,7 +110,8 @@ void testActuatorTaskScheduler() {
104110
@SpringBootTest(
105111
webEnvironment = NONE,
106112
classes = {
107-
MeterRegistryAbsent.class
113+
MeterRegistryAbsent.class,
114+
ActuatorAutoConfigurationTest.class
108115
}, properties = {
109116
// Spring Boot [2.x,3.x]
110117
"microsphere.autoconfigure.exclude[0]=org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration",

microsphere-spring-boot-core/pom.xml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,6 @@
6565
<groupId>io.github.microsphere-projects</groupId>
6666
<artifactId>microsphere-spring-test</artifactId>
6767
<scope>test</scope>
68-
<exclusions>
69-
<exclusion>
70-
<groupId>org.apache.zookeeper</groupId>
71-
<artifactId>zookeeper</artifactId>
72-
</exclusion>
73-
<exclusion>
74-
<groupId>org.apache.curator</groupId>
75-
<artifactId>curator-recipes</artifactId>
76-
</exclusion>
77-
<exclusion>
78-
<groupId>org.apache.curator</groupId>
79-
<artifactId>curator-test</artifactId>
80-
</exclusion>
81-
</exclusions>
8268
</dependency>
8369

8470
<dependency>

microsphere-spring-boot-core/src/main/java/io/microsphere/spring/boot/SpringBootVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import static io.microsphere.constants.SymbolConstants.DOT_CHAR;
2626
import static io.microsphere.constants.SymbolConstants.UNDER_SCORE_CHAR;
2727
import static io.microsphere.util.Version.of;
28+
import static io.microsphere.util.Version.ofVersion;
2829

2930
/**
3031
* The enumeration for the released Spring Boot versions since 2.0
@@ -292,7 +293,7 @@ public enum SpringBootVersion {
292293

293294
SPRING_BOOT_2_7_18,
294295

295-
CURRENT(of(org.springframework.boot.SpringBootVersion.getVersion()));
296+
CURRENT(ofVersion(org.springframework.boot.SpringBootVersion.class));
296297

297298
private final Version version;
298299

microsphere-spring-boot-core/src/test/java/io/microsphere/spring/boot/util/SpringApplicationUtilsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void testLog() {
112112

113113
void testGetLoggingLevel(String level) {
114114
MockEnvironment environment = new MockEnvironment();
115-
environment.setProperty(MICROSPHERE_SPRING_BOOT_LOGGING_LEVEL_PROPERTY_NAME, level);
115+
environment.withProperty(MICROSPHERE_SPRING_BOOT_LOGGING_LEVEL_PROPERTY_NAME, level);
116116
assertEquals(level, getLoggingLevel(environment));
117117
}
118118

microsphere-spring-boot-parent/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<description>Microsphere Spring Boot Parent</description>
2020

2121
<properties>
22-
<microsphere-spring.version>0.1.9</microsphere-spring.version>
22+
<microsphere-spring.version>0.1.14</microsphere-spring.version>
2323
<jolokia.version>1.7.2</jolokia.version>
2424
<!-- Testing -->
2525
<junit-jupiter.version>5.14.3</junit-jupiter.version>
@@ -57,7 +57,6 @@
5757
</dependencyManagement>
5858

5959
<profiles>
60-
6160
<profile>
6261
<id>spring-boot-2.1</id>
6362
<properties>
@@ -109,6 +108,5 @@
109108
<spring-boot.version>2.7.18</spring-boot.version>
110109
</properties>
111110
</profile>
112-
113111
</profiles>
114112
</project>

0 commit comments

Comments
 (0)