1name: Check API compatibility 2 3on: pull_request 4 5jobs: 6 check-api-compatibility: 7 runs-on: ubuntu-latest 8 9 steps: 10 - name: Checkout old version 11 uses: actions/checkout@v3 12 with: 13 ref: ${{ github.event.pull_request.base.sha }} 14 path: 'gson-old-japicmp' 15 16 - name: Set up JDK 11 17 uses: actions/setup-java@v3 18 with: 19 distribution: 'temurin' 20 java-version: '11' 21 cache: 'maven' 22 23 - name: Build old version 24 run: | 25 cd gson-old-japicmp 26 # Set dummy version 27 mvn --batch-mode --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.11.0:set -DnewVersion=JAPICMP-OLD 28 # Install artifacts with dummy version in local repository; used later by Maven plugin for comparison 29 mvn --batch-mode --no-transfer-progress install -DskipTests 30 31 - name: Checkout new version 32 uses: actions/checkout@v3 33 34 - name: Check API compatibility 35 id: check-compatibility 36 run: | 37 mvn --batch-mode --fail-at-end --no-transfer-progress package japicmp:cmp -DskipTests 38 39 - name: Upload API differences artifacts 40 uses: actions/upload-artifact@v3 41 # Run on workflow success (in that case differences report might include added methods and classes) 42 # or when API compatibility check failed 43 if: success() || ( failure() && steps.check-compatibility.outcome == 'failure' ) 44 with: 45 name: api-differences 46 path: | 47 **/japicmp/default-cli.html 48 **/japicmp/default-cli.diff 49 # Plugin should always have created report files (though they might be empty) 50 if-no-files-found: error 51