From cc545ad98738cfc387ed45433b5b80ccca7ead98 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 1 Oct 2025 08:55:56 +0300 Subject: [PATCH 1/6] chore: API Diff converted to GitHub action --- .github/workflows/validation.yml | 114 ++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index de8154793a0..ddafa1a0846 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -256,7 +256,7 @@ jobs: - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v2 with: - junit_files: "**/target/*-reports/TEST*.xml" + junit_files: '**/target/*-reports/TEST*.xml' check_run_annotations: all tests, skipped tests - uses: geekyeggo/delete-artifact@v4 with: @@ -268,5 +268,113 @@ jobs: - name: Set Failure Status if: ${{ always() && (needs.unit-tests.result != 'success' || needs.it-tests.result != 'success') }} run: | - echo "🚫 THERE ARE TEST MODULES WITH FAILURES or BEEN CANCELLED" | tee -a $GITHUB_STEP_SUMMARY - exit 1 + echo "🚫 THERE ARE TEST MODULES WITH FAILURES or BEEN CANCELLED" | tee -a $GITHUB_STEP_SUMMARY + exit 1 + api-diff-labeling: + if: github.event_name == 'pull_request_target' + timeout-minutes: 90 + runs-on: ubuntu-24.04 + permissions: + contents: read + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + ref: ${{env.HEAD_SHA}} + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.2 + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + - name: Use temporary flow version + run: | + mvn org.codehaus.mojo:versions-maven-plugin:2.13.0:set -DnewVersion=1111.3.2-SNAPSHOT -B + - name: Determine base version + id: base-version + run: | + baseBranch="${{ github.event.pull_request.base.ref }}" + echo "Base branch: ${baseBranch}" + + # Handle special case for main branch + if [[ "${baseBranch}" == "main" ]]; then + baseVersion="25.0-SNAPSHOT" + else + # For all other branches, use pattern: {branch}-SNAPSHOT + baseVersion="${baseBranch}-SNAPSHOT" + fi + + echo "Base API Version: ${baseVersion}" + echo "BASE_API_VERSION=${baseVersion}" >> $GITHUB_OUTPUT + - name: Calculate API version difference + run: | + mvn clean install -B -ntp -e -V -pl=flow-server,flow-data,flow-html-components,vaadin-spring -am -Papicmp -DskipTests -Dapi.reference.version=${{ steps.base-version.outputs.BASE_API_VERSION }} -Dtest.use.hub=true -Djapicmp.maven.plugin.version=0.22.0 + - name: Move API diff results + run: | + #!/bin/bash + mkdir -p apidiff + mv flow-server/target/japicmp apidiff/flow-server + mv flow-data/target/japicmp apidiff/flow-data + mv flow-html-components/target/japicmp apidiff/flow-html-components + if [ -d vaadin-spring ]; then + mv vaadin-spring/target/japicmp apidiff/vaadin-spring + fi + - name: Upload API diff artifacts + uses: actions/upload-artifact@v4 + with: + name: apidiff-reports + path: apidiff/ + - name: Report API DIFF to GitHub + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + #!/bin/bash + + echo "Running API version verification" + diff_files=$( find apidiff -name "*.html") + + version_change="0.0.0" + + for file in ${diff_files} + do + echo " Verifying file '${file}'..." + temp_version_change=$( grep -A 2 "id=\"semver-version\"" ${file} | grep -o [0-9]\.[0-9]\.[0-9] || echo "0.0.0") + + if [[ "${version_change}" < "${temp_version_change}" ]]; then + version_change=${temp_version_change} + fi + done + + echo "Discovered version change: ${version_change}" + + # Get current labels + current_labels=$(gh api repos/${{ github.repository }}/issues/${{ github.event.number }}/labels --jq '.[].name') + + # Check if version change label already exists + if echo "${current_labels}" | grep -q "+${version_change}"; then + echo "Discovered version change '${version_change}' is already labeled, no need to update" + else + echo "Updating version change label to +${version_change}" + + # Remove existing version labels + for tlabel in '+0.0.1' '+0.1.0' '+1.0.0'; do + if echo "${current_labels}" | grep -q "${tlabel}" && [[ "${version_change}" != "${tlabel##+}" ]]; then + echo "Removing label ${tlabel}" + gh api repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/"${tlabel}" -X DELETE || true + fi + done + + # Add new version label + gh api repos/${{ github.repository }}/issues/${{ github.event.number }}/labels \ + -f labels[]="+${version_change}" \ + --method POST + fi From 5b8d7443bb98f0f086e2400dbfffc2073e5e40ad Mon Sep 17 00:00:00 2001 From: Zhe Sun <31067185+ZheSun88@users.noreply.github.com> Date: Tue, 7 Oct 2025 09:11:36 +0300 Subject: [PATCH 2/6] define the github.event.xxx in env and extract the java.version for easier maintenance --- .github/workflows/validation.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 5b5a19c3c8c..bcd11b7145e 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -14,6 +14,8 @@ env: HEAD_REF: ${{ github.head_ref }} REF_NAME: ${{ github.ref_name }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} + JAVA_VERSION: '21' + BASE_VERSION: '25.0-SNAPSHOT' jobs: build: timeout-minutes: 30 @@ -50,7 +52,7 @@ jobs: - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: "${{ env.JAVA_VERSION }}" distribution: 'temurin' - name: Set up Maven uses: stCarolas/setup-maven@v5 @@ -95,7 +97,7 @@ jobs: - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: "${{ env.JAVA_VERSION }}" distribution: 'temurin' - name: Set up Maven uses: stCarolas/setup-maven@v5 @@ -170,7 +172,7 @@ jobs: - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: "${{ env.JAVA_VERSION }}" distribution: 'temurin' - name: Set up Maven uses: stCarolas/setup-maven@v5 @@ -285,7 +287,7 @@ jobs: - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: "${{ env.JAVA_VERSION }}" distribution: 'temurin' - name: Set up Maven uses: stCarolas/setup-maven@v5 @@ -301,13 +303,15 @@ jobs: mvn org.codehaus.mojo:versions-maven-plugin:2.13.0:set -DnewVersion=1111.3.2-SNAPSHOT -B - name: Determine base version id: base-version + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} run: | - baseBranch="${{ github.event.pull_request.base.ref }}" + baseBranch="${{ env.BASE_REF }}" echo "Base branch: ${baseBranch}" # Handle special case for main branch if [[ "${baseBranch}" == "main" ]]; then - baseVersion="25.0-SNAPSHOT" + baseVersion="${{ env.BASE_VERSION }}" else # For all other branches, use pattern: {branch}-SNAPSHOT baseVersion="${baseBranch}-SNAPSHOT" @@ -336,6 +340,7 @@ jobs: - name: Report API DIFF to GitHub env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.number }} run: | #!/bin/bash @@ -357,7 +362,7 @@ jobs: echo "Discovered version change: ${version_change}" # Get current labels - current_labels=$(gh api repos/${{ github.repository }}/issues/${{ github.event.number }}/labels --jq '.[].name') + current_labels=$(gh api repos/${{ github.repository }}/issues/${{ env.PR_NUMBER }}/labels --jq '.[].name') # Check if version change label already exists if echo "${current_labels}" | grep -q "+${version_change}"; then @@ -369,12 +374,12 @@ jobs: for tlabel in '+0.0.1' '+0.1.0' '+1.0.0'; do if echo "${current_labels}" | grep -q "${tlabel}" && [[ "${version_change}" != "${tlabel##+}" ]]; then echo "Removing label ${tlabel}" - gh api repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/"${tlabel}" -X DELETE || true + gh api repos/${{ github.repository }}/issues/${{ env.PR_NUMBER }}/labels/"${tlabel}" -X DELETE || true fi done # Add new version label - gh api repos/${{ github.repository }}/issues/${{ github.event.number }}/labels \ + gh api repos/${{ github.repository }}/issues/${{ env.PR_NUMBER }}/labels \ -f labels[]="+${version_change}" \ --method POST fi From 782416ae3df12d8828be6877c6a97d89726fe00b Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sat, 11 Oct 2025 14:51:27 +0300 Subject: [PATCH 3/6] Simplify --- .github/workflows/validation.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index dccf8f07b00..4e505879c72 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -13,7 +13,9 @@ concurrency: env: HEAD_REF: ${{ github.head_ref }} REF_NAME: ${{ github.ref_name }} + BASE_REF: ${{ github.event.pull_request.base.ref }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} + PR_NUMBER: ${{ github.event.number }} JAVA_VERSION: '21' BASE_VERSION: '25.0-SNAPSHOT' jobs: @@ -291,11 +293,9 @@ jobs: restore-keys: ${{ runner.os }}-maven- - name: Use temporary flow version run: | - mvn org.codehaus.mojo:versions-maven-plugin:2.13.0:set -DnewVersion=1111.3.2-SNAPSHOT -B + mvn versions:set -DnewVersion=1111.3.2-SNAPSHOT -B - name: Determine base version id: base-version - env: - BASE_REF: ${{ github.event.pull_request.base.ref }} run: | baseBranch="${{ env.BASE_REF }}" echo "Base branch: ${baseBranch}" @@ -331,7 +331,6 @@ jobs: - name: Report API DIFF to GitHub env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.number }} run: | #!/bin/bash From 2832514e8c83cddd1c1c0145e1185024960b284b Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sat, 11 Oct 2025 15:05:11 +0300 Subject: [PATCH 4/6] chore: use JAVA_VERSION variable in GitHub workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hard-coded JDK 21 references with JAVA_VERSION environment variable to improve maintainability and make Java version updates easier. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/formatter.yml | 7 +++++-- .github/workflows/validation.yml | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 9faa35ef3ab..79c4c52008e 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -9,6 +9,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + JAVA_VERSION: '21' + permissions: contents: read pull-requests: write @@ -31,10 +34,10 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: '21' + java-version: "${{ env.JAVA_VERSION }}" distribution: 'temurin' cache: 'maven' diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 4e505879c72..0d1ee2164e8 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -42,7 +42,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '24.9.0' - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: "${{ env.JAVA_VERSION }}" @@ -87,7 +87,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{env.HEAD_SHA}} - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: "${{ env.JAVA_VERSION }}" @@ -162,7 +162,7 @@ jobs: - uses: oven-sh/setup-bun@v2 with: bun-version: 'latest' - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: "${{ env.JAVA_VERSION }}" @@ -277,7 +277,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{env.HEAD_SHA}} - - name: Set up JDK 21 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: "${{ env.JAVA_VERSION }}" From 681182ccef1ab32cd31111b14b3807db59372061 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sat, 11 Oct 2025 15:07:02 +0300 Subject: [PATCH 5/6] chore: simplify vaadin-spring directory check in workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary conditional check for vaadin-spring directory as it always exists in the repository. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/validation.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 0d1ee2164e8..edd51215c32 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -320,9 +320,7 @@ jobs: mv flow-server/target/japicmp apidiff/flow-server mv flow-data/target/japicmp apidiff/flow-data mv flow-html-components/target/japicmp apidiff/flow-html-components - if [ -d vaadin-spring ]; then - mv vaadin-spring/target/japicmp apidiff/vaadin-spring - fi + mv vaadin-spring/target/japicmp apidiff/vaadin-spring - name: Upload API diff artifacts uses: actions/upload-artifact@v4 with: From 54d5864591cdcf763ab06a9bc5b558b9df7c94f5 Mon Sep 17 00:00:00 2001 From: Artur Date: Wed, 1 Oct 2025 09:09:07 +0300 Subject: [PATCH 6/6] Test api diff action Added a placeholder 'foo' to the README file. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 533ff9eb8cf..e90b6dd7eeb 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Vaadin Flow **For issues related to [Hilla](https://hilla.dev/), please refer to the https://github.com/vaadin/hilla repository.** +foo + Ask questions about Vaadin Flow in our [forum](https://vaadin.com/forum/c/flow/8). Since [Vaadin platform 23.0](https://github.com/vaadin/platform), Flow major and minor versions are aligned with platform versions: