@@ -803,3 +803,117 @@ jobs:
803803 - template : templates/kv.yml
804804 - ${{ if or(eq(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) }} :
805805 - template : templates/codecov.yml
806+
807+ - job : ReleaseBranchCompat
808+ displayName : ' Release Branch Compatibility Check'
809+ cancelTimeoutInMinutes : 0
810+ timeoutInMinutes : 60
811+ continueOnError : true
812+ condition : and(eq(variables.isPR, true), eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/master'))
813+ pool :
814+ vmImage : $(UBUNTU_VERSION)
815+ strategy :
816+ matrix :
817+ spark4.0 :
818+ RELEASE_BRANCH : spark4.0
819+ JAVA_VERSION : 17
820+ SBT_JAVA_OPTS : " -J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED"
821+ steps :
822+ - checkout : self
823+ fetchDepth : 0
824+
825+ - task : JavaToolInstaller@0
826+ displayName : ' Set up JDK $(JAVA_VERSION)'
827+ inputs :
828+ versionSpec : $(JAVA_VERSION)
829+ jdkArchitectureOption : x64
830+ jdkSourceOption : PreInstalled
831+
832+ - bash : |
833+ set -e
834+ echo "=== Current HEAD (PR merge commit) ==="
835+ git log --oneline -1
836+ PR_HEAD=$(git rev-parse HEAD)
837+ echo "PR HEAD: $PR_HEAD"
838+
839+ echo "=== Fetching release branch $(RELEASE_BRANCH) ==="
840+ git fetch origin $(RELEASE_BRANCH)
841+ RELEASE_TIP=$(git rev-parse FETCH_HEAD)
842+ echo "Release branch tip: $RELEASE_TIP"
843+
844+ # Find commits unique to the release branch (not in master)
845+ # These are the release-specific patches we need to replay
846+ MASTER_BASE=$(git merge-base FETCH_HEAD $PR_HEAD)
847+ UNIQUE_COMMITS=$(git rev-list --count $MASTER_BASE..$RELEASE_TIP)
848+ echo "Release branch has $UNIQUE_COMMITS unique commit(s) to replay"
849+
850+ echo "=== Attempting rebase of $(RELEASE_BRANCH) onto PR HEAD ==="
851+ git checkout FETCH_HEAD
852+ git rebase --onto $PR_HEAD $MASTER_BASE 2>&1 || {
853+ echo "##vso[task.logissue type=warning]Rebase of $(RELEASE_BRANCH) onto this PR has merge conflicts"
854+ echo ""
855+ echo "=== Conflicting files ==="
856+ git diff --name-only --diff-filter=U 2>/dev/null || true
857+ git rebase --abort 2>/dev/null || true
858+ exit 1
859+ }
860+ echo "Rebase succeeded — $(RELEASE_BRANCH) patches apply cleanly onto this PR"
861+ displayName: 'Rebase $(RELEASE_BRANCH) onto PR HEAD'
862+
863+ - task : AzureCLI@2
864+ displayName : ' Compile $(RELEASE_BRANCH) after rebase'
865+ timeoutInMinutes : 20
866+ inputs :
867+ azureSubscription : ' SynapseML Build'
868+ scriptLocation : inlineScript
869+ scriptType : bash
870+ inlineScript : |
871+ set -e
872+ export SBT_OPTS="-Xmx4G -Xss2M -Duser.timezone=GMT"
873+ echo "=== Compiling $(RELEASE_BRANCH) rebased onto PR HEAD ==="
874+ sbt $(SBT_JAVA_OPTS) compile test:compile
875+ echo "$(RELEASE_BRANCH) compiles successfully after rebase"
876+
877+ - task : AzureCLI@2
878+ displayName : ' Setup repo for tests'
879+ inputs :
880+ azureSubscription : ' SynapseML Build'
881+ scriptLocation : inlineScript
882+ scriptType : bash
883+ inlineScript : |
884+ (timeout 30s pip install requests) || (echo "retrying" && timeout 30s pip install requests)
885+ (timeout 5m sbt $(SBT_JAVA_OPTS) setup) || (echo "retrying" && timeout 5m sbt $(SBT_JAVA_OPTS) setup) || (echo "retrying" && timeout 5m sbt $(SBT_JAVA_OPTS) setup)
886+
887+ - template : templates/kv.yml
888+
889+ - task : AzureCLI@2
890+ displayName : ' Unit tests on $(RELEASE_BRANCH) after rebase'
891+ timeoutInMinutes : 60
892+ inputs :
893+ azureSubscription : ' SynapseML Build'
894+ scriptLocation : inlineScript
895+ scriptType : bash
896+ inlineScript : |
897+ set -e
898+ export SBT_OPTS="-Xmx4G -Xss2M -Duser.timezone=GMT"
899+ echo "=== Running unit tests on $(RELEASE_BRANCH) rebased onto PR HEAD ==="
900+ FAILURES=0
901+ for pkg in core automl causal featurize image isolationforest stages recommendation nn train vw opencv exploratory; do
902+ echo "=== Testing $pkg ==="
903+ if ! timeout 10m sbt $(SBT_JAVA_OPTS) "testOnly com.microsoft.azure.synapse.ml.$pkg.**"; then
904+ echo "##vso[task.logissue type=warning]$pkg tests failed on $(RELEASE_BRANCH)"
905+ FAILURES=$((FAILURES + 1))
906+ fi
907+ done
908+ if [ $FAILURES -gt 0 ]; then
909+ echo "##vso[task.logissue type=warning]$FAILURES package(s) failed on $(RELEASE_BRANCH)"
910+ exit 1
911+ fi
912+ echo "All unit tests passed on $(RELEASE_BRANCH)"
913+
914+ - task : PublishTestResults@2
915+ displayName : ' Publish $(RELEASE_BRANCH) Test Results'
916+ inputs :
917+ testResultsFiles : ' **/test-reports/TEST-*.xml'
918+ failTaskOnFailedTests : false
919+ condition : succeededOrFailed()
0 commit comments