forked from agentscope-ai/agentscope-java
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (125 loc) · 5.25 KB
/
Copy pathmaven-ci.yml
File metadata and controls
140 lines (125 loc) · 5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
pull_request:
jobs:
license:
name: "Check License"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Check License"
uses: apache/skywalking-eyes@e1a02359b239bd28de3f6d35fdc870250fa513d5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Check Dependencies' License"
uses: apache/skywalking-eyes/dependency@e1a02359b239bd28de3f6d35fdc870250fa513d5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config: .licenserc.yaml
mode: check
module-sync:
name: "Check Module Sync"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check extension modules are synced to agentscope-all and agentscope-bom
run: |
chmod +x .github/scripts/check-shade-and-bom-sync.sh
./.github/scripts/check-shade-and-bom-sync.sh
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest ]
include:
- os: ubuntu-latest
repo-cache-path: '~/.m2/repository'
mvnd-cache-path: '~/.mvnd'
- os: windows-latest
repo-cache-path: '~\.m2\repository'
mvnd-cache-path: '~\.mvnd'
env:
MVND_VERSION: '1.0.3'
JAVA_VERSION: '17'
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: 'maven'
- name: Cache Maven repository [${{ runner.os }}]
uses: actions/cache@v4
with:
path: ${{ matrix.repo-cache-path }}
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Cache mvnd [${{ runner.os }}]
id: cache-mvnd
uses: actions/cache@v4
with:
path: ${{ matrix.mvnd-cache-path }}
key: mvnd-${{ env.MVND_VERSION }}-${{ runner.os }}
- name: Install mvnd [Linux]
if: steps.cache-mvnd.outputs.cache-hit != 'true' && runner.os == 'Linux'
shell: bash
run: |
curl -fsSL https://github.com/apache/maven-mvnd/releases/download/${{ env.MVND_VERSION }}/maven-mvnd-${{ env.MVND_VERSION }}-linux-amd64.tar.gz | tar xz
mkdir -p ~/.mvnd
mv maven-mvnd-${{ env.MVND_VERSION }}-linux-amd64/* ~/.mvnd/
- name: Install mvnd [Windows]
if: steps.cache-mvnd.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: pwsh
run: |
Invoke-WebRequest `
-Uri "https://github.com/apache/maven-mvnd/releases/download/${{ env.MVND_VERSION }}/maven-mvnd-${{ env.MVND_VERSION }}-windows-amd64.zip" `
-OutFile "mvnd.zip"
mkdir -Path "~\.mvnd" -Force
Expand-Archive -Path "mvnd.zip" -DestinationPath "mvnd" -FORCE
Copy-Item -Path "mvnd\maven-mvnd-${{ env.MVND_VERSION }}-windows-amd64\*" -Destination "~\.mvnd\" -Recurse
Set-Content -Path "~\.mvnd\conf\mvnd.properties" -Value @"
# mvnd client timeout settings
mvnd.connectTimeout=120000
mvnd.socketConnectTimeout=30000
mvnd.cancelConnectTimeout=30000
"@ -Encoding Utf8 -Force
Remove-Item -Path "mvnd", "mvnd.zip" -Recurse -Force
- name: Build and Test with Coverage [Linux]
if: runner.os == 'Linux'
shell: bash
run: |
export PATH="$HOME/.mvnd/bin:$PATH"
if ! command -v mvnd >/dev/null 2>&1; then
echo "mvnd not found, installing..."
curl -fsSL https://github.com/apache/maven-mvnd/releases/download/${{ env.MVND_VERSION }}/maven-mvnd-${{ env.MVND_VERSION }}-linux-amd64.tar.gz | tar xz
mkdir -p ~/.mvnd
mv maven-mvnd-${{ env.MVND_VERSION }}-linux-amd64/* ~/.mvnd/
export PATH="$HOME/.mvnd/bin:$PATH"
fi
# -T1: single-threaded build so reactor order is respected and agentscope-core
# is installed before modules (e.g. subagent) that resolve it from the reactor.
mvnd -B -T1 clean verify
- name: Build and Test with Coverage [Windows]
if: runner.os == 'Windows'
run: |
# -T1: single-threaded build so reactor order is respected (see Linux step).
# -Dmvnd.maxLostKeepAlive=120: avoid StaleAddressException on long javadoc phases (mvnd#161).
& "~\.mvnd\bin\mvnd.cmd" -B -T1 "-Dmvnd.maxLostKeepAlive=120" clean verify
- name: Upload coverage reports to Codecov
if: runner.os == 'Linux'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true