Skip to content

Commit 19f7d17

Browse files
authored
chore(ci): Add ci run on windows platform (#681)
## AgentScope-Java Version 1.0.9 ## Description * Closes: #531 * Closes: #688 * Add ci run on windows platform ## Note * Executing unit tests on the windows platform takes 10 minutes, double time longer than ubuntu, which increases CI execution time. ## Checklist Please check the following items before code is ready to be reviewed. - [x] Code has been formatted with `mvn spotless:apply` - [x] All tests are passing (`mvn test`) - [x] Javadoc comments are complete and follow project conventions - [x] Related documentation has been updated (e.g. links, examples, etc.) - [x] Code is ready for review
1 parent 8501726 commit 19f7d17

File tree

5 files changed

+51
-16
lines changed

5 files changed

+51
-16
lines changed

.github/workflows/maven-ci.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,45 +40,80 @@ jobs:
4040
./.github/scripts/check-shade-and-bom-sync.sh
4141
4242
build:
43-
runs-on: ubuntu-latest
43+
runs-on: ${{ matrix.os }}
44+
strategy:
45+
fail-fast: true
46+
matrix:
47+
os: [ ubuntu-latest, windows-latest ]
48+
include:
49+
- os: ubuntu-latest
50+
repo-cache-path: '~/.m2/repository'
51+
mvnd-cache-path: '~/.mvnd'
52+
- os: windows-latest
53+
repo-cache-path: '~\.m2\repository'
54+
mvnd-cache-path: '~\.mvnd'
55+
4456
env:
4557
MVND_VERSION: '1.0.3'
58+
JAVA_VERSION: '17'
59+
4660
steps:
4761
- uses: actions/checkout@v4
48-
- name: Set up JDK 17
62+
- name: Set up JDK ${{ env.JAVA_VERSION }}
4963
uses: actions/setup-java@v4
5064
with:
51-
java-version: '17'
65+
java-version: ${{ env.JAVA_VERSION }}
5266
distribution: 'temurin'
67+
cache: 'maven'
5368

54-
- name: Cache Maven repository
69+
- name: Cache Maven repository [${{ runner.os }}]
5570
uses: actions/cache@v4
5671
with:
57-
path: ~/.m2/repository
72+
path: ${{ matrix.repo-cache-path }}
5873
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
5974
restore-keys: |
6075
maven-${{ runner.os }}-
6176
62-
- name: Cache mvnd
77+
- name: Cache mvnd [${{ runner.os }}]
6378
id: cache-mvnd
6479
uses: actions/cache@v4
6580
with:
66-
path: ~/.mvnd
67-
key: mvnd-${{ env.MVND_VERSION }}-linux
81+
path: ${{ matrix.mvnd-cache-path }}
82+
key: mvnd-${{ env.MVND_VERSION }}-${{ runner.os }}
6883

69-
- name: Install mvnd
70-
if: steps.cache-mvnd.outputs.cache-hit != 'true'
84+
- name: Install mvnd [Linux]
85+
if: steps.cache-mvnd.outputs.cache-hit != 'true' && runner.os == 'Linux'
86+
shell: bash
7187
run: |
7288
curl -fsSL https://github.com/apache/maven-mvnd/releases/download/${{ env.MVND_VERSION }}/maven-mvnd-${{ env.MVND_VERSION }}-linux-amd64.tar.gz | tar xz
7389
mkdir -p ~/.mvnd
7490
mv maven-mvnd-${{ env.MVND_VERSION }}-linux-amd64/* ~/.mvnd/
7591
76-
- name: Build and Test with Coverage
92+
- name: Install mvnd [Windows]
93+
if: steps.cache-mvnd.outputs.cache-hit != 'true' && runner.os == 'Windows'
94+
shell: pwsh
95+
run: |
96+
Invoke-WebRequest `
97+
-Uri "https://github.com/apache/maven-mvnd/releases/download/${{ env.MVND_VERSION }}/maven-mvnd-${{ env.MVND_VERSION }}-windows-amd64.zip" `
98+
-OutFile "mvnd.zip"
99+
mkdir -Path "~\.mvnd" -Force
100+
Expand-Archive -Path "mvnd.zip" -DestinationPath "mvnd" -FORCE
101+
Copy-Item -Path "mvnd\maven-mvnd-${{ env.MVND_VERSION }}-windows-amd64\*" -Destination "~\.mvnd\" -Recurse
102+
Remove-Item -Path "mvnd", "mvnd.zip" -Recurse -Force
103+
104+
- name: Build and Test with Coverage [Linux]
105+
if: runner.os == 'Linux'
77106
run: |
78107
export PATH="$HOME/.mvnd/bin:$PATH"
79108
mvnd -B clean verify
80109
110+
- name: Build and Test with Coverage [Windows]
111+
if: runner.os == 'Windows'
112+
run: |
113+
& "~\.mvnd\bin\mvnd.cmd" -B clean verify
114+
81115
- name: Upload coverage reports to Codecov
116+
if: runner.os == 'Linux'
82117
uses: codecov/codecov-action@v4
83118
with:
84119
token: ${{ secrets.CODECOV_TOKEN }}

agentscope-extensions/agentscope-extensions-a2a/agentscope-extensions-a2a-client/src/test/java/io/agentscope/core/a2a/agent/A2aAgentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ private Answer<Void> mockWaitingStopAnswer(final AtomicBoolean stopFlag) {
495495

496496
private void assertTimeout(CompletableFuture<Void> future, final AtomicBoolean stopFlag) {
497497
try {
498-
future.get(2, TimeUnit.SECONDS);
498+
future.get(5, TimeUnit.SECONDS);
499499
} catch (TimeoutException e) {
500500
fail(
501501
"interrupt operation should stop task running and stop agent running. But"

agentscope-extensions/agentscope-extensions-rag-simple/src/test/java/io/agentscope/core/rag/reader/ReaderInputTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void testFromPath() {
114114
ReaderInput input = ReaderInput.fromPath(Path.of("src/test/resources/rag-test.docx"));
115115
assertNotNull(input);
116116
assertEquals(ReaderInput.InputType.FILE, input.getType());
117-
assertTrue(input.asString().contains("src/test/resources/rag-test.docx"));
117+
assertTrue(input.asString().contains("rag-test.docx"));
118118
}
119119

120120
@Test
@@ -136,6 +136,6 @@ void testFromPathString() {
136136
ReaderInput input = ReaderInput.fromPath("src/test/resources/rag-test.docx");
137137
assertNotNull(input);
138138
assertEquals(ReaderInput.InputType.FILE, input.getType());
139-
assertTrue(input.asString().contains("src/test/resources/rag-test.docx"));
139+
assertTrue(input.asString().contains("rag-test.docx"));
140140
}
141141
}

docs/en/task/agui.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class AgentConfiguration {
5353
public class AgentConfiguration {
5454

5555
@Bean
56-
@AguiAgent("default")
56+
@AguiAgentId("default")
5757
public Agent agent() {
5858
return ReActAgent.builder()
5959
.name("Assistant")

docs/zh/task/agui.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class AgentConfiguration {
5353
public class AgentConfiguration {
5454

5555
@Bean
56-
@AguiAgent("default")
56+
@AguiAgentId("default")
5757
public Agent agent() {
5858
return ReActAgent.builder()
5959
.name("Assistant")

0 commit comments

Comments
 (0)