Skip to content

Commit

Permalink
Fake 2 Nuke (#91)
Browse files Browse the repository at this point in the history
* remove fake, add nuke
* move benchmarks
* add build tools
* legacy tests
* streams tests
* block tests
* inspections
* nullables & assertions
* documentation
  • Loading branch information
MiloszKrajewski authored Oct 3, 2023
1 parent 0509c29 commit 52f4345
Show file tree
Hide file tree
Showing 194 changed files with 7,451 additions and 7,253 deletions.
18 changes: 12 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
"version": 1,
"isRoot": true,
"tools": {
"paket": {
"version": "7.1.5",
"run-script": {
"version": "0.5.0",
"commands": [
"paket"
"r"
]
},
"fake-cli": {
"version": "5.20.4",
"dotnet-outdated-tool": {
"version": "4.5.0",
"commands": [
"fake"
"dotnet-outdated"
]
},
"paket": {
"version": "7.2.1",
"commands": [
"paket"
]
}
}
Expand Down
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=K4os.Compression.LZ4
39 changes: 39 additions & 0 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_continuous --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------

name: continuous

on: [push]

jobs:
windows-latest:
name: windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('.paket.lock', 'Directory.Packages.props', '**/*.csproj') }}
- name: Run './build.cmd Release'
run: ./build.cmd Release
- uses: actions/upload-artifact@v3
with:
name: .output
path: .output
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ packages/
**/bin/
**/obj/

Debug/
Release/
playground/**/Debug/
playground/**/Release/

*.bak
*.user
*.suo
*.snk
**/BenchmarkDotNet.Artifacts/

.secrets.cfg
.signing.snk

**/BenchmarkDotNet.Artifacts/
*.bak
*.user
*.suo
3 changes: 3 additions & 0 deletions .nuke/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
temp/
bin/
obj/
122 changes: 122 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"definitions": {
"build": {
"type": "object",
"properties": {
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Debug": {
"type": "boolean",
"description": "Use debug configuration"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Build",
"Clean",
"Download",
"Preprocess",
"PublishToGitHub",
"PublishToNuget",
"Rebuild",
"Release",
"Restore",
"Sanitize",
"Test"
]
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Build",
"Clean",
"Download",
"Preprocess",
"PublishToGitHub",
"PublishToNuget",
"Rebuild",
"Release",
"Restore",
"Sanitize",
"Test"
]
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
}
}
}
}
}
11 changes: 11 additions & 0 deletions .nuke/build/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[*.cs]
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_require_accessibility_modifiers = never:warning

csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
16 changes: 16 additions & 0 deletions .nuke/build/Configuration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.ComponentModel;
using System.Linq;
using Nuke.Common.Tooling;

[TypeConverter(typeof(TypeConverter<Configuration>))]
public class Configuration : Enumeration
{
public static readonly Configuration Debug = new() { Value = nameof(Debug) };
public static readonly Configuration Release = new() { Value = nameof(Release) };

public static implicit operator string(Configuration configuration)
{
return configuration.Value;
}
}
12 changes: 12 additions & 0 deletions .nuke/build/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.props file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->

<PropertyGroup>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>

</Project>
13 changes: 13 additions & 0 deletions .nuke/build/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.targets file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->

<ItemGroup>
<None Remove="../../Directory.Build.*" Visible="false"/>
<None Remove="Directory.Build.*" Visible="false"/>
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions .nuke/build/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using JetBrains.Annotations;

// ReSharper disable once CheckNamespace
namespace System;

public static class Extensions
{
public static string Join(this IEnumerable<string> source, string separator) =>
string.Join(separator, source);

[CanBeNull]
public static string NullIfEmpty([CanBeNull] this string value) =>
string.IsNullOrWhiteSpace(value) ? null : value;
}
74 changes: 74 additions & 0 deletions .nuke/build/GitHubReleaser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using System.IO;
using System.Threading.Tasks;
using NuGet.Versioning;
using Nuke.Common.ChangeLog;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.Tools.GitHub;
using Nuke.Common.Tools.GitVersion;
using Octokit;
using Octokit.Internal;
using Serilog;

public class GitHubReleaser
{
static async Task UploadReleaseAssetToGithub(Release release, string asset)
{
await using var artifactStream = File.OpenRead(asset);
var fileName = Path.GetFileName(asset);
var assetUpload = new ReleaseAssetUpload {
FileName = fileName,
ContentType = "application/octet-stream",
RawData = artifactStream,
};
Log.Information("Uploading {FileName}...", fileName);
await GitHubTasks.GitHubClient.Repository.Release.UploadAsset(release, assetUpload);
}

public static async Task Release(
string token,
NuGetVersion packageVersion,
GitRepository gitRepository,
GitVersion gitVersion,
ReleaseNotes releaseNotes,
AbsolutePath[] artifacts)
{
var credentials = new Credentials(token);

GitHubTasks.GitHubClient = new GitHubClient(
new ProductHeaderValue(nameof(GitHubReleaser)),
new InMemoryCredentialStore(credentials));

var releaseTag = packageVersion.ToString();
var repositoryOwner = gitRepository.GetGitHubOwner();
var repositoryName = gitRepository.GetGitHubName();

Log.Information("Creating draft release {ReleaseTag}...", releaseTag);

var newRelease = new NewRelease(releaseTag) {
TargetCommitish = gitVersion.Sha,
Draft = true,
Name = $"v{releaseTag}",
Prerelease = packageVersion.IsPrerelease,
Body = releaseNotes.Notes.Join("\n"),
};

var createdRelease = await GitHubTasks
.GitHubClient
.Repository
.Release.Create(repositoryOwner, repositoryName, newRelease);

foreach (var artifact in artifacts)
await UploadReleaseAssetToGithub(createdRelease, artifact);

Log.Information("Publishing release {ReleaseTag}...", releaseTag);
await GitHubTasks
.GitHubClient
.Repository
.Release
.Edit(
repositoryOwner, repositoryName, createdRelease.Id,
new ReleaseUpdate { Draft = false });
}
}
Loading

0 comments on commit 52f4345

Please sign in to comment.