Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Preparing for 0.8 release #137

Merged
merged 6 commits into from Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions Build/build.ps1
@@ -0,0 +1,42 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$ErrorActionPreference = 'Stop'

& "$PSScriptRoot/set-env.ps1"
$all_ok = $True

function Build-One {
param(
[string]$action,
[string]$project
);

dotnet $action (Join-Path $PSScriptRoot $project) `
-c $Env:BUILD_CONFIGURATION `
-v $Env:BUILD_VERBOSITY `
/property:DefineConstants=$Env:ASSEMBLY_CONSTANTS `
/property:Version=$Env:ASSEMBLY_VERSION `
/property:QsharpDocsOutDir=$Env:DOCS_OUTDIR

if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to build $project."
$script:all_ok = $False
}
}

Write-Host "##[info]Build Standard library"
Build-One 'publish' '../Standard.sln'

Write-Host "##[info]Build Chemistry library"
Build-One 'publish' '../Chemistry.sln'

Write-Host "##[info]Build Numerics library"
Build-One 'publish' '../Numerics.sln'

Write-Host "##[info]Build Standard library"
Build-One 'publish' '../Magic.sln'

if (-not $all_ok) {
throw "At least one test failed execution. Check the logs."
}
39 changes: 39 additions & 0 deletions Build/pack.ps1
@@ -0,0 +1,39 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$ErrorActionPreference = 'Stop'

& "$PSScriptRoot/set-env.ps1"
$all_ok = $True

function Pack-One() {
Param($project)

dotnet pack (Join-Path $PSScriptRoot $project) `
--no-build `
-c $Env:BUILD_CONFIGURATION `
-v $Env:BUILD_VERBOSITY `
-o $Env:NUGET_OUTDIR `
/property:PackageVersion=$Env:NUGET_VERSION

if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to pack $project."
$script:all_ok = $False
}
}

Write-Host "##[info]Pack Standard library"
Pack-One '../Standard/src/Standard.csproj'

Write-Host "##[info]Pack Chemistry library"
Pack-One '../Chemistry/src/DataModel/DataModel.csproj'

Write-Host "##[info]Pack Numerics library"
Pack-One '../Numerics/src/Numerics.csproj'

Write-Host "##[info]Pack chemistry magics library"
Pack-One '../Chemistry/src/Jupyter/Jupyter.csproj'

if (-not $all_ok) {
throw "At least one test failed execution. Check the logs."
}
21 changes: 21 additions & 0 deletions Build/set-env.ps1
@@ -0,0 +1,21 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$ErrorActionPreference = 'Stop'

Write-Host "Setting up build environment variables"

If ($Env:BUILD_BUILDNUMBER -eq $null) { $Env:BUILD_BUILDNUMBER ="0.0.1.0" }
If ($Env:BUILD_CONFIGURATION -eq $null) { $Env:BUILD_CONFIGURATION ="Debug" }
If ($Env:BUILD_VERBOSITY -eq $null) { $Env:BUILD_VERBOSITY ="m" }
If ($Env:ASSEMBLY_VERSION -eq $null) { $Env:ASSEMBLY_VERSION ="$Env:BUILD_BUILDNUMBER" }
If ($Env:NUGET_VERSION -eq $null) { $Env:NUGET_VERSION ="$Env:ASSEMBLY_VERSION-alpha" }

If ($Env:DROPS_DIR -eq $null) { $Env:DROPS_DIR = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\drops")) }

If ($Env:NUGET_OUTDIR -eq $null) { $Env:NUGET_OUTDIR = (Join-Path $Env:DROPS_DIR "nugets") }
If (-not (Test-Path -Path $Env:NUGET_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:NUGET_OUTDIR) }

If ($Env:DOCS_OUTDIR -eq $null) { $Env:DOCS_OUTDIR = (Join-Path $Env:DROPS_DIR "docs") }
If (-not (Test-Path -Path $Env:DOCS_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:DOCS_OUTDIR) }

62 changes: 0 additions & 62 deletions Build/step-build-libs.yml

This file was deleted.

32 changes: 0 additions & 32 deletions Build/step-build-magic.yml

This file was deleted.

32 changes: 15 additions & 17 deletions Build/step-wrap-up.yml
Expand Up @@ -3,27 +3,25 @@
##

steps:
- task: PublishSymbols@1
displayName: 'Publish symbols path: '


- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: |
**/bin/$(BuildConfiguration)/**
*.nupkg
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishTestResults@2
displayName: 'Publish tests results'
condition: succeededOrFailed()
inputs:
testResultsFormat: VSTest
testResultsFiles: '$(System.DefaultWorkingDirectory)/**/*.trx'
testRunTitle: 'Q# Libraries tests'


- task: PublishSymbols@1
displayName: 'Publish symbols'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
inputs:
SearchPattern: '$(System.DefaultWorkingDirectory)/src/**/*.pdb'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
displayName: 'Publish Artifact: qsharp-runtime'
condition: succeededOrFailed()

inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: QuantumLibraries


19 changes: 19 additions & 0 deletions Build/steps.yml
@@ -0,0 +1,19 @@
steps:

- powershell: ./build.ps1
displayName: "Building"
workingDirectory: $(System.DefaultWorkingDirectory)/Build


- powershell: ./test.ps1
displayName: "Testing"
workingDirectory: $(System.DefaultWorkingDirectory)/Build
condition: and(succeeded(), ne(variables['Skip.Tests'], 'true'))


- powershell: ./pack.ps1
displayName: "Pack"
workingDirectory: $(System.DefaultWorkingDirectory)/Build


- template: step-wrap-up.yml
48 changes: 48 additions & 0 deletions Build/test.ps1
@@ -0,0 +1,48 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$ErrorActionPreference = 'Stop'

& "$PSScriptRoot/set-env.ps1"
$all_ok = $True

function Test-One {
Param($project)

dotnet test (Join-Path $PSScriptRoot $project) `
-c $Env:BUILD_CONFIGURATION `
-v $Env:BUILD_VERBOSITY `
--logger trx `
/property:DefineConstants=$Env:ASSEMBLY_CONSTANTS `
/property:Version=$Env:ASSEMBLY_VERSION

if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to test $project."
$script:all_ok = $False
}
}

Write-Host "##[info]Testing Standard/tests/Standard.Tests.csproj"
Test-One '../Standard/tests/Standard.Tests.csproj'

Write-Host "##[info]Testing Chemistry/tests/ChemistryTests/QSharpTests.csproj"
Test-One '../Chemistry/tests/ChemistryTests/QSharpTests.csproj'

Write-Host "##[info]Testing Chemistry/tests/SystemTests/SystemTests.csproj"
Test-One '../Chemistry/tests/SystemTests/SystemTests.csproj'

Write-Host "##[info]Testing Chemistry/tests/DataModelTests/CSharpTests.csproj"
Test-One '../Chemistry/tests/DataModelTests/CSharpTests.csproj'

Write-Host "##[info]Testing Chemistry/tests/SerializationTests/SerializationTests.csproj"
Test-One '../Chemistry/tests/SerializationTests/SerializationTests.csproj'

Write-Host "##[info]Testing Chemistry/tests/JupyterTests/JupyterTests.csproj"
Test-One '../Chemistry/tests/JupyterTests/JupyterTests.csproj'

Write-Host "##[info]Testing Numerics/tests/NumericsTests.csproj"
Test-One '../Numerics/tests/NumericsTests.csproj'

if (-not $all_ok) {
throw "At least one test failed execution. Check the logs."
}
2 changes: 1 addition & 1 deletion Chemistry/src/DataModel/DataModel.csproj
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.1701" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="YamlDotNet" Version="6.0.0" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
Expand Down
4 changes: 2 additions & 2 deletions Chemistry/src/Jupyter/Jupyter.csproj
Expand Up @@ -19,8 +19,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Jupyter.Core" Version="1.1.12077" />
<PackageReference Include="Microsoft.Quantum.Simulators" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.IQSharp.Core" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Simulators" Version="0.8.1907.1701" />
<PackageReference Include="Microsoft.Quantum.IQSharp.Core" Version="0.8.1907.1701" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Chemistry/src/Runtime/Runtime.csproj
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.1701" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Chemistry/tests/ChemistryTests/QSharpTests.csproj
Expand Up @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.1701" />
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.8.1907.1701" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
Expand Down
4 changes: 2 additions & 2 deletions Chemistry/tests/DataModelTests/CSharpTests.csproj
Expand Up @@ -24,8 +24,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.1701" />
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.8.1907.1701" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
Expand Down
4 changes: 2 additions & 2 deletions Chemistry/tests/SamplesTests/SamplesTests.csproj
Expand Up @@ -18,8 +18,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.7.1905.3109" />
<PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.1701" />
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.8.1907.1701" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
Expand Down
Expand Up @@ -157,8 +157,8 @@ public void EstimateEnergyUCCSD()
var configuration = Config.Default();
configuration.UseIndexConvention = IndexConvention.UpDown;

// Loads a given UCCSD state
var qSharpData = Load("UCCSD test0", configuration);
// Loads a given UCCSD state
var qSharpData = Load("UCCSD test0", configuration);

using (var qsim = new QuantumSimulator())
{
Expand All @@ -167,9 +167,9 @@ public void EstimateEnergyUCCSD()
var estEnergy = EstimateEnergy.Run(qsim, qSharpData, nSamples).Result;

// Compare to reference value
Assert.Equal(-7.8602, estEnergy, 2);
Assert.Equal(-7.8602, estEnergy, 2);
}
}
}
}
}
}