-
Notifications
You must be signed in to change notification settings - Fork 825
Add Azure DevOps template for F# compiler regression testing #18803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
10
commits into
main
Choose a base branch
from
copilot/fix-3f207496-cc7b-4398-a50e-5232b1585d23
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
210accf
Initial plan
Copilot 008d3e2
Add Azure DevOps regression testing pipeline for F# compiler
Copilot a268b0f
Complete regression testing pipeline with documentation and improvements
Copilot 1f17e6b
Address feedback on Azure DevOps regression testing pipeline
Copilot a19160d
Address technical feedback - simplify SDK detection, fix file paths, …
Copilot c1b4775
Convert regression testing to Azure DevOps template and integrate wit…
Copilot 5ca6ca8
Address Azure DevOps template feedback - remove strategy matrix, fix …
Copilot 05688c7
Reduce artifact size by publishing only required compiler directories
Copilot 48832d2
Fix Azure DevOps template invocation - move to correct jobs level
Copilot 4a52d23
Merge branch 'main' into copilot/fix-3f207496-cc7b-4398-a50e-5232b158…
T-Gro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,348 @@ | ||
# Regression Testing Pipeline | ||
# Tests F# compiler regressions by building third-party F# projects with the freshly built compiler | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- main | ||
- release/* | ||
- feature/* | ||
paths: | ||
include: | ||
- src/* | ||
exclude: | ||
- docs/* | ||
- .github/* | ||
- '*.md' | ||
|
||
pr: | ||
branches: | ||
include: | ||
- main | ||
- release/* | ||
- feature/* | ||
paths: | ||
include: | ||
- src/* | ||
exclude: | ||
- docs/* | ||
- .github/* | ||
- '*.md' | ||
|
||
variables: | ||
- name: _TeamName | ||
value: FSharp | ||
- name: _BuildConfig | ||
value: Release | ||
- name: _PublishUsingPipelines | ||
value: true | ||
- name: Codeql.Enabled | ||
value: false # Disabled for regression tests | ||
# Pick up pool provider name behavior from shared yaml template | ||
- template: /eng/common/templates/variables/pool-providers.yml | ||
|
||
# Matrix of third-party repositories to test against | ||
# This configuration can be extended in the future | ||
parameters: | ||
- name: testMatrix | ||
type: object | ||
default: | ||
- repo: fsprojects/FSharpPlus | ||
commit: f614035b75922aba41ed6a36c2fc986a2171d2b8 | ||
buildScript: build.cmd | ||
displayName: FSharpPlus | ||
|
||
stages: | ||
- stage: RegressionTest | ||
displayName: F# Compiler Regression Tests | ||
jobs: | ||
- job: BuildCompiler | ||
displayName: Build F# Compiler | ||
pool: | ||
name: $(DncEngPublicBuildPool) | ||
demands: ImageOverride -equals $(WindowsMachineQueueName) | ||
timeoutInMinutes: 60 | ||
steps: | ||
- checkout: self | ||
clean: true | ||
displayName: Checkout F# compiler source | ||
|
||
- task: UseDotNet@2 | ||
displayName: install SDK | ||
inputs: | ||
packageType: sdk | ||
version: '10.x' | ||
includePreviewVersions: true | ||
workingDirectory: $(Build.SourcesDirectory) | ||
installationPath: $(Build.SourcesDirectory)/.dotnet | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- script: .\eng\common\dotnet.cmd | ||
displayName: Ensure correct .NET SDK version | ||
|
||
- script: .\Build.cmd -c $(_BuildConfig) -pack | ||
env: | ||
NativeToolsOnMachine: true | ||
displayName: Build F# compiler and create packages | ||
|
||
- task: PublishPipelineArtifact@1 | ||
displayName: Publish F# Compiler Artifacts | ||
inputs: | ||
targetPath: '$(Build.SourcesDirectory)/artifacts' | ||
artifactName: 'FSharpCompilerArtifacts' | ||
publishLocation: pipeline | ||
condition: succeeded() | ||
|
||
- task: PublishPipelineArtifact@1 | ||
displayName: Publish UseLocalCompiler props file | ||
inputs: | ||
targetPath: '$(Build.SourcesDirectory)/UseLocalCompiler.Directory.Build.props' | ||
artifactName: 'UseLocalCompilerProps' | ||
publishLocation: pipeline | ||
condition: succeeded() | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Test against third-party repositories | ||
- ${{ each item in parameters.testMatrix }}: | ||
- job: Test_${{ replace(item.repo, '/', '_') }} | ||
displayName: 'Regression Test: ${{ item.displayName }}' | ||
dependsOn: BuildCompiler | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pool: | ||
name: $(DncEngPublicBuildPool) | ||
demands: ImageOverride -equals $(WindowsMachineQueueName) | ||
timeoutInMinutes: 60 | ||
variables: | ||
TestRepoName: ${{ item.repo }} | ||
TestCommit: ${{ item.commit }} | ||
BuildScript: ${{ item.buildScript }} | ||
DisplayName: ${{ item.displayName }} | ||
steps: | ||
- checkout: none | ||
displayName: Skip default checkout | ||
|
||
# Download the F# compiler artifacts | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download F# Compiler Artifacts | ||
inputs: | ||
artifactName: 'FSharpCompilerArtifacts' | ||
downloadPath: '$(Pipeline.Workspace)/FSharpCompiler' | ||
|
||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download UseLocalCompiler props | ||
inputs: | ||
artifactName: 'UseLocalCompilerProps' | ||
downloadPath: '$(Pipeline.Workspace)/Props' | ||
|
||
# Checkout the third-party repository at specific commit | ||
- task: PowerShell@2 | ||
displayName: 'Checkout $(DisplayName) at specific commit' | ||
inputs: | ||
script: | | ||
Write-Host "Cloning repository: $(TestRepoName)" | ||
git clone https://github.com/$(TestRepoName).git $(Pipeline.Workspace)/TestRepo | ||
Set-Location $(Pipeline.Workspace)/TestRepo | ||
|
||
Write-Host "Checking out commit: $(TestCommit)" | ||
git checkout $(TestCommit) | ||
|
||
Write-Host "Successfully checked out $(TestRepoName) at commit $(TestCommit)" | ||
git log -1 --oneline | ||
|
||
Write-Host "Repository structure:" | ||
Get-ChildItem -Name | ||
|
||
Write-Host "Verifying build script exists: $(BuildScript)" | ||
if (Test-Path "$(BuildScript)") { | ||
Write-Host "✓ Build script found: $(BuildScript)" | ||
} else { | ||
Write-Host "✗ Build script not found: $(BuildScript)" | ||
Write-Host "Available files in root:" | ||
Get-ChildItem | ||
exit 1 | ||
} | ||
|
||
# Detect .NET SDK version from global.json if it exists | ||
- task: PowerShell@2 | ||
displayName: 'Detect .NET SDK version for $(DisplayName)' | ||
inputs: | ||
script: | | ||
Set-Location $(Pipeline.Workspace)/TestRepo | ||
|
||
if (Test-Path "global.json") { | ||
Write-Host "Found global.json, reading .NET SDK version" | ||
$globalJson = Get-Content "global.json" | ConvertFrom-Json | ||
$sdkVersion = $globalJson.sdk.version | ||
Write-Host "Detected .NET SDK version: $sdkVersion" | ||
Write-Host "##vso[task.setvariable variable=DotNetSdkVersion]$sdkVersion" | ||
} else { | ||
Write-Host "No global.json found, will use latest public SDK" | ||
Write-Host "##vso[task.setvariable variable=DotNetSdkVersion]10.x" | ||
} | ||
|
||
# Install appropriate .NET SDK version | ||
- task: UseDotNet@2 | ||
displayName: 'Install .NET SDK for $(DisplayName)' | ||
inputs: | ||
packageType: sdk | ||
version: $(DotNetSdkVersion) | ||
includePreviewVersions: true | ||
workingDirectory: $(Pipeline.Workspace)/TestRepo | ||
installationPath: $(Pipeline.Workspace)/TestRepo/.dotnet | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Setup Directory.Build.props and UseLocalCompiler configuration using F# script | ||
- task: PowerShell@2 | ||
displayName: 'Setup local compiler configuration for $(DisplayName)' | ||
inputs: | ||
script: | | ||
Set-Location $(Pipeline.Workspace)/TestRepo | ||
|
||
# Create F# script to handle Directory.Build.props setup | ||
$fsharpScript = @' | ||
#r "nuget: System.Xml.ReaderWriter" | ||
open System.IO | ||
open System.Xml | ||
|
||
let useLocalCompilerImport = """<Import Project="UseLocalCompiler.Directory.Build.props" />""" | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let directoryBuildPropsPath = "Directory.Build.props" | ||
|
||
if File.Exists(directoryBuildPropsPath) then | ||
printfn "Directory.Build.props exists, modifying it" | ||
let doc = XmlDocument() | ||
doc.Load(directoryBuildPropsPath) | ||
|
||
// Find the Project element | ||
let projectElement = doc.SelectSingleNode("/Project") | ||
if projectElement <> null then | ||
// Check if our import already exists | ||
let existingImport = doc.SelectSingleNode(sprintf "//Import[@Project='UseLocalCompiler.Directory.Build.props']") | ||
if existingImport = null then | ||
let importElement = doc.CreateElement("Import") | ||
importElement.SetAttribute("Project", "UseLocalCompiler.Directory.Build.props") | ||
projectElement.InsertBefore(importElement, projectElement.FirstChild) |> ignore | ||
doc.Save(directoryBuildPropsPath) | ||
printfn "Added UseLocalCompiler import to existing Directory.Build.props" | ||
else | ||
printfn "UseLocalCompiler import already exists" | ||
else | ||
printfn "Warning: Could not find Project element in Directory.Build.props" | ||
else | ||
printfn "Creating new Directory.Build.props" | ||
let content = sprintf "<Project>\n %s\n</Project>" useLocalCompilerImport | ||
File.WriteAllText(directoryBuildPropsPath, content) | ||
|
||
printfn "Directory.Build.props content:" | ||
File.ReadAllText(directoryBuildPropsPath) |> printfn "%s" | ||
'@ | ||
|
||
$fsharpScript | Out-File -FilePath "PrepareRepoForTesting.fsx" -Encoding UTF8 | ||
|
||
# Run the F# script using dotnet fsi | ||
dotnet fsi PrepareRepoForTesting.fsx | ||
|
||
# Copy UseLocalCompiler.Directory.Build.props as-is (path will be set via environment variable) | ||
Copy-Item "$(Pipeline.Workspace)/Props/UseLocalCompiler.Directory.Build.props" "UseLocalCompiler.Directory.Build.props" -Force | ||
|
||
Write-Host "UseLocalCompiler.Directory.Build.props content (first 20 lines):" | ||
Get-Content "UseLocalCompiler.Directory.Build.props" | Select-Object -First 20 | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Report dotnet info in test environment | ||
- task: PowerShell@2 | ||
displayName: 'Report build environment for $(DisplayName)' | ||
inputs: | ||
script: | | ||
Set-Location $(Pipeline.Workspace)/TestRepo | ||
Write-Host "===========================================" | ||
Write-Host "Environment Information for $(DisplayName)" | ||
Write-Host "===========================================" | ||
dotnet --info | ||
Write-Host "" | ||
Write-Host "MSBuild version:" | ||
dotnet msbuild -version | ||
Write-Host "" | ||
Write-Host "F# Compiler artifacts available:" | ||
Get-ChildItem "$(Pipeline.Workspace)\FSharpCompiler\bin\fsc\Release\net9.0" -Name | ||
Write-Host "" | ||
Write-Host "F# Core available:" | ||
if (Test-Path "$(Pipeline.Workspace)\FSharpCompiler\bin\FSharp.Core\Release\netstandard2.0\FSharp.Core.dll") { | ||
Write-Host "✓ FSharp.Core.dll found" | ||
} else { | ||
Write-Host "✗ FSharp.Core.dll not found" | ||
} | ||
Write-Host "" | ||
Write-Host "Directory.Build.props content:" | ||
Get-Content "Directory.Build.props" | ||
Write-Host "" | ||
Write-Host "===========================================" | ||
|
||
# Build the third-party project using local F# compiler | ||
- task: PowerShell@2 | ||
displayName: 'Build $(DisplayName) with local F# compiler' | ||
env: | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Set environment variables to use local compiler and enforce binary logs | ||
LocalFSharpCompilerPath: $(Pipeline.Workspace)/FSharpCompiler | ||
LoadLocalFSharpBuild: true | ||
LocalFSharpCompilerConfiguration: Release | ||
# Force MSBuild binary logs | ||
MSBUILDBINARYLOGGERENABLED: true | ||
MSBUILDBINARYLOGGER: "*.binlog" | ||
timeoutInMinutes: 45 | ||
inputs: | ||
script: | | ||
Set-Location $(Pipeline.Workspace)/TestRepo | ||
Write-Host "============================================" | ||
Write-Host "Starting build for $(DisplayName)" | ||
Write-Host "Repository: $(TestRepoName)" | ||
Write-Host "Commit: $(TestCommit)" | ||
Write-Host "Build Script: $(BuildScript)" | ||
Write-Host "============================================" | ||
Write-Host "" | ||
|
||
Write-Host "Executing: $(BuildScript)" | ||
cmd /c "$(BuildScript)" | ||
$exitCode = $LASTEXITCODE | ||
|
||
Write-Host "" | ||
Write-Host "============================================" | ||
Write-Host "Build completed for $(DisplayName)" | ||
Write-Host "Exit code: $exitCode" | ||
Write-Host "============================================" | ||
|
||
if ($exitCode -ne 0) { | ||
exit $exitCode | ||
} | ||
|
||
# Capture and publish build logs on failure | ||
# Publish only MSBuild binary logs | ||
- task: PublishPipelineArtifact@1 | ||
displayName: 'Publish $(DisplayName) Binary Logs' | ||
inputs: | ||
targetPath: '$(Pipeline.Workspace)/TestRepo' | ||
T-Gro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
artifactName: '$(DisplayName)_BinaryLogs' | ||
publishLocation: pipeline | ||
condition: always() | ||
continueOnError: true | ||
|
||
# Report success/failure | ||
- task: PowerShell@2 | ||
displayName: 'Report $(DisplayName) test result' | ||
condition: always() | ||
inputs: | ||
script: | | ||
Set-Location $(Pipeline.Workspace)/TestRepo | ||
Write-Host "" | ||
Write-Host "============================================" | ||
Write-Host "Regression test completed for $(DisplayName)" | ||
Write-Host "Repository: $(TestRepoName)" | ||
Write-Host "Commit: $(TestCommit)" | ||
Write-Host "Build Script: $(BuildScript)" | ||
if ($env:AGENT_JOBSTATUS -eq "Succeeded") { | ||
Write-Host "Status: ✓ SUCCESS" | ||
Write-Host "The $(DisplayName) library builds successfully with the new F# compiler" | ||
} else { | ||
Write-Host "Status: ✗ FAILED" | ||
Write-Host "The $(DisplayName) library failed to build with the new F# compiler" | ||
Write-Host "Check the build logs and artifacts for details" | ||
} | ||
Write-Host "============================================" | ||
|
||
Write-Host "Binary logs found:" | ||
Get-ChildItem "*.binlog" -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.Name } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.