Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamralph/bullseye
🎯 A .NET library for running a target dependency graph.
https://github.com/adamralph/bullseye
Last synced: 28 days ago
JSON representation
🎯 A .NET library for running a target dependency graph.
- Host: GitHub
- URL: https://github.com/adamralph/bullseye
- Owner: adamralph
- License: apache-2.0
- Created: 2017-11-15T13:16:31.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T23:32:48.000Z (7 months ago)
- Last Synced: 2024-05-01T23:12:39.805Z (6 months ago)
- Language: C#
- Homepage:
- Size: 1.81 MB
- Stars: 824
- Watchers: 13
- Forks: 38
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Bullseye
![Bullseye](https://raw.githubusercontent.com/adamralph/bullseye/958af18a096239e9a040ff22c5d8bf08f0fc2466/assets/bullseye.svg)
_[![NuGet version](https://img.shields.io/nuget/v/Bullseye.svg?style=flat)](https://www.nuget.org/packages/Bullseye)_
_[![Build status](https://github.com/adamralph/bullseye/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/adamralph/bullseye/actions/workflows/ci.yml)_
_[![CodeQL analysis](https://github.com/adamralph/bullseye/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/adamralph/bullseye/actions/workflows/codeql-analysis.yml)_
_[![Lint](https://github.com/adamralph/bullseye/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/adamralph/bullseye/actions/workflows/lint.yml)_
_[![Spell check](https://github.com/adamralph/bullseye/actions/workflows/spell-check.yml/badge.svg?branch=main)](https://github.com/adamralph/bullseye/actions/workflows/spell-check.yml)__[![AppVeyor smoke test status](https://img.shields.io/appveyor/ci/adamralph/bullseye/main.svg?logo=appveyor&label=AppVeyor)](https://ci.appveyor.com/project/adamralph/bullseye/branch/main)_
_[![CircleCI smoke test status](https://img.shields.io/circleci/build/github/adamralph/bullseye/main?logo=circleci&label=CircleCI)](https://circleci.com/gh/adamralph/bullseye/tree/main)_
_[![Cirrus CI smoke test status](https://img.shields.io/cirrus/github/adamralph/bullseye/main?logo=cirrus-ci&label=Cirrus%20CI)](https://cirrus-ci.com/github/adamralph/bullseye)_
_[![GitLab CI/CD smoke test status](https://img.shields.io/gitlab/pipeline/adamralph/bullseye/main.svg?logo=gitlab&label=GitLab+CI%2fCD)](https://gitlab.com/adamralph/bullseye/-/jobs)_Bullseye is a [.NET library](https://www.nuget.org/packages/Bullseye) that runs a target dependency graph.
Bullseye is primarily designed as a build tool for .NET projects, and is usually used together with [SimpleExec](https://github.com/adamralph/simple-exec), but Bullseye targets can do anything. They are not restricted to building .NET projects.
Platform support: [.NET 6.0 and later](https://docs.microsoft.com/en-us/dotnet/standard/net-standard).
- [Quick start](#quick-start)
- [Sample wrapper scripts](#sample-wrapper-scripts)
- [Enumerable inputs](#enumerable-inputs)
- [Command-line arguments](#command-line-arguments)
- [Non-static API](#non-static-api)
- [NO\_COLOR](#no_color)
- [Who's using Bullseye?](#whos-using-bullseye)## Quick start
- Next to an existing .NET solution (`.sln` file), add a .NET console app named `targets` — `dotnet new console --name targets`
- Change to the new directory — `cd targets`
- Add a reference to [Bullseye](https://www.nuget.org/packages/Bullseye) — `dotnet add package Bullseye`
- Add a reference to [SimpleExec](https://www.nuget.org/packages/SimpleExec) — `dotnet add package SimpleExec`
- Replace the contents of `targets/Program.cs` with:```c#
using static Bullseye.Targets;
using static SimpleExec.Command;Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo --verbosity quiet"));
Target("test", DependsOn("build"), () => RunAsync("dotnet", "test --configuration Release --no-build --nologo --verbosity quiet"));
Target("default", DependsOn("test"));await RunTargetsAndExitAsync(args, ex => ex is SimpleExec.ExitCodeException);
```- Change to the solution directory — `cd ..`
- Run the targets project — `dotnet run --project targets`.Voilà ! You've just written and run your first Bullseye build program. You will see output similar to:
For help, run `dotnet run --project targets --help`.
## Sample wrapper scripts
- `build` (Linux and macOS)
```shell
#!/usr/bin/env bash
set -euo pipefail
dotnet run --project targets -- "$@"
```- `build.cmd` (Windows)
```batchfile
@echo Off
dotnet run --project targets -- %*
```## Enumerable inputs
For example, you may want to run your test projects one by one, so that the timing of each one and which one, if any, failed, is displayed in the Bullseye build summary:
```c#
Target(
"test",
DependsOn("build"),
ForEach("./FooTests.Acceptance", "./FooTests.Performance"),
project => RunAsync($"dotnet", $"test {project} --configuration Release --no-build --nologo --verbosity quiet"));
``````shell
dotnet run -- test
```## Command-line arguments
Generally, all the command-line arguments passed to `Program.cs` should be passed along to Bullseye, as shown in the quick start above (`RunTargetsAndExitAsync(args);`). This is because Bullseye effectively provides a command-line interface, with options for displaying a list of targets, performing dry runs, suppressing colour, and more. For full details of the command-line options, run your targets project supplying the `--help` (`-h`/`-?`) option:
```shell
dotnet run --project targets -- --help
``````shell
./build --help
``````batchfile
./build.cmd --help
```You can also handle custom arguments in `Program.cs`, but you should ensure that only valid arguments are passed along to Bullseye and that the help text contains both your custom arguments and the arguments supported by Bullseye. A good way to do this is to use a command-line parsing package to define your custom arguments, and to provide translation between the package and Bullseye. For example, see the test projects for:
- [`System.CommandLine`](BullseyeSmokeTester.CommandLine/Program.cs)
- [`System.CommandLine.DragonFruit`](BullseyeSmokeTester.DragonFruit/Program.cs)
- [`McMaster.Extensions.CommandLineUtils`](BullseyeSmokeTester.McMaster/Program.cs)## Non-static API
For most cases, the static API described above is sufficient. For more complex scenarios where a number of target collections are required, the non-static API may be used.
```c#
var targets1 = new Targets();
targets1.Add("foo", () => Console.Out.WriteLine("foo1"));var targets2 = new Targets();
targets2.Add("foo", () => Console.Out.WriteLine("foo2"));await targets1.RunWithoutExitingAsync(args);
await targets2.RunWithoutExitingAsync(args);
```## NO_COLOR
Bullseye supports [NO_COLOR](https://no-color.org/).
## Who's using Bullseye?
To name a few:
- [AspNetCore.AsyncInitialization](https://github.com/thomaslevesque/AspNetCore.AsyncInitialization)
- [Config.SqlStreamStore](https://github.com/Erwinvandervalk/Config.SqlStreamStore)
- [ConfigR](https://github.com/config-r)
- [Elastic](https://github.com/elastic)
- [EssentialMVVM](https://github.com/thomaslevesque/EssentialMVVM)
- [FakeItEasy](https://github.com/FakeItEasy)
- [Fluxzy](https://github.com/haga-rak/fluxzy.core)
- [HumanBytes](https://github.com/thomaslevesque/HumanBytes)
- [Ibento](https://github.com/pgermishuys/Ibento)
- [IdentityModel](https://github.com/IdentityModel)
- [IdentityServer](https://github.com/IdentityServer)
- [Iso8601DurationHelper](https://github.com/thomaslevesque/Iso8601DurationHelper)
- [Linq.Extras](https://github.com/thomaslevesque/Linq.Extras)
- [LittleForker](https://github.com/damianh/LittleForker)
- [LykkeOSS](https://github.com/LykkeOSS)
- [Marten](https://github.com/JasperFx/marten)
- [MinVer](https://github.com/adamralph/minver)
- [Particular](https://github.com/Particular)
- [ProxyKit](https://github.com/damianh/ProxyKit)
- [PseudoLocalizer](https://github.com/bymyslf/PseudoLocalizer)
- [Radical Framework](https://github.com/RadicalFx)
- [RealWorld](https://github.com/gothinkster/aspnetcore-realworld-example-app)
- [SelfInitializingFakes](https://github.com/blairconrad/SelfInitializingFakes)
- [SendComics](https://github.com/blairconrad/SendComics)
- [SqlStreamStore.Locking](https://github.com/Erwinvandervalk/SqlStreamStore.Locking)
- [SQLStreamStore](https://github.com/SQLStreamStore)
- [Statik](https://github.com/pauldotknopf/statik)
- [Tasty](https://github.com/xenial-io/Tasty)
- [TemplatedConfiguration](https://github.com/Erwinvandervalk/TemplatedConfiguration)
- [Xenial](https://github.com/xenial-io)Feel free to send a pull request to add your repository or organisation to this list!
---
[Target](https://thenounproject.com/term/target/345443) by [Franck Juncker](https://thenounproject.com/franckjuncker/) from [the Noun Project](https://thenounproject.com/).