Skip to content

Commit 77636c4

Browse files
committed
Add a shared workflow to check dependency version ranges
This adds a new shared workflow to check for inconsistencies in version ranges based on byte code analysis.
1 parent 861d414 commit 77636c4

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

.github/workflows/README.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ If a gist-url is given it requires the follwoing secret:
3030
## mavenBuild.yml
3131

3232
A unified maven matrix build that covers the usual workflow for a build verification of a platform repository.
33+
34+
## checkDependencies.yml
35+
36+
Workflow that can be used as a timed action to check if any bundles need to update their version ranges of dependencies.
37+
It checks all artifacts that match the provided range and suggest a lower bound depending on the references in the classfiles.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Check Bundle Dependencies
2+
on:
3+
workflow_call:
4+
inputs:
5+
author:
6+
description: Defines the committer / author that should be used for the commit
7+
required: true
8+
type: string
9+
bundle-folders:
10+
description: Defines the folders that should be scanned for bundles, must be a valid argument to the 'ls' command, defaults to 'bundles/*/'
11+
required: false
12+
default: 'bundles/*/'
13+
type: string
14+
maven-goals:
15+
description: maven goals to use, defaults to 'clean verify'
16+
required: false
17+
default: 'clean verify'
18+
type: string
19+
submodules:
20+
description: |
21+
Whether to checkout submodules: `true` to checkout submodules or `recursive` to recursively checkout submodules.
22+
When the `ssh-key` input is not provided, SSH URLs beginning with `[email protected]:` are converted to HTTPS.
23+
The value is just passed as it is to the github/actions/checkout action: https://github.com/actions/checkout#usage
24+
type: string
25+
required: false
26+
default: 'false'
27+
mavenVersion:
28+
description: 'The version of Maven set up'
29+
type: string
30+
required: false
31+
default: '3.9.9'
32+
secrets:
33+
token:
34+
description: Personal Access Token to use for creating pull-requests
35+
required: true
36+
37+
jobs:
38+
list-bundles:
39+
runs-on: ubuntu-latest
40+
outputs:
41+
bundles: ${{ steps.list-bundles.outputs.bundles }}
42+
steps:
43+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
44+
with:
45+
fetch-depth: 0
46+
ref: master
47+
submodules: ${{ inputs.submodules }}
48+
- name: List all bundles
49+
id: list-bundles
50+
env:
51+
FOLDER_PATTERN: ${{ inputs.bundle-folders }}
52+
run: |
53+
directories=($(ls -d $FOLDER_PATTERN))
54+
directories=("${directories[@]%/}")
55+
json_array=()
56+
for dir in "${directories[@]}"; do
57+
if [ -e ${dir}/META-INF/MANIFEST.MF ]
58+
then
59+
json_array+=("\"$dir\"")
60+
fi
61+
done
62+
json_elements=$(IFS=,; echo "${json_array[*]}")
63+
json_output="{ \"bundles\": [$json_elements] }"
64+
echo "bundles=$json_output" | tee -a "$GITHUB_OUTPUT"
65+
66+
check-bundles:
67+
runs-on: ubuntu-latest
68+
name: Check ${{ matrix.bundles }} dependencies
69+
if: always()
70+
needs: list-bundles
71+
strategy:
72+
matrix: ${{ fromJson(needs.list-bundles.outputs.bundles) }}
73+
max-parallel: 1
74+
fail-fast: false
75+
steps:
76+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
77+
with:
78+
fetch-depth: 0
79+
ref: master
80+
- name: Set up Maven
81+
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
82+
with:
83+
maven-version: ${{ inputs.mavenVersion }}
84+
- name: Set up JDK
85+
uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
86+
with:
87+
java-version: '17'
88+
distribution: 'temurin'
89+
cache: maven
90+
- name: Check ${{ matrix.bundles }}
91+
working-directory: ${{ matrix.bundles }}
92+
run: >-
93+
mvn -B -ntp ${{ inputs.maven-goals }} -Pdependency-check -Dtycho.dependency.check.apply=true
94+
- name: Create Pull Request
95+
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
96+
with:
97+
commit-message: Update version ranges of dependencies for ${{ matrix.bundles }}
98+
branch: dependency-check/${{ matrix.bundles }}
99+
title: Update version ranges of dependencies for ${{ matrix.bundles }}
100+
body-path: ${{ matrix.bundles }}/target/versionProblems.md
101+
delete-branch: true
102+
draft: false
103+
token: ${{ secrets.token }}
104+
committer: ${{ inputs.author }}
105+
author: ${{ inputs.author }}
106+
add-paths: |
107+
**/*.MF

0 commit comments

Comments
 (0)