Skip to content

legacy moved to Azure DevOps #923

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

Merged
merged 13 commits into from
Apr 15, 2019
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .vsts-ci/azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
trigger:
- master
- legacy/1.x
variables:
# Don't download unneeded packages
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: 'true'
# Don't send telemetry
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 'true'
jobs:
- job: Windows_powershell
pool:
vmImage: 'VS2017-Win2016'
steps:
- powershell: scripts/azurePipelinesBuild.ps1
- task: PublishTestResults@2
inputs:
testRunner: xUnit
testResultsFiles: '**/*.Results.xml'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
ArtifactName: PowerShellEditorServices
PathtoPublish: '$(Build.ArtifactStagingDirectory)'


- job: Windows_pwsh
pool:
vmImage: 'VS2017-Win2016'
steps:
- template: templates/ci-general.yml

- job: macOS
pool:
vmImage: 'macOS-10.13'
steps:
- template: templates/ci-general.yml

- job: Linux
pool:
vmImage: 'Ubuntu-16.04'
steps:
- template: templates/ci-general.yml
11 changes: 11 additions & 0 deletions .vsts-ci/templates/ci-general.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
steps:
- pwsh: scripts/azurePipelinesBuild.ps1
- task: PublishTestResults@2
inputs:
testRunner: xUnit
testResultsFiles: '**/*.Results.xml'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
ArtifactName: PowerShellEditorServices
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
62 changes: 31 additions & 31 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contribution Guidelines

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

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

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

### Practice Good Commit Hygiene
Expand All @@ -44,46 +44,46 @@ so that your commits provide a good history of the changes you are making. To b
Commit messages should be clearly written so that a person can look at the commit log and understand
how and why a given change was made. Here is a great model commit message taken from a [blog post
by Tim Pope](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html):

Capitalized, short (50 chars or less) summary

More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body. The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.

Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
or "Fixes bug." This convention matches up with commit messages generated
by commands like git merge and git revert.

Further paragraphs come after blank lines.

- Bullet points are okay, too

- Typically a hyphen or asterisk is used for the bullet, followed by a
single space, with blank lines in between, but conventions vary here

- Use a hanging indent

