Skip to content

Commit 5ce335c

Browse files
Merge pull request #32 from OP-TED/feature/check-api-for-semver
Check API changes against SemVer rules during build
2 parents f9ca939 + 153a415 commit 5ce335c

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build and run unit tests
2+
on:
3+
push:
4+
pull_request:
5+
6+
# Allows to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-java@v4
17+
with:
18+
java-version: '11'
19+
distribution: 'adopt'
20+
- name: Build and run unit tests
21+
run: mvn --batch-mode clean install

pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<version.gpg.plugin>1.5</version.gpg.plugin>
7878
<version.install.plugin>2.5.2</version.install.plugin>
7979
<version.jacoco.plugin>0.8.10</version.jacoco.plugin>
80+
<version.japicmp.plugin>0.20.0</version.japicmp.plugin>
8081
<version.javadoc.plugin>3.4.0</version.javadoc.plugin>
8182
<version.source.plugin>3.2.1</version.source.plugin>
8283
<version.jar.plugin>3.3.0</version.jar.plugin>
@@ -393,6 +394,11 @@
393394
<artifactId>jacoco-maven-plugin</artifactId>
394395
<version>${version.jacoco.plugin}</version>
395396
</plugin>
397+
<plugin>
398+
<groupId>com.github.siom79.japicmp</groupId>
399+
<artifactId>japicmp-maven-plugin</artifactId>
400+
<version>${version.japicmp.plugin}</version>
401+
</plugin>
396402
<plugin>
397403
<groupId>org.sonatype.plugins</groupId>
398404
<artifactId>nexus-staging-maven-plugin</artifactId>
@@ -457,6 +463,28 @@
457463
</execution>
458464
</executions>
459465
</plugin>
466+
467+
<plugin>
468+
<groupId>com.github.siom79.japicmp</groupId>
469+
<artifactId>japicmp-maven-plugin</artifactId>
470+
<configuration>
471+
<!-- Old and new versions are not specified, so we compare the latest released version with the build artefact -->
472+
<parameter>
473+
<!-- Break the build in case the semantic versioning is violated -->
474+
<breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
475+
<!-- Output only modified classes/methods in the report -->
476+
<onlyModified>true</onlyModified>
477+
</parameter>
478+
</configuration>
479+
<executions>
480+
<execution>
481+
<phase>verify</phase>
482+
<goals>
483+
<goal>cmp</goal>
484+
</goals>
485+
</execution>
486+
</executions>
487+
</plugin>
460488
</plugins>
461489
</build>
462490

0 commit comments

Comments
 (0)