Skip to content

Commit b4739a4

Browse files
committed
GH-2255 - implemented Commandline and Portable validation
1 parent d0a1bea commit b4739a4

File tree

3 files changed

+129
-1
lines changed

3 files changed

+129
-1
lines changed

.azurepipelines/artifacts-test.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,23 @@ jobs:
2828
includeArtifacts: true
2929
- pwsh: ./build.ps1 -target Artifacts-MsBuildFull-Test
3030
displayName: '[MsBuild Test Artifacts]'
31+
- job: Artifacts_Test_Commandline
32+
displayName: Artifacts Test Commandline (Windows)
33+
pool:
34+
vmImage: windows-latest
35+
steps:
36+
- template: common-steps.yml
37+
parameters:
38+
includeArtifacts: true
39+
- pwsh: ./build.ps1 -target Artifacts-Commandline-Test
40+
displayName: '[Commandline Test Artifacts]'
41+
- job: Artifacts_Test_Portable
42+
displayName: Artifacts Test Portable (Windows)
43+
pool:
44+
vmImage: windows-latest
45+
steps:
46+
- template: common-steps.yml
47+
parameters:
48+
includeArtifacts: true
49+
- pwsh: ./build.ps1 -target Artifacts-Portable-Test
50+
displayName: '[Portable Test Artifacts]'

.github/workflows/build.yml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,69 @@ jobs:
163163
shell: pwsh
164164
run: ./build.ps1 -target Artifacts-MsBuildFull-Test
165165

166+
artifact_commandline_test:
167+
name: Artifacts Commandline Test
168+
needs: [build, test]
169+
runs-on: windows-latest
170+
steps:
171+
- uses: actions/checkout@v2
172+
- name: Fetch all history for all tags and branches
173+
run: |
174+
git fetch --prune --unshallow
175+
- name: Cache tools
176+
id: cache-tools
177+
uses: actions/cache@v1
178+
with:
179+
path: tools
180+
key: v1-${{ runner.os }}-tools-${{ hashFiles('build.cake') }}
181+
- name: Cache dotnet
182+
id: cache-dotnet
183+
uses: actions/cache@v1
184+
with:
185+
path: .dotnet
186+
key: v1-${{ runner.os }}-dotnet-${{ hashFiles('build.config') }}
187+
- uses: actions/download-artifact@v1
188+
name: Download artifacts folder
189+
with:
190+
name: storage
191+
path: ${{ github.workspace }}/artifacts
192+
- name: '[Commandline Test Artifacts]'
193+
shell: pwsh
194+
run: ./build.ps1 -target Artifacts-Commandline-Test
195+
196+
artifact_portable_test:
197+
name: Artifacts Portable Test
198+
needs: [build, test]
199+
runs-on: windows-latest
200+
steps:
201+
- uses: actions/checkout@v2
202+
- name: Fetch all history for all tags and branches
203+
run: |
204+
git fetch --prune --unshallow
205+
- name: Cache tools
206+
id: cache-tools
207+
uses: actions/cache@v1
208+
with:
209+
path: tools
210+
key: v1-${{ runner.os }}-tools-${{ hashFiles('build.cake') }}
211+
- name: Cache dotnet
212+
id: cache-dotnet
213+
uses: actions/cache@v1
214+
with:
215+
path: .dotnet
216+
key: v1-${{ runner.os }}-dotnet-${{ hashFiles('build.config') }}
217+
- uses: actions/download-artifact@v1
218+
name: Download artifacts folder
219+
with:
220+
name: storage
221+
path: ${{ github.workspace }}/artifacts
222+
- name: '[Portable Test Artifacts]'
223+
shell: pwsh
224+
run: ./build.ps1 -target Artifacts-Portable-Test
225+
166226
docker:
167227
name: Docker
168-
needs: [artifact_test, artifact_msbuild_test]
228+
needs: [artifact_test, artifact_msbuild_test, artifact_commandline_test, artifact_portable_test]
169229
runs-on: ubuntu-latest
170230
env:
171231
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

build/artifacts-test.cake

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,54 @@ Task("Artifacts-DotnetTool-Test")
2929
}
3030
});
3131

32+
Task("Artifacts-Commandline-Test")
33+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Artifacts-Commandline-Test can be tested only on Windows agents.")
34+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-Commandline-Test works only on Releasing CI.")
35+
.IsDependentOnWhen("Pack-Nuget", singleStageRun)
36+
.Does<BuildParameters>((parameters) =>
37+
{
38+
NuGetInstall("GitVersion.Commandline", new NuGetInstallSettings {
39+
Source = new string[] { MakeAbsolute(parameters.Paths.Directories.NugetRoot).FullPath },
40+
ExcludeVersion = true,
41+
Prerelease = true,
42+
OutputDirectory = parameters.Paths.Directories.ArtifactsRoot
43+
});
44+
45+
var settings = new GitVersionSettings
46+
{
47+
OutputType = GitVersionOutput.Json,
48+
ToolPath = parameters.Paths.Directories.ArtifactsRoot.Combine("GitVersion.Commandline/tools").CombineWithFilePath("gitversion.exe").FullPath
49+
};
50+
var gitVersion = GitVersion(settings);
51+
52+
Assert.Equal(parameters.Version.GitVersion.FullSemVer, gitVersion.FullSemVer);
53+
});
54+
55+
Task("Artifacts-Portable-Test")
56+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Artifacts-Portable-Test can be tested only on Windows agents.")
57+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-Portable-Test works only on Releasing CI.")
58+
.IsDependentOnWhen("Pack-Chocolatey", singleStageRun)
59+
.Does<BuildParameters>((parameters) =>
60+
{
61+
if (parameters.IsMainBranch && !parameters.IsPullRequest) {
62+
NuGetInstall("GitVersion.Portable", new NuGetInstallSettings {
63+
Source = new string[] { MakeAbsolute(parameters.Paths.Directories.NugetRoot).FullPath },
64+
ExcludeVersion = true,
65+
Prerelease = true,
66+
OutputDirectory = parameters.Paths.Directories.ArtifactsRoot
67+
});
68+
69+
var settings = new GitVersionSettings
70+
{
71+
OutputType = GitVersionOutput.Json,
72+
ToolPath = parameters.Paths.Directories.ArtifactsRoot.Combine("GitVersion.Portable/tools").CombineWithFilePath("gitversion.exe").FullPath
73+
};
74+
var gitVersion = GitVersion(settings);
75+
76+
Assert.Equal(parameters.Version.GitVersion.FullSemVer, gitVersion.FullSemVer);
77+
}
78+
});
79+
3280
Task("Artifacts-Native-Test")
3381
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnLinux, "Artifacts-Native-Test can be tested only on Linux agents.")
3482
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-Native-Test works only on Releasing CI.")

0 commit comments

Comments
 (0)