gson-comments/.github/workflows/check-api-compatibility.yml
Marcono1234 87a391363e
Upgrade GitHub actions & pin to commit hash (#2598)
* Upgrade GitHub actions & pin to commit hash

The only exception is `google/oss-fuzz` which does not seem to have releases
or Git tags, so pinning might not make sense there.

Also adds `actions/setup-java` to the `codeql-analysis` workflow to
explicitly specify the JDK version to use (and to use the caching of
that action) instead of relying on the default JDK of the runner image.

* Enable Dependabot for GitHub actions

---------

Co-authored-by: Éamonn McManus <emcmanus@google.com>
2024-01-29 09:00:13 -08:00

53 lines
2.0 KiB
YAML

# This workflow makes sure that a pull request does not make any incompatible changes
# to the public API of Gson
name: Check API compatibility
on: pull_request
jobs:
check-api-compatibility:
runs-on: ubuntu-latest
steps:
- name: Checkout old version
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.base.sha }}
path: 'gson-old-japicmp'
- name: Set up JDK 11
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Build old version
run: |
cd gson-old-japicmp
# Set dummy version
mvn --batch-mode --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.11.0:set -DnewVersion=JAPICMP-OLD
# Install artifacts with dummy version in local repository; used later by Maven plugin for comparison
mvn --batch-mode --no-transfer-progress install -DskipTests
- name: Checkout new version
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Check API compatibility
id: check-compatibility
run: |
mvn --batch-mode --fail-at-end --no-transfer-progress package japicmp:cmp -DskipTests
- name: Upload API differences artifacts
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 # v4.1.0
# 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