Skip to content

Commit 28ac811

Browse files
committed
Added revapi maven plugins and corresponding github actions
1 parent 7c484d8 commit 28ac811

3 files changed

Lines changed: 106 additions & 0 deletions

File tree

.github/workflows/breaking.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: breaking
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
broken-changes:
7+
concurrency:
8+
group: broken-changes-${{ github.ref }}
9+
cancel-in-progress: true
10+
if: (!contains(github.event.pull_request.labels.*.name, 'broken changes'))
11+
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: write
14+
contents: read
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up JDK
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: 8
23+
distribution: 'temurin'
24+
cache: 'maven'
25+
26+
- name: Build
27+
run: mvn -DskipTests -ntp install
28+
29+
- name: Check broken API changes
30+
run: set -o pipefail && mvn org.revapi:revapi-maven-plugin:report-aggregate -DskipTests -ntp
31+
32+
- name: Generate backward compatibility report
33+
run: |
34+
cat changes.txt
35+
touch report.txt
36+
37+
if [ -s changes.txt ]; then
38+
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
39+
echo "Backward compatibility check report" >> report.txt
40+
echo "======" >> report.txt
41+
cat changes.txt >> report.txt
42+
else
43+
echo "CHANGES_DETECTED=false" >> $GITHUB_ENV
44+
fi
45+
46+
# Skip comment for forks - GITHUB_TOKEN doesn't have write permissions for external PRs
47+
- name: Comment Report
48+
if: always() && github.event.pull_request.head.repo.full_name == github.repository && env.CHANGES_DETECTED == 'true'
49+
uses: marocchino/sticky-pull-request-comment@v2
50+
with:
51+
path: report.txt
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
header: diff

config/revapi-report-template.ftl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<#if reports?has_content>
2+
```
3+
<#list analysis.oldApi.archives as archive>${archive.name}<#sep>, </#list>
4+
<#list analysis.newApi.archives as archive>${archive.name}<#sep>, </#list>
5+
```
6+
7+
<#list reports as report>
8+
>***Old: ${report.oldElement!"<none>"}***
9+
>***New: ${report.newElement!"<none>"}***
10+
<#list report.differences as diff>
11+
> ${diff.code}<#if diff.description??>: ${diff.description}</#if>
12+
</#list>
13+
14+
</#list>
15+
---
16+
</#if>

pom.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<testcontainers.version>2.0.3</testcontainers.version>
4545
<!-- last version with JDK8 compability -->
4646
<apache.arrow.version>17.0.0</apache.arrow.version>
47+
<maven-revapi-plugin.version>0.15.1</maven-revapi-plugin.version>
4748
</properties>
4849

4950
<licenses>
@@ -184,6 +185,42 @@
184185
</execution>
185186
</executions>
186187
</plugin>
188+
<plugin>
189+
<groupId>org.revapi</groupId>
190+
<artifactId>revapi-maven-plugin</artifactId>
191+
<version>${maven-revapi-plugin.version}</version>
192+
<dependencies>
193+
<dependency>
194+
<groupId>org.revapi</groupId>
195+
<artifactId>revapi-java</artifactId>
196+
<version>0.28.4</version>
197+
</dependency>
198+
<dependency>
199+
<groupId>org.revapi</groupId>
200+
<artifactId>revapi-reporter-text</artifactId>
201+
<version>${maven-revapi-plugin.version}</version>
202+
</dependency>
203+
</dependencies>
204+
<configuration>
205+
<analysisConfiguration>
206+
<revapi.filter>
207+
<archives>
208+
<include>
209+
<item>tech.ydb.*</item>
210+
</include>
211+
</archives>
212+
</revapi.filter>
213+
<revapi.reporter.text>
214+
<minSeverity>BREAKING</minSeverity>
215+
<minCriticality>documented</minCriticality>
216+
<output>changes.txt</output>
217+
<template>/config/revapi-report-template.ftl</template>
218+
<append>true</append>
219+
<keepEmptyFile>true</keepEmptyFile>
220+
</revapi.reporter.text>
221+
</analysisConfiguration>
222+
</configuration>
223+
</plugin>
187224
<plugin>
188225
<groupId>org.apache.maven.plugins</groupId>
189226
<artifactId>maven-surefire-plugin</artifactId>

0 commit comments

Comments
 (0)