Skip to content

Commit

Permalink
[skip ci] Docker tests (#9)
Browse files Browse the repository at this point in the history
Added Docker testing in Ubuntu 16.04 container as part of the CI suite
  • Loading branch information
scrthq authored Aug 25, 2019
2 parents eee1fba + 680a1ac commit 46b95c9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ FROM base as src
LABEL maintainer="nferrell"
LABEL description="PSProfile container for Ubuntu 16.04"
LABEL vendor="scrthq"
COPY [".", "/tmp/PSProfile/"]
WORKDIR /tmp/PSProfile
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $VerbosePreference = 'Continue'; $ProgressPreference = 'SilentlyContinue';"]
COPY [".", "/PSProfile/"]
WORKDIR /PSProfile
ENTRYPOINT [ "pwsh", "-command", ". ./build.ps1 -Task Build,Test" ]
2 changes: 1 addition & 1 deletion PSProfile/PSProfile.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSProfile.psm1'

# Version number of this module.
ModuleVersion = '0.1.7'
ModuleVersion = '0.1.8'

# Supported PSEditions
CompatiblePSEditions = @('Desktop','Core')
Expand Down
30 changes: 30 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,43 @@ phases:
testResultsFiles: '**/Test*.xml'
condition: succeededOrFailed()


- phase: Phase_6
displayName: Test Docker
dependsOn: Phase_1
condition: succeeded()
queue:
name: Hosted Ubuntu 1604

steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: BuildOutput
downloadPath: '$(Build.SourcesDirectory)'

- powershell: |
docker build . -t psprofile-img -f ./Dockerfile
docker run --name psprofile psprofile-img:latest
docker cp psprofile:/PSProfile/BuildOutput/TestResults.xml BuildOutput/TestResults_Docker.xml
docker rm psprofile
displayName: Test Module in Container
- task: PublishTestResults@2
displayName: 'Publish Test Results **/Test*.xml'
inputs:
testRunner: NUnit
testResultsFiles: '**/Test*.xml'
condition: succeededOrFailed()

- phase: Phase_7
displayName: Deploy Module
dependsOn:
- Phase_2
- Phase_3
- Phase_4
- Phase_5
- Phase_6
condition: and(succeeded(), in(variables['Build.Reason'], 'Manual', 'IndividualCI', 'BatchedCI'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
queue:
name: Hosted VS2017
Expand Down
2 changes: 1 addition & 1 deletion tasks.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ task Test Init,{
Import-Module -Name $TargetModuleDirectory -Force -Verbose:$false
$pesterParams = @{
OutputFormat = 'NUnitXml'
OutputFile = Join-Path $TargetDirectory "TestResults_PS$PSVersion`_$TimeStamp.xml"
OutputFile = Join-Path $TargetDirectory "TestResults.xml"
PassThru = $true
Path = Join-Path $BuildRoot "Tests"
}
Expand Down

0 comments on commit 46b95c9

Please sign in to comment.