Ejemplo 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)
                });
            }
        }
Ejemplo n.º 2
0
 public GitHubActionsAttribute(
     string name,
     GitHubActionsImage image,
     params GitHubActionsImage[] images)
 {
     _name   = name;
     _images = new[] { image }.Concat(images).ToArray();
 }
Ejemplo n.º 3
0
 public GitHubActionsAttribute(
     string name,
     GitHubActionsImage image,
     params GitHubActionsImage[] images)
 {
     _name   = name.Replace(oldChar: ' ', newChar: '_');
     _images = new[] { image }.Concat(images).ToArray();
 }
Ejemplo 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
     });
 }
Ejemplo 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);
    }
Ejemplo n.º 6
0
 public CustomGitHubActionsAttribute(string name, GitHubActionsImage image, params GitHubActionsImage[] images) : base(name, image, images)
 {
 }
Ejemplo n.º 7
0
 public TestGitHubActionsAttribute(GitHubActionsImage image, params GitHubActionsImage[] images)
     : base("test", image, images)
 {
 }