2023-07-06 19:04:36 +02:00
|
|
|
# This workflow makes sure that a pull request does not make any incompatible changes
|
|
|
|
# to the public API of Gson
|
2022-08-28 19:51:31 +02:00
|
|
|
name: Check API compatibility
|
|
|
|
|
|
|
|
on: pull_request
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check-api-compatibility:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout old version
|
2024-01-29 18:00:13 +01:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2022-08-28 19:51:31 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.base.sha }}
|
|
|
|
path: 'gson-old-japicmp'
|
|
|
|
|
|
|
|
- name: Set up JDK 11
|
2024-01-29 18:00:13 +01:00
|
|
|
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
|
2022-08-28 19:51:31 +02:00
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '11'
|
|
|
|
cache: 'maven'
|
|
|
|
|
|
|
|
- name: Build old version
|
|
|
|
run: |
|
|
|
|
cd gson-old-japicmp
|
|
|
|
# Set dummy version
|
2022-09-28 08:05:49 +02:00
|
|
|
mvn --batch-mode --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.11.0:set -DnewVersion=JAPICMP-OLD
|
2022-08-28 19:51:31 +02:00
|
|
|
# Install artifacts with dummy version in local repository; used later by Maven plugin for comparison
|
2022-09-28 08:05:49 +02:00
|
|
|
mvn --batch-mode --no-transfer-progress install -DskipTests
|
2022-08-28 19:51:31 +02:00
|
|
|
|
|
|
|
- name: Checkout new version
|
2024-01-29 18:00:13 +01:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2022-08-28 19:51:31 +02:00
|
|
|
|
|
|
|
- name: Check API compatibility
|
|
|
|
id: check-compatibility
|
|
|
|
run: |
|
2022-09-28 08:05:49 +02:00
|
|
|
mvn --batch-mode --fail-at-end --no-transfer-progress package japicmp:cmp -DskipTests
|
2022-08-28 19:51:31 +02:00
|
|
|
|
|
|
|
- name: Upload API differences artifacts
|
2024-01-29 19:29:20 +01:00
|
|
|
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
2022-08-28 19:51:31 +02:00
|
|
|
# Run on workflow success (in that case differences report might include added methods and classes)
|
|
|
|
# or when API compatibility check failed
|
|
|
|
if: success() || ( failure() && steps.check-compatibility.outcome == 'failure' )
|
|
|
|
with:
|
|
|
|
name: api-differences
|
|
|
|
path: |
|
|
|
|
**/japicmp/default-cli.html
|
|
|
|
**/japicmp/default-cli.diff
|
|
|
|
# Plugin should always have created report files (though they might be empty)
|
|
|
|
if-no-files-found: error
|