Skip to content

Commit 13b94a3

Browse files
TylerLeonhardtrjmholt
authored andcommitted
legacy moved to Azure DevOps (#923)
* legacy moved to AzDO * xUnit tests for windows powershell
1 parent ceae95d commit 13b94a3

11 files changed

+142
-175
lines changed

.travis.yml

-35
This file was deleted.

.vsts-ci/azure-pipelines-ci.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
trigger:
2+
- master
3+
- legacy/1.x
4+
variables:
5+
# Don't download unneeded packages
6+
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
7+
value: 'true'
8+
# Don't send telemetry
9+
- name: DOTNET_CLI_TELEMETRY_OPTOUT
10+
value: 'true'
11+
jobs:
12+
- job: Windows_powershell
13+
pool:
14+
vmImage: 'VS2017-Win2016'
15+
steps:
16+
- powershell: scripts/azurePipelinesBuild.ps1
17+
- task: PublishTestResults@2
18+
inputs:
19+
testRunner: xUnit
20+
testResultsFiles: '**/*.Results.xml'
21+
condition: succeededOrFailed()
22+
- task: PublishBuildArtifacts@1
23+
inputs:
24+
ArtifactName: PowerShellEditorServices
25+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
26+
27+
28+
- job: Windows_pwsh
29+
pool:
30+
vmImage: 'VS2017-Win2016'
31+
steps:
32+
- template: templates/ci-general.yml
33+
34+
- job: macOS
35+
pool:
36+
vmImage: 'macOS-10.13'
37+
steps:
38+
- template: templates/ci-general.yml
39+
40+
- job: Linux
41+
pool:
42+
vmImage: 'Ubuntu-16.04'
43+
steps:
44+
- template: templates/ci-general.yml

.vsts-ci/templates/ci-general.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
steps:
2+
- pwsh: scripts/azurePipelinesBuild.ps1
3+
- task: PublishTestResults@2
4+
inputs:
5+
testRunner: xUnit
6+
testResultsFiles: '**/*.Results.xml'
7+
condition: succeededOrFailed()
8+
- task: PublishBuildArtifacts@1
9+
inputs:
10+
ArtifactName: PowerShellEditorServices
11+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'

CONTRIBUTING.md

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Contribution Guidelines
22

3-
We welcome many kinds of community contributions to this project! Whether it's a feature implementation,
4-
bug fix, or a good idea, please create an issue so that we can discuss it. It is not necessary to create an
5-
issue before sending a pull request but it may speed up the process if we can discuss your idea before
3+
We welcome many kinds of community contributions to this project! Whether it's a feature implementation,
4+
bug fix, or a good idea, please create an issue so that we can discuss it. It is not necessary to create an
5+
issue before sending a pull request but it may speed up the process if we can discuss your idea before
66
you start implementing it.
77

8-
Because this project exposes a couple different public APIs, we must be very mindful of any potential breaking
9-
changes. Some contributions may not be accepted if they risk introducing breaking changes or if they
8+
Because this project exposes a couple different public APIs, we must be very mindful of any potential breaking
9+
changes. Some contributions may not be accepted if they risk introducing breaking changes or if they
1010
don't match the goals of the project. The core maintainer team has the right of final approval over
11-
any contribution to this project. However, we are very happy to hear community feedback on any decision
11+
any contribution to this project. However, we are very happy to hear community feedback on any decision
1212
so that we can ensure we are solving the right problems in the right way.
1313

1414
**NOTE**: If you believe there is a security vulnerability, please see [Security Reporting](#security-reporting).
@@ -31,7 +31,7 @@ Here's a high level list of guidelines to follow to ensure your code contributio
3131
- Follow established guidelines for commit hygiene
3232
- Write unit tests to validate new features and bug fixes
3333
- Ensure that the 'Release' build and unit tests pass locally
34-
- Ensure that the AppVeyor build passes for your change
34+
- Ensure that the Azure DevOps build passes for your change
3535
- Respond to all review feedback and final commit cleanup
3636

3737
### Practice Good Commit Hygiene
@@ -44,46 +44,46 @@ so that your commits provide a good history of the changes you are making. To b
4444
Commit messages should be clearly written so that a person can look at the commit log and understand
4545
how and why a given change was made. Here is a great model commit message taken from a [blog post
4646
by Tim Pope](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html):
47-
47+
4848
Capitalized, short (50 chars or less) summary
49-
49+
5050
More detailed explanatory text, if necessary. Wrap it to about 72
5151
characters or so. In some contexts, the first line is treated as the
5252
subject of an email and the rest of the text as the body. The blank
5353
line separating the summary from the body is critical (unless you omit
5454
the body entirely); tools like rebase can get confused if you run the
5555
two together.
56-
56+
5757
Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
5858
or "Fixes bug." This convention matches up with commit messages generated
5959
by commands like git merge and git revert.
60-
60+
6161
Further paragraphs come after blank lines.
62-
62+
6363
- Bullet points are okay, too
64-
64+
6565
- Typically a hyphen or asterisk is used for the bullet, followed by a
6666
single space, with blank lines in between, but conventions vary here
67-
67+
6868
- Use a hanging indent
69-
69+
7070
A change that fixes a known bug with an issue filed should use the proper syntax so that the [issue
71-
is automatically closed](https://help.github.com/articles/closing-issues-via-commit-messages/) once
71+
is automatically closed](https://help.github.com/articles/closing-issues-via-commit-messages/) once
7272
your change is merged. Here's an example of what such a commit message should look like:
73-
73+
7474
Fix #3: Catch NullReferenceException from DoThing
75-
75+
7676
This change adds a try/catch block to catch a NullReferenceException that
7777
gets thrown by DoThing [...]
7878

7979
- **Squash your commits**
8080

81-
If you are introducing a new feature but have implemented it over multiple commits,
82-
please [squash those commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
81+
If you are introducing a new feature but have implemented it over multiple commits,
82+
please [squash those commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
8383
into a single commit that contains all the changes in one place. This especially applies to any "oops"
84-
commits where a file is forgotten or a typo is being fixed. Following this approach makes it a lot easier
84+
commits where a file is forgotten or a typo is being fixed. Following this approach makes it a lot easier
8585
to pull those changes to other branches or roll back the change if necessary.
86-
86+
8787
- **Keep individual commits for larger changes**
8888

8989
You can certainly maintain individual commits for different phases of a big change. For example, if
@@ -96,10 +96,10 @@ so that your commits provide a good history of the changes you are making. To b
9696
If you're adding a new feature to the project, please make sure to include adequate [xUnit](http://xunit.github.io/)
9797
tests with your change. In this project, we have chosen write out unit tests in a way that uses the
9898
actual PowerShell environment rather than extensive interface mocking. This allows us to be sure that
99-
our features will work in practice.
99+
our features will work in practice.
100100

101-
We do both component-level and scenario-level testing depending on what code is being tested. We don't
102-
expect contributors to test every possible edge case. Testing mainline scenarios and the most common
101+
We do both component-level and scenario-level testing depending on what code is being tested. We don't
102+
expect contributors to test every possible edge case. Testing mainline scenarios and the most common
103103
failure scenarios is often good enough.
104104

105105
We are very happy to accept unit test contributions for any feature areas that are more error-prone than
@@ -118,15 +118,15 @@ on this check so that our project will always have good generated documentation.
118118

119119
- **Create your pull request**
120120

121-
Use the [typical process](https://help.github.com/articles/using-pull-requests/) to send a pull request
121+
Use the [typical process](https://help.github.com/articles/using-pull-requests/) to send a pull request
122122
from your fork of the project. In your pull request message, please give a high-level summary of the
123123
changes that you have made so that reviewers understand the intent of the changes. You should receive
124124
initial comments within a day or two, but please feel free to ping if things are taking longer than
125125
expected.
126126

127127
- **The build and unit tests must run green**
128128

129-
When you submit your pull request, our automated build system on AppVeyor will attempt to run a
129+
When you submit your pull request, our automated build system on Azure DevOps will attempt to run a
130130
Release build of your changes and then run all unit tests against the build. If you notice that
131131
any of your unit tests have failed, please fix them by creating a new commit and then pushing it
132132
to your branch. If you see that some unrelated test has failed, try re-running the build for your
@@ -137,15 +137,15 @@ on this check so that our project will always have good generated documentation.
137137

138138
If the reviewers ask you to make changes, make them as a new commit to your branch and push them so
139139
that they are made available for a final review pass. Do not rebase the fixes just yet so that the
140-
commit hash changes don't upset GitHub's pull request UI.
141-
140+
commit hash changes don't upset GitHub's pull request UI.
141+
142142
- **If necessary, do a final rebase**
143143

144144
Once your final changes have been accepted, we may ask you to do a final rebase to have your commits
145145
so that they follow our commit guidelines. If specific guidance is given, please follow it when
146-
rebasing your commits. Once you do your final push and we see the AppVeyor build pass, we will
146+
rebasing your commits. Once you do your final push and we see the Azure DevOps build pass, we will
147147
merge your changes!
148-
148+
149149
### Security Reporting
150150

151151
If you believe that there is a security vulnerability in the PowerShell extension for VSCode,

PowerShellEditorServices.build.ps1

+15-56
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ param(
1818

1919
#Requires -Modules @{ModuleName="InvokeBuild";ModuleVersion="3.2.1"}
2020

21-
$script:IsCIBuild = $env:APPVEYOR -ne $null
2221
$script:IsUnix = $PSVersionTable.PSEdition -and $PSVersionTable.PSEdition -eq "Core" -and !$IsWindows
2322
$script:TargetFrameworksParam = "/p:TargetFrameworks=\`"$(if (!$script:IsUnix) { "net452;" })netstandard1.6\`""
2423
$script:SaveModuleSupportsAllowPrerelease = (Get-Command Save-Module).Parameters.ContainsKey("AllowPrerelease")
@@ -33,7 +32,7 @@ if ($PSVersionTable.PSEdition -ne "Core") {
3332
Add-Type -Assembly System.IO.Compression.FileSystem
3433
}
3534

36-
task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi, PackageNuGet {
35+
task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi {
3736

3837
$requiredSdkVersion = "2.0.0"
3938

@@ -114,14 +113,17 @@ task Clean {
114113
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-Item -Force -ErrorAction Ignore
115114
}
116115

117-
task GetProductVersion -Before PackageNuGet, PackageModule, UploadArtifacts {
116+
task GetProductVersion -Before PackageModule, UploadArtifacts {
118117
[xml]$props = Get-Content .\PowerShellEditorServices.Common.props
119118

120119
$script:BuildNumber = 9999
121120
$script:VersionSuffix = $props.Project.PropertyGroup.VersionSuffix
122121

123-
if ($env:APPVEYOR) {
124-
$script:BuildNumber = $env:APPVEYOR_BUILD_NUMBER
122+
if ($env:TF_BUILD) {
123+
# SYSTEM_PHASENAME is the Job name.
124+
# Job names can only include `_` but that's not a valid character for versions.
125+
$jobname = $env:SYSTEM_PHASENAME -replace '_', ''
126+
$script:BuildNumber = "$jobname-$env:BUILD_BUILDNUMBER"
125127
}
126128

127129
if ($script:VersionSuffix -ne $null) {
@@ -155,12 +157,7 @@ task CreateBuildInfo -Before Build {
155157
$buildOrigin = "<development>"
156158

157159
# Set build info fields on build platforms
158-
if ($env:APPVEYOR)
159-
{
160-
$buildVersion = $env:APPVEYOR_BUILD_VERSION
161-
$buildOrigin = if ($env:CI) { "AppVeyor CI" } else { "AppVeyor" }
162-
}
163-
elseif ($env:TF_BUILD)
160+
if ($env:TF_BUILD)
164161
{
165162
$psd1Path = [System.IO.Path]::Combine($PSScriptRoot, "module", "PowerShellEditorServices", "PowerShellEditorServices.psd1")
166163
$buildVersion = (Import-PowerShellDataFile -LiteralPath $psd1Path).Version
@@ -207,25 +204,7 @@ task Build {
207204
Copy-Item $PSScriptRoot\src\PowerShellEditorServices\bin\$Configuration\netstandard1.6\publish\runtimes\linux-64\native\libdisablekeyecho.so -Destination $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6
208205
}
209206

210-
function UploadTestLogs {
211-
if ($script:IsCIBuild) {
212-
$testLogsPath = "$PSScriptRoot/test/PowerShellEditorServices.Test.Host/bin/$Configuration/net452/logs"
213-
$testLogsZipPath = "$PSScriptRoot/TestLogs.zip"
214-
215-
if (Test-Path $testLogsPath) {
216-
[System.IO.Compression.ZipFile]::CreateFromDirectory(
217-
$testLogsPath,
218-
$testLogsZipPath)
219-
220-
Push-AppveyorArtifact $testLogsZipPath
221-
}
222-
else {
223-
Write-Host "`n### WARNING: Test logs could not be found!`n" -ForegroundColor Yellow
224-
}
225-
}
226-
}
227-
228-
function XunitTraitFilter {
207+
function DotNetTestFilter {
229208
# Reference https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests
230209
if ($TestFilter) { "-trait $TestFilter" } else { "" }
231210
}
@@ -235,28 +214,19 @@ task Test TestServer,TestProtocol
235214
task TestServer -If { !$script:IsUnix } {
236215
Set-Location .\test\PowerShellEditorServices.Test\
237216
exec { & $script:dotnetExe build -c $Configuration -f net452 }
238-
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild (XunitTraitFilter) }
217+
exec { & $script:dotnetExe xunit -xml $PSScriptRoot/PowerShellEditorServices.Test.Results.xml -configuration $Configuration -framework net452 -verbose -nobuild (DotNetTestFilter) }
239218
}
240219

241220
task TestProtocol -If { !$script:IsUnix } {
242221
Set-Location .\test\PowerShellEditorServices.Test.Protocol\
243222
exec { & $script:dotnetExe build -c $Configuration -f net452 }
244-
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild (XunitTraitFilter) }
223+
exec { & $script:dotnetExe xunit -xml $PSScriptRoot/PowerShellEditorServices.Test.Protocol.Results.xml -configuration $Configuration -framework net452 -verbose -nobuild (DotNetTestFilter) }
245224
}
246225

247226
task TestHost -If { !$script:IsUnix } {
248227
Set-Location .\test\PowerShellEditorServices.Test.Host\
249228
exec { & $script:dotnetExe build -c $Configuration -f net452 }
250-
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild (XunitTraitFilter) }
251-
}
252-
253-
task CITest ?Test, {
254-
# This task is used to ensure we have a chance to upload
255-
# test logs as a CI artifact when the tests fail
256-
if (error Test) {
257-
UploadTestLogs
258-
Write-Error "Failing build due to test failure."
259-
}
229+
exec { & $script:dotnetExe xunit -xml $PSScriptRoot/PowerShellEditorServices.Test.Host.Results.xml -configuration $Configuration -framework net452 -verbose -nobuild (DotNetTestFilter) }
260230
}
261231

262232
task LayoutModule -After Build {
@@ -375,12 +345,6 @@ task BuildCmdletHelp {
375345
New-ExternalHelp -Path $PSScriptRoot\module\docs -OutputPath $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US -Force
376346
}
377347

378-
task PackageNuGet {
379-
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices\PowerShellEditorServices.csproj $script:TargetFrameworksParam }
380-
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj $script:TargetFrameworksParam }
381-
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj $script:TargetFrameworksParam }
382-
}
383-
384348
task PackageModule {
385349
[System.IO.Compression.ZipFile]::CreateFromDirectory(
386350
"$PSScriptRoot/module/",
@@ -389,14 +353,9 @@ task PackageModule {
389353
$false)
390354
}
391355

392-
task UploadArtifacts -If ($script:IsCIBuild) {
393-
if ($env:APPVEYOR) {
394-
Push-AppveyorArtifact .\src\PowerShellEditorServices\bin\$Configuration\Microsoft.PowerShell.EditorServices.$($script:FullVersion).nupkg
395-
Push-AppveyorArtifact .\src\PowerShellEditorServices.Protocol\bin\$Configuration\Microsoft.PowerShell.EditorServices.Protocol.$($script:FullVersion).nupkg
396-
Push-AppveyorArtifact .\src\PowerShellEditorServices.Host\bin\$Configuration\Microsoft.PowerShell.EditorServices.Host.$($script:FullVersion).nupkg
397-
Push-AppveyorArtifact .\PowerShellEditorServices-$($script:FullVersion).zip
398-
}
356+
task UploadArtifacts -If ($null -ne $env:TF_BUILD) {
357+
Copy-Item -Path .\PowerShellEditorServices-$($script:FullVersion).zip -Destination $env:BUILD_ARTIFACTSTAGINGDIRECTORY
399358
}
400359

401360
# The default task is to run the entire CI build
402-
task . GetProductVersion, Clean, Build, TestPowerShellApi, CITest, BuildCmdletHelp, PackageNuGet, PackageModule, UploadArtifacts
361+
task . GetProductVersion, Build, TestPowerShellApi, Test, BuildCmdletHelp, PackageModule, UploadArtifacts

0 commit comments

Comments
 (0)