| name: Verify Generated Client API Method Compatibility |
| |
| on: |
| workflow_call: |
| secrets: |
| DEVELOCITY_ACCESS_KEY: |
| required: false |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| generated-client-method-compatibility-check: |
| if: ${{ github.event_name == 'pull_request' }} |
| runs-on: ubuntu-24.04 |
| timeout-minutes: 60 |
| |
| env: |
| TZ: Asia/Kolkata |
| DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} |
| |
| steps: |
| - name: Checkout base branch for baseline |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| with: |
| persist-credentials: false |
| repository: ${{ github.event.pull_request.base.repo.full_name }} |
| ref: ${{ github.event.pull_request.base.ref }} |
| fetch-depth: 0 |
| path: baseline |
| |
| - name: Checkout base branch for merged PR |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| with: |
| persist-credentials: false |
| repository: ${{ github.event.pull_request.base.repo.full_name }} |
| ref: ${{ github.event.pull_request.base.ref }} |
| fetch-depth: 0 |
| path: current |
| |
| - name: Merge PR into current base |
| working-directory: current |
| env: |
| PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} |
| run: | |
| git config user.name "github-actions" |
| git config user.email "github-actions@github.com" |
| |
| case "$PR_HEAD_SHA" in |
| ""|*[!0-9a-fA-F]*) |
| echo "::error::Invalid pull request head SHA: $PR_HEAD_SHA" |
| exit 1 |
| ;; |
| esac |
| |
| git fetch "https://github.com/${PR_HEAD_REPO}.git" "$PR_HEAD_SHA" --no-tags |
| |
| git merge --no-commit --no-ff FETCH_HEAD |
| |
| - name: Set up JDK 21 |
| uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5 |
| with: |
| distribution: 'zulu' |
| java-version: '21' |
| |
| - name: Generate baseline client |
| working-directory: baseline |
| run: ./gradlew --no-daemon :fineract-client:cleanupGeneratedJavaFiles -x :fineract-client-feign:cleanupGeneratedJavaFiles |
| |
| - name: Generate baseline feign client |
| working-directory: baseline |
| run: ./gradlew --no-daemon -x :fineract-client:cleanupGeneratedJavaFiles :fineract-client-feign:cleanupGeneratedJavaFiles |
| |
| - name: Generate merged client |
| working-directory: current |
| run: ./gradlew --no-daemon :fineract-client:cleanupGeneratedJavaFiles -x :fineract-client-feign:cleanupGeneratedJavaFiles |
| |
| - name: Generate merged feign client |
| working-directory: current |
| run: ./gradlew --no-daemon -x :fineract-client:cleanupGeneratedJavaFiles :fineract-client-feign:cleanupGeneratedJavaFiles |
| |
| - name: Check generated client API method compatibility |
| run: | |
| python3 current/.github/scripts/check-generated-client-method-compatibility.py \ |
| --baseline-root "${GITHUB_WORKSPACE}/baseline" \ |
| --current-root "${GITHUB_WORKSPACE}/current" \ |
| --report-file "${GITHUB_WORKSPACE}/generated-client-method-compatibility-report.md" |
| |
| - name: Archive generated client compatibility report |
| if: failure() |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| with: |
| name: generated-client-method-compatibility-report |
| path: generated-client-method-compatibility-report.md |
| if-no-files-found: ignore |
| retention-days: 5 |
| compression-level: 9 |