-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for a single file, add unit-tests and add azure pipelines…
… yaml (#2) * tests * . * blob * 0 * . * opencover * readme * remove zip code
- Loading branch information
Showing
21 changed files
with
1,836 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
https://github.com/StefH/GitHubReleaseNotes | ||
|
||
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 0.1.0 | ||
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 0.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
pool: | ||
vmImage: 'windows-2019' | ||
|
||
variables: | ||
Prerelease: 'ci' | ||
buildId: "1$(Build.BuildId)" | ||
buildProjects: '**/src/**/*.csproj' | ||
|
||
steps: | ||
# Print buildId | ||
- script: | | ||
echo "BuildId = $(buildId)" | ||
displayName: 'Print buildId' | ||
|
||
# Install Tools (SonarScanner) | ||
- script: | | ||
dotnet tool install --global dotnet-sonarscanner | ||
displayName: Install Tools (SonarScanner) | ||
|
||
# Build source, tests and run tests with coverage | ||
- script: | | ||
dotnet test ./tests/Pulumi.Azure.Extensions.Tests/Pulumi.Azure.Extensions.Tests.csproj --configuration Debug --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover | ||
displayName: 'Build source, tests and run tests with coverage' | ||
|
||
# Upload coverage to codecov.io | ||
- script: | | ||
%USERPROFILE%\.nuget\packages\codecov\1.10.0\tools\codecov.exe -f "./tests/Pulumi.Azure.Extensions.Tests/coverage.opencover.xml" -t $(CODECOV_TOKEN) | ||
displayName: Upload coverage to codecov.io | ||
|
||
# https://github.com/microsoft/azure-pipelines-tasks/issues/12212 | ||
- task: PublishTestResults@2 | ||
condition: and(succeeded(), eq(variables['PUBLISH_TESTRESULTS'], 'yes')) | ||
inputs: | ||
testRunner: VSTest | ||
testResultsFiles: '**/*.trx' | ||
|
||
# Based on https://whereslou.com/2018/09/versioning-and-publishing-nuget-packages-automatically-using-azure-devops-pipelines/ | ||
- task: DotNetCoreCLI@2 | ||
displayName: Build Release | ||
inputs: | ||
command: 'build' | ||
arguments: /p:Configuration=Release # https://github.com/MicrosoftDocs/vsts-docs/issues/1976 | ||
projects: $(buildProjects) | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: Pack | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests | ||
inputs: | ||
command: pack | ||
configuration: 'Release' | ||
packagesToPack: $(buildProjects) | ||
nobuild: true | ||
packDirectory: '$(Build.ArtifactStagingDirectory)/packages' | ||
verbosityPack: 'normal' | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish Artifacts | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests | ||
inputs: | ||
PathtoPublish: '$(Build.ArtifactStagingDirectory)' | ||
|
||
# https://github.com/NuGet/Home/issues/8148 | ||
- task: DotNetCoreCLI@2 | ||
displayName: Push to MyGet | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests | ||
inputs: | ||
command: custom | ||
custom: nuget | ||
arguments: push $(Build.ArtifactStagingDirectory)\packages\*.nupkg -n true -s https://www.myget.org/F/pulumi-azure-extensions/api/v3/index.json -k $(MyGetKey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ASP.NET | ||
# Build and test ASP.NET projects. | ||
# Add steps that publish symbols, save build artifacts, deploy, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 | ||
|
||
trigger: | ||
- master | ||
|
||
pool: | ||
vmImage: 'windows-latest' | ||
|
||
variables: | ||
solution: '**/*.sln' | ||
buildPlatform: 'Any CPU' | ||
buildConfiguration: 'Release' | ||
|
||
steps: | ||
- task: NuGetToolInstaller@1 | ||
|
||
- task: NuGetCommand@2 | ||
inputs: | ||
restoreSolution: '$(solution)' | ||
|
||
- task: VSBuild@1 | ||
inputs: | ||
solution: '$(solution)' | ||
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' | ||
platform: '$(buildPlatform)' | ||
configuration: '$(buildConfiguration)' | ||
|
||
- task: VSTest@2 | ||
inputs: | ||
platform: '$(buildPlatform)' | ||
configuration: '$(buildConfiguration)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace Pulumi.Azure.Extensions.Utils | ||
{ | ||
public sealed class TempFolder : IDisposable | ||
{ | ||
private readonly bool _isTemp; | ||
|
||
public string Path { get; } | ||
|
||
public TempFolder(string path, bool isTemp) | ||
{ | ||
_isTemp = isTemp; | ||
|
||
if (isTemp) | ||
{ | ||
Path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Guid.NewGuid().ToString()); ; | ||
Clear(true); | ||
Create(true); | ||
} | ||
else | ||
{ | ||
Path = path; | ||
} | ||
} | ||
|
||
private void Create(bool isTemp) | ||
{ | ||
if (!isTemp) | ||
{ | ||
return; | ||
} | ||
|
||
try | ||
{ | ||
if (!Directory.Exists(Path)) | ||
{ | ||
Directory.CreateDirectory(Path); | ||
} | ||
} | ||
catch (IOException) | ||
{ | ||
} | ||
} | ||
|
||
private void Clear(bool isTemp) | ||
{ | ||
if (!isTemp) | ||
{ | ||
return; | ||
} | ||
|
||
try | ||
{ | ||
if (Directory.Exists(Path)) | ||
{ | ||
Directory.Delete(Path, true); | ||
} | ||
} | ||
catch (IOException) | ||
{ | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// An indicator whether this object is being actively disposed or not. | ||
/// </summary> | ||
private bool _disposed; | ||
|
||
public void Dispose() | ||
{ | ||
Dispose(true); | ||
GC.SuppressFinalize(this); | ||
} | ||
|
||
/// <summary> | ||
/// Releases managed resources upon dispose. | ||
/// </summary> | ||
/// <remarks> | ||
/// All managed resources must be released in this | ||
/// method, so after disposing this object no other | ||
/// object is being referenced by it anymore. | ||
/// </remarks> | ||
private void ReleaseManagedResources() | ||
{ | ||
Clear(_isTemp); | ||
} | ||
|
||
/// <summary> | ||
/// Releases unmanaged resources upon dispose. | ||
/// </summary> | ||
/// <remarks> | ||
/// All unmanaged resources must be released in this | ||
/// method, so after disposing this object no other | ||
/// object is beeing referenced by it anymore. | ||
/// </remarks> | ||
private void ReleaseUnmanagedResources() | ||
{ | ||
} | ||
|
||
private void Dispose(bool disposing) | ||
{ | ||
if (!_disposed) | ||
{ | ||
/* Release unmanaged resources */ | ||
ReleaseUnmanagedResources(); | ||
|
||
if (disposing) | ||
{ | ||
/* Release managed resources */ | ||
ReleaseManagedResources(); | ||
} | ||
|
||
/* Set indicator that this object is disposed */ | ||
_disposed = true; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.