diff --git a/.github/workflows/breaking.yaml b/.github/workflows/breaking.yaml new file mode 100644 index 000000000..abf2218e4 --- /dev/null +++ b/.github/workflows/breaking.yaml @@ -0,0 +1,53 @@ +name: breaking +on: + pull_request: + +jobs: + broken-changes: + concurrency: + group: broken-changes-${{ github.ref }} + cancel-in-progress: true + if: (!contains(github.event.pull_request.labels.*.name, 'broken changes')) + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: 'temurin' + cache: 'maven' + + - name: Build + run: mvn -DskipTests -ntp install + + - name: Check broken API changes + run: set -o pipefail && mvn org.revapi:revapi-maven-plugin:report-aggregate -DskipTests -ntp + + - name: Generate backward compatibility report + run: | + cat changes.txt + touch report.txt + + if [ -s changes.txt ]; then + echo "CHANGES_DETECTED=true" >> $GITHUB_ENV + echo "Backward compatibility check report" >> report.txt + echo "======" >> report.txt + cat changes.txt >> report.txt + else + echo "CHANGES_DETECTED=false" >> $GITHUB_ENV + fi + + # Skip comment for forks - GITHUB_TOKEN doesn't have write permissions for external PRs + - name: Comment Report + if: always() && github.event.pull_request.head.repo.full_name == github.repository && env.CHANGES_DETECTED == 'true' + uses: marocchino/sticky-pull-request-comment@v2 + with: + path: report.txt + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: diff diff --git a/config/revapi-report-template.ftl b/config/revapi-report-template.ftl new file mode 100644 index 000000000..c7714491f --- /dev/null +++ b/config/revapi-report-template.ftl @@ -0,0 +1,16 @@ +<#if reports?has_content> +``` +<#list analysis.oldApi.archives as archive>${archive.name}<#sep>, +<#list analysis.newApi.archives as archive>${archive.name}<#sep>, +``` + +<#list reports as report> +>***Old: ${report.oldElement!""}*** +>***New: ${report.newElement!""}*** + <#list report.differences as diff> +> ${diff.code}<#if diff.description??>: ${diff.description} + + + +--- + diff --git a/pom.xml b/pom.xml index ebb757352..d3e1bbbaf 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,7 @@ 2.0.3 17.0.0 + 0.15.1 @@ -184,6 +185,42 @@ + + org.revapi + revapi-maven-plugin + ${maven-revapi-plugin.version} + + + org.revapi + revapi-java + 0.28.4 + + + org.revapi + revapi-reporter-text + ${maven-revapi-plugin.version} + + + + + + + + tech.ydb.* + + + + + BREAKING + documented + changes.txt + + true + true + + + + org.apache.maven.plugins maven-surefire-plugin