Skip to content

Commit

Permalink
Merge pull request #8 from codez-one/paule96/add_set_proxy_configuration
Browse files Browse the repository at this point in the history
add set proxy configuration
  • Loading branch information
paule96 authored Oct 19, 2021
2 parents 52a7d4c + 417b677 commit c95edcc
Show file tree
Hide file tree
Showing 9 changed files with 1,788 additions and 59 deletions.
4 changes: 3 additions & 1 deletion CZ.PowerShell.NetworkTools.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
// for well formatted documentation
"docsmsft.docs-authoring-pack",
// for good language
"streetsidesoftware.code-spell-checker"
"streetsidesoftware.code-spell-checker",
// for pester tests
"pspester.pester-test"
]
}
}
166 changes: 114 additions & 52 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,117 @@
trigger:
- main

pool:
vmImage: windows-latest

steps:
- task: PowerShell@2
displayName: "Run pester tests"
inputs:
targetType: 'inline'
script: |
Install-Module -Scope CurrentUser -Force -AllowClobber -SkipPublisherCheck Pester;
Import-Module Pester;
$configuration = [PesterConfiguration]::Default;
$configuration.CodeCoverage.Enabled = $true;
$configuration.CodeCoverage.Path = (Get-ChildItem src/*.ps1 | ForEach-Object{$_.FullName});
$configuration.CodeCoverage.OutputFormat = "JaCoCo";
$configuration.TestResult.Enabled = $true;
$configuration.Run.Exit = $true;
$configuration.Run.Path = (Get-ChildItem tests/*ps1 | ForEach-Object{$_.FullName});
Invoke-Pester -Configuration $configuration;
showWarnings: true
pwsh: true
- task: PowerShell@2
displayName: "Build the powershell package"
inputs:
filePath: 'build/build.ps1'
showWarnings: true
pwsh: true
- task: PowerShell@2
displayName: "Debug files"
inputs:
targetType: 'inline'
script: |
ls -Recurse | select FullName;
showWarnings: true
pwsh: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'src/bin/'
ArtifactName: 'drop'
publishLocation: 'Container'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: 'testResults.xml'
failTaskOnFailedTests: true
testRunTitle: 'CZ.PowerShell.NetworkTools'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: 'coverage.xml'
pathToSources: 'src/'
failIfCoverageEmpty: true
jobs:
- job: 'tests'
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)
steps:
- task: PowerShell@2
displayName: "Run pester tests"
inputs:
targetType: 'inline'
script: |
Install-Module -Scope CurrentUser -Force -AllowClobber -SkipPublisherCheck Pester;
Import-Module Pester;
$configuration = [PesterConfiguration]::Default;
$configuration.CodeCoverage.Enabled = $true;
$configuration.CodeCoverage.Path = (Get-ChildItem src/*.ps1 | ForEach-Object{$_.FullName});
$configuration.CodeCoverage.OutputFormat = "JaCoCo";
$configuration.CodeCoverage.OutputPath = '$(imageName)-coverage.xml'
$configuration.TestResult.Enabled = $true;
$configuration.TestResult.OutputPath = '$(imageName)-testResults.xml'
$configuration.Run.Exit = $true;
$configuration.Run.Path = (Get-ChildItem tests/*ps1 | ForEach-Object{$_.FullName});
Invoke-Pester -Configuration $configuration;
showWarnings: true
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Coverage'
condition: always()
inputs:
PathtoPublish: '$(imageName)-coverage.xml'
ArtifactName: 'coverage'
publishLocation: Container
- task: PublishBuildArtifacts@1
displayName: 'Publish Tests'
condition: always()
inputs:
PathtoPublish: '$(imageName)-testResults.xml'
ArtifactName: 'tests'
publishLocation: Container
- job: 'build_package'
pool:
vmImage: windows-latest
dependsOn:
- 'tests'
steps:
- task: PowerShell@2
displayName: "Build the powershell package"
inputs:
filePath: 'build/build.ps1'
showWarnings: true
pwsh: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'src/bin/'
ArtifactName: 'drop'
publishLocation: 'Container'
- job: 'publish_coverage_and_tests'
pool:
vmImage: windows-latest
dependsOn:
- 'tests'
steps:
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Coverage Windows Artifacts'
# inputs:
# artifactName: windows-coverage
# downloadPath: $(System.DefaultWorkingDirectory)/
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Coverage Linux Artifacts'
# inputs:
# artifactName: linux-coverage
# downloadPath: $(System.DefaultWorkingDirectory)/
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Tests Windows Artifacts'
# inputs:
# artifactName: windows-tests
# downloadPath: $(System.DefaultWorkingDirectory)/
# - task: DownloadBuildArtifacts@0
# displayName: 'Download Tests Linux Artifacts'
# inputs:
# artifactName: linux-tests
# downloadPath: $(System.DefaultWorkingDirectory)/
- task: DownloadBuildArtifacts@1
displayName: 'Download All Tests Artifacts'
inputs:
artifactName: 'tests'
downloadPath: $(System.DefaultWorkingDirectory)/
- task: DownloadBuildArtifacts@1
displayName: 'Download All Coverage Artifacts'
inputs:
artifactName: 'coverage'
downloadPath: $(System.DefaultWorkingDirectory)/
- task: PublishCodeCoverageResults@1
condition: always()
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/*coverage.xml'
pathToSources: 'src/'
failIfCoverageEmpty: true
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '$(System.DefaultWorkingDirectory)/tests/*testResults.xml'
failTaskOnFailedTests: true
testRunTitle: 'CZ.PowerShell.NetworkTools'
mergeTestResults: true
24 changes: 24 additions & 0 deletions devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.trimTrailingWhitespace": true,
"cSpell.words": [
"cmdlet",
"paule"
]
},
"extensions": {
// for the powershell scripts
"ms-vscode.powershell",
// for the jupiter notebook integration for powershell
"ms-dotnettools.dotnet-interactive-vscode",
// for good language in the docs
"streetsidesoftware.code-spell-checker",
// for well formatted documentation
"docsmsft.docs-authoring-pack"
}
}
4 changes: 4 additions & 0 deletions samples/basic.noproxy.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"ProxyAddress": null,
"BypassList": []
}
6 changes: 6 additions & 0 deletions samples/basic.proxy.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ProxyAddress": "http://proxy.codez.one:80",
"BypassList": [
"git.codez.one"
]
}
3 changes: 3 additions & 0 deletions samples/basic.systemproxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"UseSystemProxyAddress": true
}
Loading

0 comments on commit c95edcc

Please sign in to comment.