From 6b279b2bffdd2bf7fa3a5fff40a7da0f90e4ee44 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 23 Jul 2020 07:45:58 -0700 Subject: [PATCH 01/19] condition qsimdll --- src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj index 50eef571a8b..b972d09fb65 100644 --- a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj @@ -25,7 +25,8 @@ - + Microsoft.Quantum.Simulator.Runtime.dll PreserveNewest false From 66ad5669f5cc26d8bfc5bf2c80e1efe82e33a999 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 23 Jul 2020 08:18:04 -0700 Subject: [PATCH 02/19] conditional native --- build/build.ps1 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build/build.ps1 b/build/build.ps1 index 524c0895aa8..8ed8f0a0111 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -6,14 +6,16 @@ $ErrorActionPreference = 'Stop' & "$PSScriptRoot/set-env.ps1" $all_ok = $True -Write-Host "##[info]Build Native simulator" -cmake --build (Join-Path $PSScriptRoot "../src/Simulation/Native/build") --config $Env:BUILD_CONFIGURATION -if ($LastExitCode -ne 0) { - Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator." - $script:all_ok = $False +$nativeBuild = (Join-Path $PSScriptRoot "../src/Simulation/Native/build") +if (Test-Path $nativeBuild) { + Write-Host "##[info]Build Native simulator" + cmake --build--config $Env:BUILD_CONFIGURATION + if ($LastExitCode -ne 0) { + Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator." + $script:all_ok = $False + } } - function Build-One { param( [string]$action, From 621ef2ca75828653c53d131ef6d8dcc7221e388c Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 23 Jul 2020 19:53:18 -0700 Subject: [PATCH 03/19] os-based qsimdll --- src/Simulation/Common/Simulators.Dev.props | 19 +++++++++++++++---- .../Microsoft.Quantum.Simulators.csproj | 7 ------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Simulation/Common/Simulators.Dev.props b/src/Simulation/Common/Simulators.Dev.props index 2c93b5ab65e..7c44b437a38 100644 --- a/src/Simulation/Common/Simulators.Dev.props +++ b/src/Simulation/Common/Simulators.Dev.props @@ -5,14 +5,17 @@ bin\$(BuildConfiguration)\$(TargetFramework)\$(AssemblyName).xml $([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory)..\..\..\)) $([MSBuild]::NormalizePath($(EnlistmentRoot)src/Simulation/Native/build/)) + + + $([MSBuild]::NormalizePath($(NativeBuildPath)/libMicrosoft.Quantum.Simulator.Runtime.dylib)) $([MSBuild]::NormalizePath($(NativeBuildPath)/libMicrosoft.Quantum.Simulator.Runtime.so)) $([MSBuild]::NormalizePath($(NativeBuildPath)/Release/Microsoft.Quantum.Simulator.Runtime.dll)) $([MSBuild]::NormalizePath($(NativeBuildPath)/Debug/Microsoft.Quantum.Simulator.Runtime.dll)) - $(QsimDllMac) - $(QsimDllLinux) - $(QsimDllWindowsRelease) - $(QsimDllWindowsDebug) + $(QsimDllMac) + $(QsimDllLinux) + $(QsimDllWindowsRelease) + $(QsimDllWindowsDebug) @@ -23,6 +26,14 @@ + + + Microsoft.Quantum.Simulator.Runtime.dll + PreserveNewest + false + + + diff --git a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj index b972d09fb65..98541863364 100644 --- a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj @@ -25,13 +25,6 @@ - - Microsoft.Quantum.Simulator.Runtime.dll - PreserveNewest - false - - runtimes\win-x64\native\%(RecursiveDir)%(FileName)%(Extension) PreserveNewest From d298140802fcd0635f19b520df03d3b6f44867e8 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 23 Jul 2020 20:48:09 -0700 Subject: [PATCH 04/19] native build --- build/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.ps1 b/build/build.ps1 index 8ed8f0a0111..0f75c9ed8a5 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -9,7 +9,7 @@ $all_ok = $True $nativeBuild = (Join-Path $PSScriptRoot "../src/Simulation/Native/build") if (Test-Path $nativeBuild) { Write-Host "##[info]Build Native simulator" - cmake --build--config $Env:BUILD_CONFIGURATION + cmake --build $nativeBuild --config $Env:BUILD_CONFIGURATION if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator." $script:all_ok = $False From 98c8038698b1347ba287aa3d27c63dbb3805d3f7 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 23 Jul 2020 22:34:15 -0700 Subject: [PATCH 05/19] bootrap.sp1 --- bootstrap.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 bootstrap.ps1 diff --git a/bootstrap.ps1 b/bootstrap.ps1 new file mode 100644 index 00000000000..50bccf9dfe0 --- /dev/null +++ b/bootstrap.ps1 @@ -0,0 +1,12 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +$ErrorActionPreference = 'Stop' + +Push-Location (Join-Path $PSScriptRoot "src/Simulation/CsharpGeneration") + .\FindNuspecReferences.ps1 +Pop-Location + +Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators") + .\FindNuspecReferences.ps1 +Pop-Location From 1ddce4f5d67dbe25fbf9b521fdfba37b877ee39c Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Thu, 23 Jul 2020 23:53:39 -0700 Subject: [PATCH 06/19] FindNuspecReferences.ps1 --- src/Simulation/CsharpGeneration/FindNuspecReferences.ps1 | 4 ++-- src/Simulation/Simulators/FindNuspecReferences.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1 b/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1 index 0c3695812f9..f669dac1860 100644 --- a/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1 +++ b/src/Simulation/CsharpGeneration/FindNuspecReferences.ps1 @@ -21,13 +21,13 @@ using namespace System.IO -$target = 'Microsoft.Quantum.CsharpGeneration.nuspec' +$target = Join-Path $PSScriptRoot 'Microsoft.Quantum.CsharpGeneration.nuspec' if (Test-Path $target) { Write-Host "$target exists. Skipping generating new one." exit } -$nuspec = [Xml](Get-Content 'Microsoft.Quantum.CsharpGeneration.nuspec.template') +$nuspec = [Xml](Get-Content (Join-Path $PSScriptRoot 'Microsoft.Quantum.CsharpGeneration.nuspec.template')) $dependencies = $nuspec.CreateElement('dependencies', $nuspec.package.metadata.NamespaceURI) # Adds a dependency to the dependencies element if it does not already exist. diff --git a/src/Simulation/Simulators/FindNuspecReferences.ps1 b/src/Simulation/Simulators/FindNuspecReferences.ps1 index a1fd46b8f2b..993f4b0948e 100644 --- a/src/Simulation/Simulators/FindNuspecReferences.ps1 +++ b/src/Simulation/Simulators/FindNuspecReferences.ps1 @@ -19,7 +19,7 @@ # nuget is tracking this problem at: https://github.com/NuGet/Home/issues/4491 ######################################## -$target = "Microsoft.Quantum.Simulators.nuspec" +$target = Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.nuspec" if (Test-Path $target) { Write-Host "$target exists. Skipping generating new one." @@ -28,7 +28,7 @@ if (Test-Path $target) { # Start with the nuspec template -$nuspec = [xml](Get-Content "Microsoft.Quantum.Simulators.nuspec.template") +$nuspec = [xml](Get-Content (Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.nuspec.template")) $dep = $nuspec.CreateElement('dependencies', $nuspec.package.metadata.NamespaceURI) function Add-PackageReferenceIfNew($ref) From 4e388852563aad932bc0a0daf41f862c46715ea8 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Fri, 24 Jul 2020 01:06:40 -0700 Subject: [PATCH 07/19] skip native tests --- build/test.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build/test.ps1 b/build/test.ps1 index f66c42e0ad1..842aaea7552 100644 --- a/build/test.ps1 +++ b/build/test.ps1 @@ -4,15 +4,15 @@ & "$PSScriptRoot/set-env.ps1" $all_ok = $True -Write-Host "##[info]Test Native simulator" -pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build") -cmake --build . --config $Env:BUILD_CONFIGURATION -ctest -C $Env:BUILD_CONFIGURATION -if ($LastExitCode -ne 0) { - Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator" - $script:all_ok = $False -} -popd +# Write-Host "##[info]Test Native simulator" +# pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build") +# cmake --build . --config $Env:BUILD_CONFIGURATION +# ctest -C $Env:BUILD_CONFIGURATION +# if ($LastExitCode -ne 0) { +# Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator" +# $script:all_ok = $False +# } +# popd function Test-One { From bf41076aa50795fe33675f969469d5e0f9c1699a Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Fri, 24 Jul 2020 11:18:09 -0700 Subject: [PATCH 08/19] ci build --- build/ci.yml | 37 +++++++++++--------------------- build/steps-init.yml | 8 ++++++- build/steps-xplat.yml | 50 ------------------------------------------- 3 files changed, 19 insertions(+), 76 deletions(-) delete mode 100644 build/steps-xplat.yml diff --git a/build/ci.yml b/build/ci.yml index dc1942468d3..36fe4567385 100644 --- a/build/ci.yml +++ b/build/ci.yml @@ -9,34 +9,21 @@ variables: Drop.Native: $(System.DefaultWorkingDirectory)/xplat jobs: -- job: macOS - pool: - vmImage: 'macOS-latest' - steps: - - template: steps-xplat.yml - +- job: CI build + strategy: + matrix: + linux: + imageName: 'ubuntu-latest' + mac: + imageName: 'macOS-latest' + windows: + imageName: 'windows-latest' + pool: + vmImage: $(imageName) -- job: Linux - pool: - vmImage: 'ubuntu-latest' steps: - - template: steps-xplat.yml - - -- job: Windows - pool: - vmImage: 'windows-2019' - dependsOn: - - macOS - - Linux - condition: succeeded() - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download xplat native binaries' - inputs: - artifactName: xplat - downloadPath: $(System.DefaultWorkingDirectory) - template: steps.yml + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' inputs: diff --git a/build/steps-init.yml b/build/steps-init.yml index 6c5d681bae7..f82e0fd4272 100644 --- a/build/steps-init.yml +++ b/build/steps-init.yml @@ -19,7 +19,13 @@ steps: # Bootstrap ## - task: BatchScript@1 - displayName: 'Prepare build' + displayName: 'Bootstrap repository (Windows)' + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) inputs: filename: bootstrap.cmd modifyEnvironment: true + +- bash: ./bootstrap.sh + displayName: "Bootstrap repository (Linux/Mac)" + condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) + workingDirectory: $(System.DefaultWorkingDirectory) \ No newline at end of file diff --git a/build/steps-xplat.yml b/build/steps-xplat.yml deleted file mode 100644 index 0af6e6d1300..00000000000 --- a/build/steps-xplat.yml +++ /dev/null @@ -1,50 +0,0 @@ -## -# xplat Native Simulator build -## -steps: - -- task: UseDotNet@2 - displayName: 'Use .NET Core SDK 3.1.100' - inputs: - packageType: sdk - version: '3.1.100' - - -- bash: ./bootstrap.sh - displayName: "Bootstrap repository" - workingDirectory: $(System.DefaultWorkingDirectory) - - -- powershell: ./build.ps1 - displayName: "Building Q# runtime" - workingDirectory: $(System.DefaultWorkingDirectory)/build - - -- powershell: ./test.ps1 - displayName: "Testing Q# runtime" - workingDirectory: $(System.DefaultWorkingDirectory)/build - condition: and(succeeded(), ne(variables['Skip.Tests'], 'true')) - - -- task: CopyFiles@2 - displayName: 'Copy Files to: artifact staging directory' - inputs: - SourceFolder: '$(System.DefaultWorkingDirectory)' - Contents: 'src/Simulation/Native/build/**' - TargetFolder: '$(Build.ArtifactStagingDirectory)' - - -- task: PublishTestResults@2 - displayName: 'Publish tests results' - condition: succeededOrFailed() - inputs: - testResultsFormat: VSTest - testResultsFiles: '$(System.DefaultWorkingDirectory)/**/*.trx' - testRunTitle: 'Q# xplat runtime tests' - - -- task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: xplat' - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: xplat From af4c766e55d0047929948feceab90a9b1b5114d4 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Fri, 24 Jul 2020 11:21:08 -0700 Subject: [PATCH 09/19] build name --- build/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/ci.yml b/build/ci.yml index 36fe4567385..b274f861d26 100644 --- a/build/ci.yml +++ b/build/ci.yml @@ -9,7 +9,8 @@ variables: Drop.Native: $(System.DefaultWorkingDirectory)/xplat jobs: -- job: CI build +- job: build + displayName: Build strategy: matrix: linux: From 6cf5fb81e990cbff93f07ce237d92696590af5c3 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Fri, 24 Jul 2020 12:31:10 -0700 Subject: [PATCH 10/19] bootstrap.ps1 --- bootstrap.cmd | 14 -------------- build/steps-init.yml | 6 +++++- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/bootstrap.cmd b/bootstrap.cmd index bceffe8091f..a7b49e63c01 100644 --- a/bootstrap.cmd +++ b/bootstrap.cmd @@ -12,9 +12,6 @@ git --version || GOTO missingGit :: Initialize C++ runtime project CALL :runtimeBootstrap || EXIT /B 1 -:: Initialize the compiler's nuspec file -CALL :nuspecBootstrap || EXIT /B 1 - :: Next steps are only needed for developers environment, they are skipped for cloud builds. IF NOT "%AGENT_ID%" == "" GOTO EOF @@ -33,17 +30,6 @@ popd EXIT /B -:: Bootstrap the compiler nuspec -:nuspecBootstrap -pushd src\Simulation\CsharpGeneration -CALL powershell -NoProfile .\FindNuspecReferences.ps1 || EXIT /B 1 -popd - -pushd src\Simulation\Simulators -CALL powershell -NoProfile .\FindNuspecReferences.ps1 || EXIT /B 1 -popd -EXIT /B - :missingGit echo. echo This script depends on git. diff --git a/build/steps-init.yml b/build/steps-init.yml index f82e0fd4272..f19940d01c7 100644 --- a/build/steps-init.yml +++ b/build/steps-init.yml @@ -28,4 +28,8 @@ steps: - bash: ./bootstrap.sh displayName: "Bootstrap repository (Linux/Mac)" condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) - workingDirectory: $(System.DefaultWorkingDirectory) \ No newline at end of file + workingDirectory: $(System.DefaultWorkingDirectory) + +- pwsh: ./bootstrap.ps1 + displayName: "Bootstrap packages." + workingDirectory: $(System.DefaultWorkingDirectory) From ac3571a3d5a1cacb6b04b42276298dd05a48d01f Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Fri, 24 Jul 2020 12:36:42 -0700 Subject: [PATCH 11/19] job name --- build/steps-init.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/steps-init.yml b/build/steps-init.yml index f19940d01c7..a65c3715763 100644 --- a/build/steps-init.yml +++ b/build/steps-init.yml @@ -31,5 +31,5 @@ steps: workingDirectory: $(System.DefaultWorkingDirectory) - pwsh: ./bootstrap.ps1 - displayName: "Bootstrap packages." + displayName: "Bootstrap repository (common)" workingDirectory: $(System.DefaultWorkingDirectory) From 99430aa007b428f74ab54c14de9e38375f7b28b4 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sat, 25 Jul 2020 15:25:01 -0700 Subject: [PATCH 12/19] case sensitive --- build/manifest.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build/manifest.ps1 b/build/manifest.ps1 index 29ea070beb7..147f234a98c 100644 --- a/build/manifest.ps1 +++ b/build/manifest.ps1 @@ -16,15 +16,15 @@ ); Assemblies = @( ".\src\Azure\Azure.Quantum.Client\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Azure.Quantum.Client.dll", - ".\src\simulation\CsharpGeneration\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.CsharpGeneration.dll", - ".\src\simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.CsharpGeneration.App.dll", - ".\src\simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.RoslynWrapper.dll", - ".\src\simulation\Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Runtime.Core.dll", - ".\src\simulation\EntryPointDriver\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.EntryPointDriver.dll", - ".\src\simulation\QsharpCore\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Core.dll", - ".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Common.dll", - ".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll", - ".\src\simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.dll", + ".\src\Simulation\CsharpGeneration\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.CsharpGeneration.dll", + ".\src\Simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.CsharpGeneration.App.dll", + ".\src\Simulation\CsharpGeneration.App\bin\$Env:BUILD_CONFIGURATION\netcoreapp3.1\Microsoft.Quantum.RoslynWrapper.dll", + ".\src\Simulation\Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Runtime.Core.dll", + ".\src\Simulation\EntryPointDriver\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.EntryPointDriver.dll", + ".\src\Simulation\QsharpCore\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Core.dll", + ".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Common.dll", + ".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll", + ".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.dll", ".\src\Xunit\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Xunit.dll" ) | ForEach-Object { Get-Item (Join-Path $PSScriptRoot (Join-Path ".." $_)) }; } | Write-Output; From b324979dc488edf7325a327d7f2063f3a9849f5c Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sat, 25 Jul 2020 20:55:23 -0700 Subject: [PATCH 13/19] pack windows only --- build/steps.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/steps.yml b/build/steps.yml index 3b45dddd9eb..d32dd15c68d 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -23,7 +23,8 @@ steps: - powershell: ./pack.ps1 - displayName: "Pack Q# runtime" + displayName: "Pack Q# runtime (Windows)" + condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) workingDirectory: $(System.DefaultWorkingDirectory)/build From f3e54512a38e13965a8e1fcc644eeb588ca6c42f Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sat, 25 Jul 2020 22:25:04 -0700 Subject: [PATCH 14/19] no, really, windows --- build/steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/steps.yml b/build/steps.yml index d32dd15c68d..74f4e51f49a 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -24,7 +24,7 @@ steps: - powershell: ./pack.ps1 displayName: "Pack Q# runtime (Windows)" - condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) workingDirectory: $(System.DefaultWorkingDirectory)/build From 3d321d75fec9cd6a785016fd6d012d193d5e0a20 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sat, 25 Jul 2020 22:36:49 -0700 Subject: [PATCH 15/19] re-enable tests --- build/test.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build/test.ps1 b/build/test.ps1 index 842aaea7552..f66c42e0ad1 100644 --- a/build/test.ps1 +++ b/build/test.ps1 @@ -4,15 +4,15 @@ & "$PSScriptRoot/set-env.ps1" $all_ok = $True -# Write-Host "##[info]Test Native simulator" -# pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build") -# cmake --build . --config $Env:BUILD_CONFIGURATION -# ctest -C $Env:BUILD_CONFIGURATION -# if ($LastExitCode -ne 0) { -# Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator" -# $script:all_ok = $False -# } -# popd +Write-Host "##[info]Test Native simulator" +pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build") +cmake --build . --config $Env:BUILD_CONFIGURATION +ctest -C $Env:BUILD_CONFIGURATION +if ($LastExitCode -ne 0) { + Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator" + $script:all_ok = $False +} +popd function Test-One { From edf1824229fa374fff4c6ea874fb2a28dc17f0b2 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sun, 26 Jul 2020 10:44:34 -0700 Subject: [PATCH 16/19] ENABLE_BOOTSTRAP_NATIVE --- bootstrap.ps1 | 10 ++++++++++ build/steps-init.yml | 12 ------------ build/steps-wrap-up.yml | 1 + build/steps.yml | 1 - 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/bootstrap.ps1 b/bootstrap.ps1 index 50bccf9dfe0..e450330b68d 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -10,3 +10,13 @@ Pop-Location Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators") .\FindNuspecReferences.ps1 Pop-Location + +# bootstrap native folder +if ($Env:ENABLE_BOOTSTRAP_NATIVE -ne "false") { + ## Run the right script based on the OS. + if (-not (Test-Path Env:AGENT_OS) -or ($Env:AGENT_OS.StartsWith("Win"))) { + .\bootstrap.cmd + } else { + .\bootstrap.sh + } +} \ No newline at end of file diff --git a/build/steps-init.yml b/build/steps-init.yml index a65c3715763..42e80ead9f6 100644 --- a/build/steps-init.yml +++ b/build/steps-init.yml @@ -18,18 +18,6 @@ steps: ## # Bootstrap ## -- task: BatchScript@1 - displayName: 'Bootstrap repository (Windows)' - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - inputs: - filename: bootstrap.cmd - modifyEnvironment: true - -- bash: ./bootstrap.sh - displayName: "Bootstrap repository (Linux/Mac)" - condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) - workingDirectory: $(System.DefaultWorkingDirectory) - - pwsh: ./bootstrap.ps1 displayName: "Bootstrap repository (common)" workingDirectory: $(System.DefaultWorkingDirectory) diff --git a/build/steps-wrap-up.yml b/build/steps-wrap-up.yml index fb36f7194b8..16400704e4f 100644 --- a/build/steps-wrap-up.yml +++ b/build/steps-wrap-up.yml @@ -13,6 +13,7 @@ steps: - task: PublishSymbols@1 displayName: 'Publish symbols' + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) continueOnError: true inputs: SearchPattern: '$(System.DefaultWorkingDirectory)/src/**/*.pdb' diff --git a/build/steps.yml b/build/steps.yml index 74f4e51f49a..17828f790bb 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -24,7 +24,6 @@ steps: - powershell: ./pack.ps1 displayName: "Pack Q# runtime (Windows)" - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) workingDirectory: $(System.DefaultWorkingDirectory)/build From 1d2e72ce51a3fae04daab66288ec0eea5e1452e1 Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sun, 26 Jul 2020 11:10:33 -0700 Subject: [PATCH 17/19] ENABLE_NATIVE --- bootstrap.ps1 | 4 +++- build/build.ps1 | 5 +++-- build/test.ps1 | 21 ++++++++++++--------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/bootstrap.ps1 b/bootstrap.ps1 index e450330b68d..861a83f3f34 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -12,11 +12,13 @@ Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators") Pop-Location # bootstrap native folder -if ($Env:ENABLE_BOOTSTRAP_NATIVE -ne "false") { +if ($Env:ENABLE_NATIVE -ne "false") { ## Run the right script based on the OS. if (-not (Test-Path Env:AGENT_OS) -or ($Env:AGENT_OS.StartsWith("Win"))) { .\bootstrap.cmd } else { .\bootstrap.sh } +} else { + Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE." } \ No newline at end of file diff --git a/build/build.ps1 b/build/build.ps1 index 0f75c9ed8a5..fd01e2cf816 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -6,14 +6,15 @@ $ErrorActionPreference = 'Stop' & "$PSScriptRoot/set-env.ps1" $all_ok = $True -$nativeBuild = (Join-Path $PSScriptRoot "../src/Simulation/Native/build") -if (Test-Path $nativeBuild) { +if ($Env:ENABLE_NATIVE -ne "false") { Write-Host "##[info]Build Native simulator" cmake --build $nativeBuild --config $Env:BUILD_CONFIGURATION if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator." $script:all_ok = $False } +} else { + Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE." } function Build-One { diff --git a/build/test.ps1 b/build/test.ps1 index f66c42e0ad1..09e0e49fb9f 100644 --- a/build/test.ps1 +++ b/build/test.ps1 @@ -4,16 +4,19 @@ & "$PSScriptRoot/set-env.ps1" $all_ok = $True -Write-Host "##[info]Test Native simulator" -pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build") -cmake --build . --config $Env:BUILD_CONFIGURATION -ctest -C $Env:BUILD_CONFIGURATION -if ($LastExitCode -ne 0) { - Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator" - $script:all_ok = $False +if ($Env:ENABLE_NATIVE -ne "false") { + Write-Host "##[info]Test Native simulator" + pushd (Join-Path $PSScriptRoot "../src/Simulation/Native/build") + cmake --build . --config $Env:BUILD_CONFIGURATION + ctest -C $Env:BUILD_CONFIGURATION + if ($LastExitCode -ne 0) { + Write-Host "##vso[task.logissue type=error;]Failed to test Native Simulator" + $script:all_ok = $False + } + popd +} else { + Write-Host "Skipping native. ENABLE_NATIVE variable set to: $Env:ENABLE_NATIVE." } -popd - function Test-One { Param($project) From 68e1443e82617301723c32424cbcdadca8785aba Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sun, 26 Jul 2020 11:44:50 -0700 Subject: [PATCH 18/19] nativeBuild --- build/build.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/build/build.ps1 b/build/build.ps1 index fd01e2cf816..73bfd351d01 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -8,6 +8,7 @@ $all_ok = $True if ($Env:ENABLE_NATIVE -ne "false") { Write-Host "##[info]Build Native simulator" + $nativeBuild = (Join-Path $PSScriptRoot "../src/Simulation/Native/build") cmake --build $nativeBuild --config $Env:BUILD_CONFIGURATION if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to build Native simulator." From 003fc0fb2991fe5b9142254d94e47342bb2af52b Mon Sep 17 00:00:00 2001 From: Andres Paz Date: Sun, 26 Jul 2020 14:25:06 -0700 Subject: [PATCH 19/19] pack only windows --- build/steps-init.yml | 2 +- build/steps-wrap-up.yml | 2 +- build/steps.yml | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/steps-init.yml b/build/steps-init.yml index 42e80ead9f6..694ba89302a 100644 --- a/build/steps-init.yml +++ b/build/steps-init.yml @@ -19,5 +19,5 @@ steps: # Bootstrap ## - pwsh: ./bootstrap.ps1 - displayName: "Bootstrap repository (common)" + displayName: "Bootstrap repository" workingDirectory: $(System.DefaultWorkingDirectory) diff --git a/build/steps-wrap-up.yml b/build/steps-wrap-up.yml index 16400704e4f..9cf3a9957fc 100644 --- a/build/steps-wrap-up.yml +++ b/build/steps-wrap-up.yml @@ -12,7 +12,7 @@ steps: testRunTitle: 'Q# runtime tests' - task: PublishSymbols@1 - displayName: 'Publish symbols' + displayName: 'Publish symbols (Windows only)' condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) continueOnError: true inputs: diff --git a/build/steps.yml b/build/steps.yml index 17828f790bb..87da999f9e3 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -23,7 +23,8 @@ steps: - powershell: ./pack.ps1 - displayName: "Pack Q# runtime (Windows)" + displayName: "Pack Q# runtime (Windows only)" + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) workingDirectory: $(System.DefaultWorkingDirectory)/build