Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/api-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: API Compatibility Check
on:
pull_request:
permissions:
contents: read
jobs:
api-compat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
submodules: true
persist-credentials: false
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: zulu
java-version: 17
cache: maven
- name: Check API Compatibility
run: mvn verify -P api-compat -DskipTests -Dgpg.skip=true
3 changes: 3 additions & 0 deletions dev-bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ mvn versions:set -DnewVersion="$version"
perl -pi -e "s/(?<=<version>)[^<]*/$version/" README.md
perl -pi -e "s/(?<=com\.maxmind\.geoip2\:geoip2\:)\d+\.\d+\.\d+([\w\-]+)?/$version/" README.md

# Update japicmp.baselineVersion for API compatibility checking
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although japicmp has functionality to compare the current version to the previous version, this does not work if we have not yet bumped the version number for a release.

perl -pi -e "s/(<japicmp\.baselineVersion>)[^<]*(<\/japicmp\.baselineVersion>)/\${1}$version\${2}/" pom.xml

cat README.md >>$page

git diff
Expand Down
63 changes: 63 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Baseline version for API compatibility checking. Update after each release. -->
<japicmp.baselineVersion>5.0.2</japicmp.baselineVersion>
</properties>
<build>
<plugins>
Expand Down Expand Up @@ -304,5 +306,66 @@
</plugins>
</build>
</profile>
<profile>
<id>api-compat</id>
<build>
<plugins>
<!-- Download baseline JAR directly from Maven Central for API comparison -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>download-baseline</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir dir="${project.build.directory}/japicmp"/>
<get src="https://repo1.maven.org/maven2/com/maxmind/geoip2/geoip2/${japicmp.baselineVersion}/geoip2-${japicmp.baselineVersion}.jar"
dest="${project.build.directory}/japicmp/baseline.jar"
skipexisting="false"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>0.25.1</version>
<configuration>
<oldVersion>
<file>
<path>${project.build.directory}/japicmp/baseline.jar</path>
</file>
</oldVersion>
<newVersion>
<file>
<path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
</file>
</newVersion>
<parameter>
<accessModifier>public</accessModifier>
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
<onlyBinaryIncompatible>false</onlyBinaryIncompatible>
<onlyModified>true</onlyModified>
</parameter>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>cmp</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading