Skip to content

Commit

Permalink
Migrate PR build to Azure Pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths committed Jan 4, 2019
1 parent 4eb2842 commit dfa7a4e
Show file tree
Hide file tree
Showing 14 changed files with 320 additions and 439 deletions.
180 changes: 27 additions & 153 deletions .vsts-ci.yml
Expand Up @@ -2,160 +2,34 @@
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.

trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- appveyor.yml

phases:
- phase: Build
queue:
name: VSEng-MicroBuildVS2017
demands:
- msbuild
- visualstudio
- vstest
parallel: 2
matrix:
debug:
Configuration: Debug
SignType: Test
release:
Configuration: Release

variables:
Platform: Any CPU
Solution: '*.sln'

steps:
- task: NuGetToolInstaller@0
displayName: Install nuget
inputs:
versionSpec: '4.4.1'

- task: NuGetCommand@2
displayName: Restore nuget packages
inputs:
restoreSolution: $(Solution)

- task: MicroBuildSigningPlugin@1
displayName: Install MicroBuild signing plugin
inputs:
esrpSigning: true
signType: $(SignType)

- powershell: |
$ErrorActionPreference = 'Stop'
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name platyPS -Repository PSGallery -SkipPublisherCheck -Force
displayName: Install PowerShell modules
- powershell: |
New-ExternalHelp -Path docs\VSSetup -OutputPath "src\VSSetup.PowerShell\bin\${env:CONFIGURATION}" -Force
displayName: Compile documentation
env:
CONFIGURATION: $(Configuration)
workingDirectory: $(Build.SourcesDirectory)
- task: VSBuild@1
displayName: Build solution
inputs:
solution: $(Solution)
configuration: $(Configuration)
platform: $(Platform)
msbuildArgs: /p:RunCodeAnalysis=true /p:TreatWarningsAsErrors=true "/flp:Verbosity=Diagnostic;LogFile=$(Build.ArtifactStagingDirectory)\logs\build.log"
maximumCpuCount: true

- task: VSTest@2
displayName: Test solution
inputs:
testAssemblyVer2: |
**\$(Configuration)\*test*.dll
!**\obj\**
configuration: $(Configuration)
platform: $(Platform)
codeCoverageEnabled: true
runInParallel: true

- powershell: |
If (-Not (Test-Path -Path $env:OUTDIR -PathType Container)) { $null = New-Item -Path $env:OUTDIR -Type Directory }
Compress-Archive -Path LICENSE.txt, "${env:SRCDIR}\*.dll", "${env:SRCDIR}\*.dll-Help.xml", "${env:SRCDIR}\about_*.help.txt", "${env:SRCDIR}\VSSetup.*" -DestinationPath "${env:OUTDIR}\VSSetup.zip"
displayName: Archive output
env:
CONFIGURATION: $(Configuration)
OUTDIR: $(Build.BinariesDirectory)\bin\$(Configuration)
SRCDIR: src\VSSetup.PowerShell\bin\$(Configuration)
workingDirectory: $(Build.SourcesDirectory)
- task: NuGetCommand@2
displayName: Package output
inputs:
command: pack
basePath: $(Build.SourcesDirectory)
packDestination: $(Build.BinariesDirectory)\bin\$(Configuration)
packagesToPack: pkg\VSSetup\VSSetup.nuspec
configuration: $(Configuration)
versioningScheme: byEnvVar
versionEnvVar: GitBuildVersionSimple
includeSymbols: true
buildProperties: CommitId=$(Build.SourceVersion)

- task: VSBuild@1
displayName: Sign packages
condition: and(succeeded(), eq(variables['Configuration'], 'Release'))
inputs:
solution: pkg\VSSetup\VSSetup.signproj
configuration: $(Configuration)
platform: $(Platform)
msbuildArgs: /p:OutDir=$(Build.BinariesDirectory)\bin\$(Configuration) "/flp:Verbosity=Diagnostic;LogFile=$(Build.ArtifactStagingDirectory)\logs\sign.log"

- task: MicroBuildCodesignVerify@1
displayName: Validate packages
condition: and(succeeded(), eq(variables['Configuration'], 'Release'))
inputs:
ExcludeSNVerify: true
TargetFolder: $(Build.BinariesDirectory)\bin\$(Configuration)
WhiteListPathForCerts: build\nosign.txt

- task: CopyFiles@2
displayName: Copy output
inputs:
SourceFolder: $(Build.SourcesDirectory)\src
Contents: '**\bin\$(Configuration)\**'
TargetFolder: $(Build.ArtifactStagingDirectory)\drop\src

- task: CopyFiles@2
displayName: Copy packages
inputs:
SourceFolder: $(Build.BinariesDirectory)
Contents: bin\$(Configuration)\**
TargetFolder: $(Build.ArtifactStagingDirectory)\drop

- task: CopyFiles@2
displayName: Copy tools
inputs:
SourceFolder: $(Build.SourcesDirectory)
Contents: tools\**
TargetFolder: $(Build.ArtifactStagingDirectory)\drop

- task: PublishBuildArtifacts@1
displayName: Publish drop
inputs:
ArtifactName: drop
PathtoPublish: $(Build.ArtifactStagingDirectory)\drop

- task: PublishBuildArtifacts@1
displayName: Publish logs
condition: succeededOrFailed()
continueOnError: true
inputs:
ArtifactName: logs
PathtoPublish: $(Build.ArtifactStagingDirectory)\logs

- task: MicroBuildCleanup@1
displayName: Clean up
condition: succeededOrFailed()

# vim: set ai et st=2 sts=2 sw=2:
pr: none

queue:
name: VSEng-MicroBuildVS2017
timeoutInMinutes: 120
demands:
- msbuild
- visualstudio
- vstest

steps:
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1
displayName: Install MicroBuild signing plugin
inputs:
esrpSigning: true
signType: $(SignType)

- template: build/build.yml
parameters:
BuildConfiguration: $(BuildConfiguration)
BuildPlatform: $(BuildPlatform)
Sign: true

- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: Clean up
condition: succeededOrFailed()
49 changes: 26 additions & 23 deletions CONTRIBUTING.md
Expand Up @@ -7,12 +7,6 @@ This project uses the following software. Newer versions may work but backward c

* [Visual Studio 2015](https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx)

### Optional

Some projects require optional software to open or otherwise use in Visual Studio. They are not required to build the solution using MSBuild.

* [NuProj Package Project](https://marketplace.visualstudio.com/items?itemName=NuProjTeam.NuGetPackageProject)

## Coding

This project uses a Git flow model releasing from the `master` branch with development based on and stabilize in the `develop` branch. You can view current build status in the [README](README.md) document.
Expand Down Expand Up @@ -49,34 +43,43 @@ nuget install xunit.runner.console -outputdirectory packages
packages\xunit.runner.console.<version>\tools\xunit.runner.console test\VSSetup.PowerShell.Test\bin\Debug\Microsoft.VisualStudio.Setup.PowerShell.Test.dll
```

If your machine supports it, you can install [Docker for Windows][docker], switch to Windows containers, and test in isolated containers for runtime behavior. You can run unit tests and integration tests together.
If your machine supports it, you can install [Docker for Windows][docker], switch to Windows containers, and test in isolated containers for runtime behavior. You can run functional tests and runtime tests together.

```batch
tools\test.cmd
```

For a faster development process, you can run `docker-compose run test` from the _docker_ directory to start an interactive PowerShell session in a container running the Visual Studio Remote Debugger. The build output and test scripts are mounted into the container. If you rebuild or modify the tests the container is automatically updated. You can also start the container detached and run tests faster without having to restart the container.
You can also run tests directly with `docker-compose`:

```batch
cd docker
docker-compose up -d
REM Repeat following command as often as desired.
docker-compose exec test powershell.exe -c invoke-pester c:\tests -enableexit
docker-compose stop
docker-compose -f docker\docker-compose.yml run test
```

### Debugging

You can run `docker-compose up -d` from the _docker_ directory to start an interactive shell for exploratory testing. If no other commands are passed when starting the container, the Visual Studio Remote Debugger will launch by default. Remote debugging services are discoverable on your private network.

1. Click *Debug -> Attach to Process*
2. Change *Transport* to "Remote (no authentication)"
3. Click *Find*
4. Click *Select* on the container (host name will be the container name)
5. Select "powershell" under *Available Processes*
6. Click *Attach*
You can use the following steps to start an environment for exploratory testing or to run and debug tests. The Visual Studio Remote Debugger will launch by default and should be discoverable on your private network.

1. Run:
```batch
docker-compose -f docker\docker-compose.yml -f docker\docker-compose.debug.yml up -d
REM Start an interactive shell
docker-compose -f docker\docker-compose.yml -f docker\docker-compose.debug.yml exec test powershell.exe
```
2. Click *Debug -> Attach to Process*
3. Change *Transport* to "Remote (no authentication)"
4. Click *Find*
5. Click *Select* on the container (host name will be the container name)
6. Select "powershell" under *Available Processes*
7. Click *Attach*
8. Run any commands you like in the interactive shell, or run all tests:
```powershell
Invoke-Pester C:\Tests -EnableExit
```
9. When finished, run:
```batch
docker-compose -f docker\docker-compose.yml -f docker\docker-compose.debug.yml down
```

If you know the host name (by default, the container name) or IP address (depending on your network configuration for the container), you can type it into the *Qualifier* directory along with port 4022, e.g. "172.22.0.1:4022".

Expand Down
3 changes: 2 additions & 1 deletion README.md
@@ -1,7 +1,8 @@
Visual Studio Setup PowerShell Module
=====================================

[![build status: master](https://ci.appveyor.com/api/projects/status/4c1feyut6rvmw1dk/branch/master?svg=true)](https://ci.appveyor.com/project/VisualStudioSetup/vssetup-powershell/branch/master)
![build status: master](https://devdiv.visualstudio.com/DevDiv/_apis/build/status/Setup/Setup-VSSetup.PowerShell-CI?branchName=master&label=master)
[![build status: develop](https://dev.azure.com/azure-public/vssetup/_apis/build/status/Microsoft.vssetup.powershell?branchName=develop&label=develop)](https://dev.azure.com/azure-public/vssetup/_build/latest?definitionId=23?branchName=develop)
[![github release](https://img.shields.io/github/release/Microsoft/VSSetup.PowerShell.svg?logo=github)](https://github.com/Microsoft/VSSetup.PowerShell/releases/latest)
[![github releases: all](https://img.shields.io/github/downloads/Microsoft/VSSetup.PowerShell/total.svg?logo=github&label=github)](https://github.com/Microsoft/VSSetup.PowerShell/releases)
[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/VSSetup.svg)](https://powershellgallery.com/packages/VSSetup)
Expand Down
90 changes: 0 additions & 90 deletions appveyor.yml

This file was deleted.

24 changes: 24 additions & 0 deletions azure-pipelines.yml
@@ -0,0 +1,24 @@
# Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.

trigger:
batch: true
branches:
include:
- develop

pr:
branches:
include:
- master
- develop

pool:
vmImage: vs2017-win2016

steps:
- template: build/build.yml
parameters:
BuildConfiguration: $(BuildConfiguration)
BuildPlatform: $(BuildPlatform)
Docker: true

0 comments on commit dfa7a4e

Please sign in to comment.