Skip to content

Commit

Permalink
Merge pull request #1699 from stripe/richardm-compat
Browse files Browse the repository at this point in the history
compatibility checking
  • Loading branch information
richardm-stripe authored Dec 1, 2023
2 parents e38ac79 + ceea10b commit e5a77be
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,63 @@ jobs:
env:
GRGIT_USER: ${{ github.actor }}
GRGIT_PASS: ${{ secrets.GITHUB_TOKEN }}

compat:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Java
id: setup-jre
uses: actions/setup-java@v1
with:
java-version: "17" # always use 17 TLS for building
architecture: x64

- name: Set Test Java Runtime Environment variable
run: echo "JAVA_TEST_HOME=${{ steps.setup-jre.outputs.path }}" >> $GITHUB_ENV

- name: Clone japi-compliance-checker
run: |
git clone https://github.com/lvc/japi-compliance-checker ../japi-compliance-checker
- name: Build HEAD JAR file
run: ./gradlew jar

- name: Copy JAR to japi-compliance-checker
run: |
mv build/libs/*.jar ../japi-compliance-checker/new.jar
- name: Checkout base branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.sha }}

- name: Build Base JAR file
run: ./gradlew jar

- name: Copy JAR to japi-compliance-checker
run: |
mv build/libs/*.jar ../japi-compliance-checker/old.jar
- name: Run JAPI Compliance Checker
run: |
cd ../japi-compliance-checker
perl japi-compliance-checker.pl -old old.jar -new new.jar --lib=stripe-java || echo "failed" > compliance_failure
cd ../stripe-java
mv ../japi-compliance-checker/compat_reports/stripe-java/*/compat_report.html report.html
- name: Upload report as artifact
uses: actions/upload-artifact@v3
with:
name: JAPI Compliance Report
path: report.html

- name: Fail if compatibility problems exist
run: |
if [ -f "../japi-compliance-checker/compliance_failure" ]; then
echo "There were compatibility problems. See the generated report at https://github.com/stripe/stripe-java/actions/runs/${{ github.run_id }}?check_suite_focus=true#artifacts"
exit 1
fi

0 comments on commit e5a77be

Please sign in to comment.