From 7160baf50fa4bd159b5eddb7dba97c0b805b70ba Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 24 Mar 2025 16:39:04 -0400 Subject: [PATCH 1/3] Set `apiValidation.klib.strictValidation = true` --- gradle.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gradle.properties b/gradle.properties index 46161327..9a39ff6c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,9 @@ kotlin.code.style=official kotlin.mpp.stability.nowarn=true +# Enable API validation for all source sets: https://github.com/Kotlin/binary-compatibility-validator/issues/234 +apiValidation.klib.strictValidation = true + # gradle org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G From 6af137a6766c33e89f1e553ec27be6765c9b24ee Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 24 Mar 2025 16:39:15 -0400 Subject: [PATCH 2/3] Add api-compat-verification workflow --- .github/workflows/api-compat-verification.yml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/api-compat-verification.yml diff --git a/.github/workflows/api-compat-verification.yml b/.github/workflows/api-compat-verification.yml new file mode 100644 index 00000000..2d4a2245 --- /dev/null +++ b/.github/workflows/api-compat-verification.yml @@ -0,0 +1,34 @@ +name: API compatibility verification + +on: + pull_request: + types: [ opened, synchronize, reopened, labeled, unlabeled ] + branches: + - main + - '*-main' + +jobs: + api-compat-verification: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check for API compatibility + if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-api-break') }} + run: | + git fetch origin ${{ github.base_ref }} --depth 1 && \ + git diff remotes/origin/${{ github.base_ref }} --numstat "*.api" | awk ' + BEGIN { s = 0 } + + # git diff numstat shows lines deleted in field 2, hence sum up field 2 across all items + { s += $2 } + + # exit with the number of lines deleted as the result code so that `if failure()` works below + END { exit s } + ' + - name: Error message + if: ${{ failure() }} + run: | + echo "::error ::This change modifies the public API in a way that may be backwards-incompatible. Carefully review this pull request and either:" + echo "::error ::* Revert the changes which caused the API incompatibility –or–" + echo "::error ::* Add the 'acknowledge-api-break' label to this PR (in rare cases warranting an API breakage)" + exit 1 From b626d8024ae420ed950908163d5787a8ab45a6fe Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Tue, 25 Mar 2025 15:06:01 -0400 Subject: [PATCH 3/3] Revert "Set `apiValidation.klib.strictValidation = true`" This reverts commit 7160baf50fa4bd159b5eddb7dba97c0b805b70ba. --- gradle.properties | 3 --- 1 file changed, 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9a39ff6c..46161327 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,6 @@ kotlin.code.style=official kotlin.mpp.stability.nowarn=true -# Enable API validation for all source sets: https://github.com/Kotlin/binary-compatibility-validator/issues/234 -apiValidation.klib.strictValidation = true - # gradle org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G