Exemplo n.º 1
0
        private IEnumerable <GitHubActionsStep> GetSteps(GitHubActionsImage image, IReadOnlyCollection <ExecutableTarget> relevantTargets)
        {
            yield return(new GitHubActionsUsingStep
            {
                Using = "actions/checkout@v1"
            });

            yield return(new GitHubActionsRunStep
            {
                Command = $"./{BuildCmdPath} {InvokedTargets.JoinSpace()}",
                Imports = GetImports().ToDictionary(x => x.key, x => x.value)
            });

            var artifacts = relevantTargets
                            .SelectMany(x => ArtifactExtensions.ArtifactProducts[x.Definition])
                            .Select(x => (AbsolutePath)x)
                            // TODO: https://github.com/actions/upload-artifact/issues/11
                            .Select(x => x.DescendantsAndSelf(y => y.Parent).FirstOrDefault(y => !y.ToString().ContainsOrdinalIgnoreCase("*")))
                            .Distinct().ToList();

            foreach (var artifact in artifacts)
            {
                yield return(new GitHubActionsArtifactStep
                {
                    Name = artifact.ToString().TrimStart(artifact.Parent.ToString()).TrimStart('/', '\\'),
                    Path = NukeBuild.RootDirectory.GetUnixRelativePathTo(artifact)
                });
            }
        }
Exemplo n.º 2
0
 public GitHubActionsAttribute(
     string name,
     GitHubActionsImage image,
     params GitHubActionsImage[] images)
 {
     _name   = name;
     _images = new[] { image }.Concat(images).ToArray();
 }
Exemplo n.º 3
0
 public GitHubActionsAttribute(
     string name,
     GitHubActionsImage image,
     params GitHubActionsImage[] images)
 {
     _name   = name.Replace(oldChar: ' ', newChar: '_');
     _images = new[] { image }.Concat(images).ToArray();
 }
Exemplo n.º 4
0
 protected virtual GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyCollection <ExecutableTarget> relevantTargets)
 {
     return(new GitHubActionsJob
     {
         Name = image.GetValue().Replace(".", "_"),
         Steps = GetSteps(image, relevantTargets).ToArray(),
         Image = image
     });
 }
Exemplo n.º 5
0
    protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyCollection <ExecutableTarget> relevantTargets)
    {
        var job = base.GetJobs(image, relevantTargets);

        var newSteps = new List <GitHubActionsStep>(job.Steps);

        foreach (var version in new[] { "6.0.*", "5.0.*", "3.1.*", "2.1.*" })
        {
            newSteps.Insert(1, new GitHubActionsSetupDotNetStep
            {
                Version = version
            });
        }

        job.Steps = newSteps.ToArray();
        return(job);
    }
Exemplo n.º 6
0
 public CustomGitHubActionsAttribute(string name, GitHubActionsImage image, params GitHubActionsImage[] images) : base(name, image, images)
 {
 }
Exemplo n.º 7
0
 public TestGitHubActionsAttribute(GitHubActionsImage image, params GitHubActionsImage[] images)
     : base("test", image, images)
 {
 }