-
-
Notifications
You must be signed in to change notification settings - Fork 732
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.17.0' into main
- Loading branch information
Showing
198 changed files
with
11,065 additions
and
584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Common.Build.GitLabCI; | ||
using Cake.Core; | ||
using NSubstitute; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Build | ||
{ | ||
internal sealed class GitLabCIFixture | ||
{ | ||
public ICakeEnvironment Environment { get; set; } | ||
|
||
public GitLabCIFixture() | ||
{ | ||
Environment = Substitute.For<ICakeEnvironment>(); | ||
Environment.GetEnvironmentVariable("CI_SERVER").Returns((string)null); | ||
} | ||
|
||
public void IsRunningOnGitLabCI() | ||
{ | ||
Environment.GetEnvironmentVariable("CI_SERVER").Returns("yes"); | ||
} | ||
|
||
public GitLabCIProvider CreateGitLabCIService() | ||
{ | ||
return new GitLabCIProvider(Environment); | ||
} | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/Cake.Common.Tests/Fixtures/Build/GitLabCIInfoFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Common.Build.GitLabCI.Data; | ||
using Cake.Core; | ||
using NSubstitute; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Build | ||
{ | ||
internal sealed class GitLabCIInfoFixture | ||
{ | ||
public ICakeEnvironment Environment { get; set; } | ||
|
||
public GitLabCIInfoFixture() | ||
{ | ||
Environment = Substitute.For<ICakeEnvironment>(); | ||
|
||
// Example values taken from https://docs.gitlab.com/ce/ci/variables/README.html | ||
Environment.GetEnvironmentVariable("CI_SERVER").Returns("yes"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_ID").Returns("50"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_REF").Returns("1ecfd275763eff1d6b4844ea3168962458c9f27a"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_REF_NAME").Returns("master"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_REPO").Returns("https://gitab-ci-token:abcde-1234ABCD5678ef@gitlab.com/gitlab-org/gitlab-ce.git"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_TAG").Returns("1.0.0"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_NAME").Returns("spec:other"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_STAGE").Returns("test"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_MANUAL").Returns("true"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_TRIGGERED").Returns("true"); | ||
Environment.GetEnvironmentVariable("CI_BUILD_TOKEN").Returns("abcde-1234ABCD5678ef"); | ||
Environment.GetEnvironmentVariable("CI_PIPELINE_ID").Returns("1000"); | ||
Environment.GetEnvironmentVariable("CI_PROJECT_ID").Returns("34"); | ||
Environment.GetEnvironmentVariable("CI_PROJECT_DIR").Returns("/builds/gitlab-org/gitlab-ce"); | ||
Environment.GetEnvironmentVariable("CI_PROJECT_NAME").Returns("gitlab-ce"); | ||
Environment.GetEnvironmentVariable("CI_PROJECT_NAMESPACE").Returns("gitlab-org"); | ||
Environment.GetEnvironmentVariable("CI_PROJECT_PATH").Returns("gitlab-org/gitlab-ce"); | ||
Environment.GetEnvironmentVariable("CI_PROJECT_URL").Returns("https://gitlab.com/gitlab-org/gitlab-ce"); | ||
Environment.GetEnvironmentVariable("CI_REGISTRY").Returns("registry.gitlab.com"); | ||
Environment.GetEnvironmentVariable("CI_REGISTRY_IMAGE").Returns("registry.gitlab.com/gitlab-org/gitlab-ce"); | ||
Environment.GetEnvironmentVariable("CI_RUNNER_ID").Returns("10"); | ||
Environment.GetEnvironmentVariable("CI_RUNNER_DESCRIPTION").Returns("my runner"); | ||
Environment.GetEnvironmentVariable("CI_RUNNER_TAGS").Returns("docker, linux"); | ||
Environment.GetEnvironmentVariable("CI_SERVER").Returns("yes"); | ||
Environment.GetEnvironmentVariable("CI_SERVER_NAME").Returns("GitLab"); | ||
Environment.GetEnvironmentVariable("CI_SERVER_REVISION").Returns("70606bf"); | ||
Environment.GetEnvironmentVariable("CI_SERVER_VERSION").Returns("8.9.0"); | ||
Environment.GetEnvironmentVariable("GITLAB_USER_ID").Returns("42"); | ||
Environment.GetEnvironmentVariable("GITLAB_USER_EMAIL").Returns("anthony@warwickcontrol.com"); | ||
} | ||
|
||
public GitLabCIBuildInfo CreateBuildInfo() | ||
{ | ||
return new GitLabCIBuildInfo(Environment); | ||
} | ||
|
||
public GitLabCIProjectInfo CreateProjectInfo() | ||
{ | ||
return new GitLabCIProjectInfo(Environment); | ||
} | ||
|
||
public GitLabCIRunnerInfo CreateRunnerInfo() | ||
{ | ||
return new GitLabCIRunnerInfo(Environment); | ||
} | ||
|
||
public GitLabCIServerInfo CreateServerInfo() | ||
{ | ||
return new GitLabCIServerInfo(Environment); | ||
} | ||
|
||
public GitLabCIEnvironmentInfo CreateEnvironmentInfo() | ||
{ | ||
return new GitLabCIEnvironmentInfo(Environment); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Common.Build.GoCD; | ||
using Cake.Core; | ||
using Cake.Testing; | ||
using NSubstitute; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Build | ||
{ | ||
internal sealed class GoCDFixture | ||
{ | ||
public ICakeEnvironment Environment { get; set; } | ||
|
||
public FakeLog CakeLog { get; set; } | ||
|
||
public GoCDFixture() | ||
{ | ||
Environment = Substitute.For<ICakeEnvironment>(); | ||
Environment.GetEnvironmentVariable("https://127.0.0.1:8154/go").Returns((string)null); | ||
CakeLog = new FakeLog(); | ||
} | ||
|
||
public void IsRunningOnGoCD() | ||
{ | ||
Environment.GetEnvironmentVariable("GO_SERVER_URL").Returns("https://127.0.0.1:8154/go"); | ||
} | ||
|
||
public GoCDProvider CreateGoCDService() | ||
{ | ||
return new GoCDProvider(Environment, CakeLog); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Common.Build.GoCD.Data; | ||
using Cake.Core; | ||
using NSubstitute; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Build | ||
{ | ||
internal sealed class GoCDInfoFixture | ||
{ | ||
public ICakeEnvironment Environment { get; set; } | ||
|
||
public GoCDInfoFixture() | ||
{ | ||
Environment = Substitute.For<ICakeEnvironment>(); | ||
|
||
// GoCDEnvironmentInfo | ||
Environment.GetEnvironmentVariable("GO_SERVER_URL").Returns("https://127.0.0.1:8154/go"); | ||
Environment.GetEnvironmentVariable("GO_ENVIRONMENT_NAME").Returns("Development"); | ||
Environment.GetEnvironmentVariable("GO_JOB_NAME").Returns("linux-firefox"); | ||
Environment.GetEnvironmentVariable("GO_TRIGGER_USER").Returns("changes"); | ||
|
||
// GoCDPipelineInfo | ||
Environment.GetEnvironmentVariable("GO_PIPELINE_NAME").Returns("main"); | ||
Environment.GetEnvironmentVariable("GO_PIPELINE_COUNTER").Returns("2345"); | ||
Environment.GetEnvironmentVariable("GO_PIPELINE_LABEL").Returns("1.1.2345"); | ||
|
||
// GoCDCommitInfo | ||
Environment.GetEnvironmentVariable("bamboo_planRepository_revision").Returns("d4a3a4cb304548450e3cab2ff735f778ffe58d03"); | ||
|
||
// GoCDRepositoryInfo | ||
Environment.GetEnvironmentVariable("GO_REVISION").Returns("123"); | ||
Environment.GetEnvironmentVariable("GO_TO_REVISION").Returns("124"); | ||
Environment.GetEnvironmentVariable("GO_FROM_REVISION").Returns("122"); | ||
|
||
// GoCDStageInfo | ||
Environment.GetEnvironmentVariable("GO_STAGE_NAME").Returns("dev"); | ||
Environment.GetEnvironmentVariable("GO_STAGE_COUNTER").Returns("1"); | ||
} | ||
|
||
public GoCDEnvironmentInfo CreateEnvironmentInfo() | ||
{ | ||
return new GoCDEnvironmentInfo(Environment); | ||
} | ||
|
||
public GoCDPipelineInfo CreatePipelineInfo() | ||
{ | ||
return new GoCDPipelineInfo(Environment); | ||
} | ||
|
||
public GoCDRepositoryInfo CreateRepositoryInfo() | ||
{ | ||
return new GoCDRepositoryInfo(Environment); | ||
} | ||
|
||
public GoCDStageInfo CreateStageInfo() | ||
{ | ||
return new GoCDStageInfo(Environment); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Cake.Common.Build.TFBuild; | ||
using Cake.Core; | ||
using NSubstitute; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Build | ||
{ | ||
internal sealed class TFBuildFixture | ||
{ | ||
public ICakeEnvironment Environment { get; set; } | ||
|
||
public TFBuildFixture() | ||
{ | ||
Environment = Substitute.For<ICakeEnvironment>(); | ||
Environment.WorkingDirectory.Returns("C:\\build\\CAKE-CAKE-JOB1"); | ||
Environment.GetEnvironmentVariable("TF_BUILD").Returns((string)null); | ||
} | ||
|
||
public void IsRunningOnVSTS() | ||
{ | ||
Environment.GetEnvironmentVariable("TF_BUILD").Returns("True"); | ||
Environment.GetEnvironmentVariable("AGENT_NAME").Returns("Hosted Agent"); | ||
} | ||
|
||
public void IsRunningOnTFS() | ||
{ | ||
Environment.GetEnvironmentVariable("TF_BUILD").Returns("True"); | ||
Environment.GetEnvironmentVariable("AGENT_NAME").Returns("On Premises"); | ||
} | ||
|
||
public TFBuildProvider CreateTFBuildService() | ||
{ | ||
return new TFBuildProvider(Environment); | ||
} | ||
} | ||
} |
Oops, something went wrong.