A change that fixes a known bug with an issue filed should use the proper syntax so that the [issue
is automatically closed](https://help.github.com/articles/closing-issues-via-commit-messages/) once
is automatically closed](https://help.github.com/articles/closing-issues-via-commit-messages/) once
your change is merged. Here's an example of what such a commit message should look like:

Fix #3: Catch NullReferenceException from DoThing

This change adds a try/catch block to catch a NullReferenceException that
gets thrown by DoThing [...]

- **Squash your commits**

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

- **Keep individual commits for larger changes**

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

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

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

- **Create your pull request**

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

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

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

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

- **If necessary, do a final rebase**

Once your final changes have been accepted, we may ask you to do a final rebase to have your commits
so that they follow our commit guidelines. If specific guidance is given, please follow it when
rebasing your commits. Once you do your final push and we see the AppVeyor build pass, we will
rebasing your commits. Once you do your final push and we see the Azure DevOps build pass, we will
merge your changes!

### Security Reporting

If you believe that there is a security vulnerability in the PowerShell extension for VSCode,
Expand Down
71 changes: 15 additions & 56 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ param(

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

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

task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi, PackageNuGet {
task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi {

$requiredSdkVersion = "2.0.0"

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

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

$script:BuildNumber = 9999
$script:VersionSuffix = $props.Project.PropertyGroup.VersionSuffix

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

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

# Set build info fields on build platforms
if ($env:APPVEYOR)
{
$buildVersion = $env:APPVEYOR_BUILD_VERSION
$buildOrigin = if ($env:CI) { "AppVeyor CI" } else { "AppVeyor" }
}
elseif ($env:TF_BUILD)
if ($env:TF_BUILD)
{
$psd1Path = [System.IO.Path]::Combine($PSScriptRoot, "module", "PowerShellEditorServices", "PowerShellEditorServices.psd1")
$buildVersion = (Import-PowerShellDataFile -LiteralPath $psd1Path).Version
Expand Down Expand Up @@ -207,25 +204,7 @@ task Build {
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
}

function UploadTestLogs {
if ($script:IsCIBuild) {
$testLogsPath = "$PSScriptRoot/test/PowerShellEditorServices.Test.Host/bin/$Configuration/net452/logs"
$testLogsZipPath = "$PSScriptRoot/TestLogs.zip"

if (Test-Path $testLogsPath) {
[System.IO.Compression.ZipFile]::CreateFromDirectory(
$testLogsPath,
$testLogsZipPath)

Push-AppveyorArtifact $testLogsZipPath
}
else {
Write-Host "`n### WARNING: Test logs could not be found!`n" -ForegroundColor Yellow
}
}
}

function XunitTraitFilter {
function DotNetTestFilter {
# Reference https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests
if ($TestFilter) { "-trait $TestFilter" } else { "" }
}
Expand All @@ -235,28 +214,19 @@ task Test TestServer,TestProtocol
task TestServer -If { !$script:IsUnix } {
Set-Location .\test\PowerShellEditorServices.Test\
exec { & $script:dotnetExe build -c $Configuration -f net452 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild (XunitTraitFilter) }
exec { & $script:dotnetExe xunit -xml $PSScriptRoot/PowerShellEditorServices.Test.Results.xml -configuration $Configuration -framework net452 -verbose -nobuild (DotNetTestFilter) }
}

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

task TestHost -If { !$script:IsUnix } {
Set-Location .\test\PowerShellEditorServices.Test.Host\
exec { & $script:dotnetExe build -c $Configuration -f net452 }
exec { & $script:dotnetExe xunit -configuration $Configuration -framework net452 -verbose -nobuild (XunitTraitFilter) }
}

task CITest ?Test, {
# This task is used to ensure we have a chance to upload
# test logs as a CI artifact when the tests fail
if (error Test) {
UploadTestLogs
Write-Error "Failing build due to test failure."
}
exec { & $script:dotnetExe xunit -xml $PSScriptRoot/PowerShellEditorServices.Test.Host.Results.xml -configuration $Configuration -framework net452 -verbose -nobuild (DotNetTestFilter) }
}

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

task PackageNuGet {
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices\PowerShellEditorServices.csproj $script:TargetFrameworksParam }
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj $script:TargetFrameworksParam }
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj $script:TargetFrameworksParam }
}

task PackageModule {
[System.IO.Compression.ZipFile]::CreateFromDirectory(
"$PSScriptRoot/module/",
Expand All @@ -389,14 +353,9 @@ task PackageModule {
$false)
}

task UploadArtifacts -If ($script:IsCIBuild) {
if ($env:APPVEYOR) {
Push-AppveyorArtifact .\src\PowerShellEditorServices\bin\$Configuration\Microsoft.PowerShell.EditorServices.$($script:FullVersion).nupkg
Push-AppveyorArtifact .\src\PowerShellEditorServices.Protocol\bin\$Configuration\Microsoft.PowerShell.EditorServices.Protocol.$($script:FullVersion).nupkg
Push-AppveyorArtifact .\src\PowerShellEditorServices.Host\bin\$Configuration\Microsoft.PowerShell.EditorServices.Host.$($script:FullVersion).nupkg
Push-AppveyorArtifact .\PowerShellEditorServices-$($script:FullVersion).zip
}
task UploadArtifacts -If ($null -ne $env:TF_BUILD) {
Copy-Item -Path .\PowerShellEditorServices-$($script:FullVersion).zip -Destination $env:BUILD_ARTIFACTSTAGINGDIRECTORY
}

# The default task is to run the entire CI build
task . GetProductVersion, Clean, Build, TestPowerShellApi, CITest, BuildCmdletHelp, PackageNuGet, PackageModule, UploadArtifacts
task . GetProductVersion, Build, TestPowerShellApi, Test, BuildCmdletHelp, PackageModule, UploadArtifacts
Loading