Skip to content

Commit 6dbb551

Browse files
Add dependency check report and upgrade Mockito version
1 parent 3c94d77 commit 6dbb551

2 files changed

Lines changed: 94 additions & 1 deletion

File tree

.github/workflows/deps.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# SPDX-FileCopyrightText: 2006 Istituto Nazionale di Fisica Nucleare
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Dependency Updates
6+
7+
on:
8+
push:
9+
paths:
10+
- "pom.xml"
11+
pull_request:
12+
paths:
13+
- "pom.xml"
14+
15+
jobs:
16+
check-dependencies:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repo
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Java
24+
uses: actions/setup-java@v4
25+
with:
26+
distribution: temurin
27+
java-version: 17
28+
29+
- name: Check if pom.xml changed
30+
id: changes
31+
uses: dorny/paths-filter@v3
32+
with:
33+
filters: |
34+
pom:
35+
- 'pom.xml'
36+
37+
- name: Run Maven (minor updates only)
38+
if: steps.changes.outputs.pom == 'true'
39+
run: |
40+
mvn versions:display-dependency-updates \
41+
-DallowMajorUpdates=false \
42+
-DprocessDependencyManagement=true \
43+
| tee minor-updates.txt
44+
45+
- name: Run Maven (all updates)
46+
if: steps.changes.outputs.pom == 'true'
47+
run: |
48+
mvn versions:display-dependency-updates \
49+
-DallowMajorUpdates=true \
50+
-DprocessDependencyManagement=true \
51+
| tee all-updates.txt
52+
53+
- name: Parse outputs and generate table
54+
if: steps.changes.outputs.pom == 'true'
55+
run: |
56+
echo "# Dependency Updates" > report.md
57+
echo "" >> report.md
58+
59+
parse_file () {
60+
FILE=$1
61+
TITLE=$2
62+
63+
echo "## $TITLE" >> report.md
64+
echo "" >> report.md
65+
echo "| GroupId | ArtifactId | Current | Latest |" >> report.md
66+
echo "|---------|------------|---------|--------|" >> report.md
67+
68+
grep " -> " $FILE | while read line; do
69+
# Example line format:
70+
# com.foo:bar .................... 1.0 -> 1.2
71+
72+
GROUP_ARTIFACT=$(echo $line | awk '{print $1}')
73+
CURRENT=$(echo $line | awk '{print $(NF-2)}')
74+
LATEST=$(echo $line | awk '{print $NF}')
75+
76+
GROUP=$(echo $GROUP_ARTIFACT | cut -d: -f1)
77+
ARTIFACT=$(echo $GROUP_ARTIFACT | cut -d: -f2)
78+
79+
echo "| $GROUP | $ARTIFACT | $CURRENT | $LATEST |" >> report.md
80+
done
81+
82+
echo "" >> report.md
83+
}
84+
85+
parse_file minor-updates.txt "Minor / Patch Updates Only"
86+
parse_file all-updates.txt "All Updates (Including Major)"
87+
88+
- name: Upload report
89+
if: steps.changes.outputs.pom == 'true'
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: dependency-update-report
93+
path: report.md

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ SPDX-License-Identifier: Apache-2.0
5050
<junit.version>4.13.2</junit.version>
5151
<hamcrest.version>1.3</hamcrest.version>
5252
<canl.version>2.8.3</canl.version>
53-
<mockito.version>5.16.0</mockito.version>
53+
<mockito.version>5.23.0</mockito.version>
5454
<jcip.version>1.0</jcip.version>
5555
<bc.version>1.84</bc.version>
5656

0 commit comments

Comments
 (0)