File tree 15 files changed +93
-21
lines changed
tests/pipeline-validation
src/Microsoft.DotNet.ImageBuilder
15 files changed +93
-21
lines changed Original file line number Diff line number Diff line change 13
13
14
14
# ImageBuilder directory
15
15
.Microsoft.DotNet.ImageBuilder
16
+
17
+ # dotnet install directory
18
+ .dotnet /
19
+
20
+ # Test files
21
+ * .trx
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env pwsh
2
+ #
3
+ # Copyright (c) .NET Foundation and contributors. All rights reserved.
4
+ # Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ #
6
+
7
+ <#
8
+ . SYNOPSIS
9
+ Install the .NET Core SDK at the specified path.
10
+
11
+ . PARAMETER InstallPath
12
+ The path where the .NET Core SDK is to be installed.
13
+
14
+ #>
15
+ [cmdletbinding ()]
16
+ param (
17
+ [string ]
18
+ $InstallPath
19
+ )
20
+
21
+ Set-StrictMode - Version Latest
22
+ $ErrorActionPreference = ' Stop'
23
+
24
+ if (! (Test-Path " $InstallPath " )) {
25
+ mkdir " $InstallPath " | Out-Null
26
+ }
27
+
28
+ $IsRunningOnUnix = $PSVersionTable.contains (" Platform" ) -and $PSVersionTable.Platform -eq " Unix"
29
+ if ($IsRunningOnUnix ) {
30
+ $DotnetInstallScript = " dotnet-install.sh"
31
+ }
32
+ else {
33
+ $DotnetInstallScript = " dotnet-install.ps1"
34
+ }
35
+
36
+ if (! (Test-Path $DotnetInstallScript )) {
37
+ Invoke-WebRequest " https://dot.net/v1/$DotnetInstallScript " - OutFile $InstallPath / $DotnetInstallScript
38
+ }
39
+
40
+ if ($IsRunningOnUnix ) {
41
+ & chmod + x $InstallPath / $DotnetInstallScript
42
+ & $InstallPath / $DotnetInstallScript -- channel " 3.1" -- version " latest" -- install-dir $InstallPath
43
+ }
44
+ else {
45
+ & $InstallPath / $DotnetInstallScript - Channel " 3.1" - Version " latest" - InstallDir $InstallPath
46
+ }
47
+
48
+ if ($LASTEXITCODE -ne 0 ) { throw " Failed to install the .NET Core SDK" }
Original file line number Diff line number Diff line change 39
39
continueOnError : true
40
40
inputs :
41
41
testRunner : vSTest
42
- testResultsFiles : ' tests /**/*.trx'
42
+ testResultsFiles : ' $(testResultsDirectory) /**/*.trx'
43
43
mergeTestResults : true
44
44
publishRunAttachments : true
45
45
testRunTitle : $(dotnetVersion) $(osVariant) amd64
Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ trigger:
18
18
variables :
19
19
- template : ../common/templates/variables/common.yml
20
20
- name : manifest
21
- value : test /pipeline-validation/test-manifest.json
21
+ value : eng/tests /pipeline-validation/test-manifest.json
22
22
- name : testScriptPath
23
- value : ./test /pipeline-validation/run-tests.ps1
23
+ value : ./eng/tests /pipeline-validation/run-tests.ps1
24
24
- name : testResultsDirectory
25
- value : test /pipeline-validation/TestResults/
25
+ value : eng/tests /pipeline-validation/TestResults/
26
26
- name : publicGitRepoUri
27
27
value : https://github.com/dotnet/dotnet-docker-test
28
28
- name : publishRepoPrefix
Original file line number Diff line number Diff line change @@ -8,3 +8,7 @@ variables:
8
8
value : --var UniqueId=$(sourceBuildId)
9
9
- name : imageInfoVariant
10
10
value : " -imagebuilder"
11
+ - name : testScriptPath
12
+ value : ./src/Microsoft.DotNet.ImageBuilder/run-tests.ps1
13
+ - name : testResultsDirectory
14
+ value : src/Microsoft.DotNet.ImageBuilder/tests/TestResults/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -12,16 +12,12 @@ ARG RID_ARCH=x64
12
12
WORKDIR /image-builder
13
13
14
14
# restore packages before copying entire source - provides optimizations when rebuilding
15
- COPY Microsoft.DotNet.ImageBuilder.sln ./
16
15
COPY NuGet.config ./
17
16
COPY src/Microsoft.DotNet.ImageBuilder.csproj ./src/
18
- COPY tests/Microsoft.DotNet.ImageBuilder.Tests.csproj ./tests/
19
- RUN dotnet restore Microsoft.DotNet.ImageBuilder.sln
17
+ RUN dotnet restore ./src/Microsoft.DotNet.ImageBuilder.csproj
20
18
21
- # copy everything else and build
19
+ # copy everything else and publish
22
20
COPY . ./
23
- RUN dotnet build Microsoft.DotNet.ImageBuilder.sln
24
- RUN dotnet test tests/Microsoft.DotNet.ImageBuilder.Tests.csproj
25
21
RUN dotnet publish ./src/Microsoft.DotNet.ImageBuilder.csproj -c Release -o out -r linux-musl-$RID_ARCH /p:ShowLinkerSizeComparison=true
26
22
27
23
Original file line number Diff line number Diff line change @@ -3,21 +3,12 @@ FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
3
3
WORKDIR /image-builder
4
4
5
5
# restore packages before copying entire source - provides optimizations when rebuilding
6
- COPY Microsoft.DotNet.ImageBuilder.sln ./
7
6
COPY NuGet.config ./
8
7
COPY src/Microsoft.DotNet.ImageBuilder.csproj ./src/
9
- COPY tests/Microsoft.DotNet.ImageBuilder.Tests.csproj ./tests/
10
- RUN dotnet restore Microsoft.DotNet.ImageBuilder.sln
8
+ RUN dotnet restore ./src/Microsoft.DotNet.ImageBuilder.csproj
11
9
12
- # copy everything else and build
10
+ # copy everything else and publish
13
11
COPY . ./
14
- RUN dotnet build Microsoft.DotNet.ImageBuilder.sln
15
-
16
- # Workaround: Tests rely on Path.GetTempPath which isn't compatible with the default ContainerUser.
17
- USER ContainerAdministrator
18
- RUN dotnet test tests/Microsoft.DotNet.ImageBuilder.Tests.csproj
19
- USER ContainerUser
20
-
21
12
RUN dotnet publish ./src/Microsoft.DotNet.ImageBuilder.csproj -c Release -o out -r win7-x64
22
13
23
14
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env pwsh
2
+ #
3
+ # Copyright (c) .NET Foundation and contributors. All rights reserved.
4
+ # Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ #
6
+
7
+ Set-StrictMode - Version Latest
8
+ $ErrorActionPreference = ' Stop'
9
+
10
+ $dotnetInstallDir = " $PSScriptRoot /../../.dotnet"
11
+
12
+ Push-Location $PSScriptRoot
13
+
14
+ try {
15
+ & ../ ../ eng/ common/ Install-DotNetSdk.ps1 $dotnetInstallDir
16
+
17
+ $cmd = " $DotnetInstallDir /dotnet test --logger:trx"
18
+
19
+ Write-Output " Executing '$cmd '"
20
+ Invoke-Expression $cmd
21
+ if ($LASTEXITCODE -ne 0 ) {
22
+ throw " Failed: '$cmd '"
23
+ }
24
+ }
25
+ finally {
26
+ Pop-Location
27
+ }
You can’t perform that action at this time.
0 commit comments