Skip to content

GH-2255 - implemented Commandline and Portable validation #2264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .azurepipelines/artifacts-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,23 @@ jobs:
includeArtifacts: true
- pwsh: ./build.ps1 -target Artifacts-MsBuildFull-Test
displayName: '[MsBuild Test Artifacts]'
- job: Artifacts_Test_Commandline
displayName: Artifacts Test Commandline (Windows)
pool:
vmImage: windows-latest
steps:
- template: common-steps.yml
parameters:
includeArtifacts: true
- pwsh: ./build.ps1 -target Artifacts-Commandline-Test
displayName: '[Commandline Test Artifacts]'
- job: Artifacts_Test_Portable
displayName: Artifacts Test Portable (Windows)
pool:
vmImage: windows-latest
steps:
- template: common-steps.yml
parameters:
includeArtifacts: true
- pwsh: ./build.ps1 -target Artifacts-Portable-Test
displayName: '[Portable Test Artifacts]'
62 changes: 61 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,69 @@ jobs:
shell: pwsh
run: ./build.ps1 -target Artifacts-MsBuildFull-Test

artifact_commandline_test:
name: Artifacts Commandline Test
needs: [build, test]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Fetch all history for all tags and branches
run: |
git fetch --prune --unshallow
- name: Cache tools
id: cache-tools
uses: actions/cache@v1
with:
path: tools
key: v1-${{ runner.os }}-tools-${{ hashFiles('build.cake') }}
- name: Cache dotnet
id: cache-dotnet
uses: actions/cache@v1
with:
path: .dotnet
key: v1-${{ runner.os }}-dotnet-${{ hashFiles('build.config') }}
- uses: actions/download-artifact@v1
name: Download artifacts folder
with:
name: storage
path: ${{ github.workspace }}/artifacts
- name: '[Commandline Test Artifacts]'
shell: pwsh
run: ./build.ps1 -target Artifacts-Commandline-Test

artifact_portable_test:
name: Artifacts Portable Test
needs: [build, test]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Fetch all history for all tags and branches
run: |
git fetch --prune --unshallow
- name: Cache tools
id: cache-tools
uses: actions/cache@v1
with:
path: tools
key: v1-${{ runner.os }}-tools-${{ hashFiles('build.cake') }}
- name: Cache dotnet
id: cache-dotnet
uses: actions/cache@v1
with:
path: .dotnet
key: v1-${{ runner.os }}-dotnet-${{ hashFiles('build.config') }}
- uses: actions/download-artifact@v1
name: Download artifacts folder
with:
name: storage
path: ${{ github.workspace }}/artifacts
- name: '[Portable Test Artifacts]'
shell: pwsh
run: ./build.ps1 -target Artifacts-Portable-Test

docker:
name: Docker
needs: [artifact_test, artifact_msbuild_test]
needs: [artifact_test, artifact_msbuild_test, artifact_commandline_test, artifact_portable_test]
runs-on: ubuntu-latest
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand Down
48 changes: 48 additions & 0 deletions build/artifacts-test.cake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,54 @@ Task("Artifacts-DotnetTool-Test")
}
});

Task("Artifacts-Commandline-Test")
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Artifacts-Commandline-Test can be tested only on Windows agents.")
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-Commandline-Test works only on Releasing CI.")
.IsDependentOnWhen("Pack-Nuget", singleStageRun)
.Does<BuildParameters>((parameters) =>
{
NuGetInstall("GitVersion.Commandline", new NuGetInstallSettings {
Source = new string[] { MakeAbsolute(parameters.Paths.Directories.NugetRoot).FullPath },
ExcludeVersion = true,
Prerelease = true,
OutputDirectory = parameters.Paths.Directories.ArtifactsRoot
});

var settings = new GitVersionSettings
{
OutputType = GitVersionOutput.Json,
ToolPath = parameters.Paths.Directories.ArtifactsRoot.Combine("GitVersion.Commandline/tools").CombineWithFilePath("gitversion.exe").FullPath
};
var gitVersion = GitVersion(settings);

Assert.Equal(parameters.Version.GitVersion.FullSemVer, gitVersion.FullSemVer);
});

Task("Artifacts-Portable-Test")
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Artifacts-Portable-Test can be tested only on Windows agents.")
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-Portable-Test works only on Releasing CI.")
.IsDependentOnWhen("Pack-Chocolatey", singleStageRun)
.Does<BuildParameters>((parameters) =>
{
if (parameters.IsMainBranch && !parameters.IsPullRequest) {
NuGetInstall("GitVersion.Portable", new NuGetInstallSettings {
Source = new string[] { MakeAbsolute(parameters.Paths.Directories.NugetRoot).FullPath },
ExcludeVersion = true,
Prerelease = true,
OutputDirectory = parameters.Paths.Directories.ArtifactsRoot
});

var settings = new GitVersionSettings
{
OutputType = GitVersionOutput.Json,
ToolPath = parameters.Paths.Directories.ArtifactsRoot.Combine("GitVersion.Portable/tools").CombineWithFilePath("gitversion.exe").FullPath
};
var gitVersion = GitVersion(settings);

Assert.Equal(parameters.Version.GitVersion.FullSemVer, gitVersion.FullSemVer);
}
});

Task("Artifacts-Native-Test")
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnLinux, "Artifacts-Native-Test can be tested only on Linux agents.")
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-Native-Test works only on Releasing CI.")
Expand Down