Automatron 0.0.0-alpha.0.187
See the version list below for details.
Requires NuGet 5.9 or higher.
dotnet add package Automatron --version 0.0.0-alpha.0.187
NuGet\Install-Package Automatron -Version 0.0.0-alpha.0.187
<PackageReference Include="Automatron" Version="0.0.0-alpha.0.187" />
paket add Automatron --version 0.0.0-alpha.0.187
#r "nuget: Automatron, 0.0.0-alpha.0.187"
// Install Automatron as a Cake Addin
#addin nuget:?package=Automatron&version=0.0.0-alpha.0.187&prerelease
// Install Automatron as a Cake Tool
#tool nuget:?package=Automatron&version=0.0.0-alpha.0.187&prerelease
Automatron
The Automatron .NET library is a task automation system that enables you to write you build and deployment workflows in the same language as your .Net applications
Platform support: .NET 6.0 and later.
Quick start
- Create a .NET console app named
Sample.Pipeline
and add a reference to Automatron. - Rename
Program.cs
toPipeline.cs
and replace the contents with:
using Automatron.Annotations;
using CommandDotNet;
namespace Sample.Pipeline;
public class Pipeline
{
private readonly IConsole _console;
public Pipeline(IConsole console)
{
_console = console;
}
private static async Task<int> Main(string[] args)
{
return await new TaskRunner<Pipeline>().RunAsync(args);
}
public async Task Default()
{
await _console.Out.WriteLineAsync("Hello, world!");
}
}
- Run the app. E.g.
dotnet run
or F5 in Visual Studio:
Tasks
Tasks are defined as void/async methods.
Inheritance and interfaces are supported
public class Pipeline
{
private readonly IConsole _console;
public Pipeline(IConsole console)
{
_console = console;
}
private static async Task<int> Main(string[] args)
{
return await new TaskRunner<Pipeline>().RunAsync(args);
}
public async Task Default()
{
await _console.Out.WriteLineAsync("Hello, world!");
}
public void Build()
{
_console.Out.WriteLine("Building");
}
public async Task Test()
{
await _console.Out.WriteLineAsync("Testing");
}
}
Tasks can be run via cmd arguments dotnet run -- Build
Dependencies
Dependencies are expression via the attributes
- DependentOn
- DependentFor
public class Pipeline
{
private readonly IConsole _console;
public Pipeline(IConsole console)
{
_console = console;
}
private static async Task<int> Main(string[] args)
{
return await new TaskRunner<Pipeline>().RunAsync(args);
}
public async Task Default()
{
await _console.Out.WriteLineAsync("Hello, world!");
}
public void Build()
{
_console.Out.WriteLine("Building");
}
[DependentOn(nameof(Build))]
public async Task Test()
{
await _console.Out.WriteLineAsync("Testing");
}
}
AzureDevOps
Automatron can be used for gennerating the yaml pipeline for AzureDevOps.
Pipelines are expression via the attributes in the addon library Automatron.AzureDevOps.
The project needs to be in git repository to able to compute paths correctly or have the RootPath property set
[Pipeline]
[CiTrigger(Batch = true, IncludeBranches = new[] { "main" }, IncludePaths = new[] { "src" })]
[Pool(VmImage = "ubuntu-latest")]
public class Pipeline
{
private readonly IConsole _console;
public Pipeline(IConsole console)
{
_console = console;
}
private static async Task<int> Main(string[] args)
{
return await new TaskRunner<Pipeline>().RunAsync(args);
}
[Stage]
[Job]
public void Ci() { }
[AutomatronTask(nameof(Ci), SkipDependencies = true)]
[DependentFor(nameof(Ci))]
[DependentOn(nameof(Version))]
public void Build()
{
_console.Out.WriteLine("Building");
}
[AutomatronTask(nameof(Ci), SkipDependencies = true)]
[DependentFor(nameof(Ci))]
[DependentOn(nameof(Build))]
public async Task Test()
{
await _console.Out.WriteLineAsync("Testing");
}
}
By reference the Automatron.AzureDevOps library and using the attributes on the class should result in a gennerated azure-pipelines.yml that is added to the project.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Bullseye (>= 4.0.0)
- CommandDotNet (>= 6.0.5)
- CommandDotNet.IoC.MicrosoftDependencyInjection (>= 4.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Automatron:
Package | Downloads |
---|---|
Automatron.AzureDevOps
The Automatron.AzureDevOps .NET library enables you to write AzureDevOps workflows as .Net methods |
|
Automatron.Tasks
The Automatron.Tasks .NET library is a task automation system that enables you to write task based workflows as .Net methods |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.0-alpha-11 | 111 | 6/2/2023 |
0.0.0-alpha.10 | 106 | 1/6/2023 |
0.0.0-alpha.9 | 90 | 1/2/2023 |
0.0.0-alpha.8 | 92 | 11/23/2022 |
0.0.0-alpha.7 | 83 | 11/21/2022 |
0.0.0-alpha.6 | 87 | 11/16/2022 |
0.0.0-alpha.4 | 90 | 11/15/2022 |
0.0.0-alpha.3 | 82 | 11/15/2022 |
0.0.0-alpha.2 | 88 | 11/11/2022 |
0.0.0-alpha.1 | 84 | 11/10/2022 |