Repository navigation
135 lines (121 loc) · 5.67 KB
/
Copy pathmaven-ci.yml
File metadata and controls
135 lines (121 loc) · 5.67 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
# 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:
branches:
- main
pull_request:
# Cancel superseded runs on the same PR; pushes to main run to completion
# (separate group, and the expression is only true for pull_request events).
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
license:
name: "Check License"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Check License"
uses: apache/skywalking-eyes@ab3d1fe50d23f9c82eff489297167e2dde8ba6cb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Check Dependencies' License"
uses: apache/skywalking-eyes/dependency@ab3d1fe50d23f9c82eff489297167e2dde8ba6cb
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: Test Maven release version and module selection checks
run: python3 -m unittest discover -s .github/scripts/tests -p 'test_maven_release_version.py' -v
- 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 }}
# Fail loudly instead of burning GitHub's 6h default when a build wedges.
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
include:
- os: ubuntu-latest
repo-cache-path: '~/.m2/repository'
- os: windows-latest
repo-cache-path: '~\.m2\repository'
env:
JAVA_VERSION: '17'
steps:
- name: Enable Git long paths on Windows
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
# No cache: 'maven' here — the explicit actions/cache step below caches the
# same ~/.m2/repository path; a second copy only adds ~35s restore and ~0.86GB storage.
- 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: Build and Test with Coverage [Linux]
if: runner.os == 'Linux'
shell: bash
env:
# PRs optimize for speed: skip release-only jars. Pushes to main still run
# javadoc (doclint) so breakage surfaces before a release. Local builds and
# releases are unaffected — this lives in CI config only, not the pom.
PR_SKIP_FLAGS: ${{ github.event_name == 'pull_request' && '-Dmaven.javadoc.skip=true -Dmaven.source.skip=true' || '' }}
run: |
# -T1C: one thread per core; Maven schedules parallel builds by the dependency
# graph, so reactor ordering is guaranteed in parallel mode (the old -T1
# rationale was an mvnd-specific spotless lock issue, not an ordering problem).
mvn -B -T1C $PR_SKIP_FLAGS clean verify
- name: Build and Test with Coverage [Windows]
if: runner.os == 'Windows'
run: |
# Use standard Maven because mvnd's embedded distribution broke Surefire IPC.
# Linux provides full coverage for process-heavy durable modules and examples whose
# child JVM and detached-process timing is not stable on hosted Windows runners.
mvn -B -T1C "-Dmaven.javadoc.skip=true" "-Dmaven.source.skip=true" "-Djacoco.skip=true" "-DskipDurableWindowsTests=true" clean verify
- name: Merge cross-module coverage [Linux]
if: runner.os == 'Linux'
shell: bash
run: |
# Backend and Core code is also exercised by adapter and extension tests.
# Rebuild each source module's report with all reactor execution data.
mvn -B -pl :agentscope-parent jacoco:merge@merge-reactor-coverage
JACOCO_VERSION=$(mvn -B -q -pl :agentscope-parent -Dstyle.color=never help:evaluate -Dexpression=jacoco.version -DforceStdout)
mvn -B -T1C "org.jacoco:jacoco-maven-plugin:${JACOCO_VERSION}:report" "-Djacoco.dataFile=$GITHUB_WORKSPACE/target/jacoco-merged.exec"
- name: Upload coverage reports to Codecov
# Secrets are unavailable to fork PRs, and Codecov rejects tokenless uploads to a
# protected branch (HTTP 400) — skipping the step beats failing the build on a run
# that legitimately cannot upload. fail_ci_if_error stays off so codecov-side
# outages never mask the actual build result.
if: runner.os == 'Linux' && env.CODECOV_TOKEN != ''
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
uses: codecov/codecov-action@v4
with:
token: ${{ env.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true