-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29442e9
commit b093cb2
Showing
13 changed files
with
385 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_publish --host GitHubActions | ||
# | ||
# </auto-generated> | ||
# ------------------------------------------------------------------------------ | ||
|
||
name: publish | ||
|
||
on: [ workflow_dispatch ] | ||
|
||
jobs: | ||
ubuntu-latest: | ||
name: ubuntu-latest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 10000 | ||
- name: 'Cache: .nuke/temp, ~/.nuget/packages' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.nuke/temp | ||
~/.nuget/packages | ||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} | ||
- name: 'Run: Pack' | ||
run: ./TorznabClient.Demo/build.cmd Pack | ||
env: | ||
NugetApiKey: ${{ secrets.NUGET_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# ------------------------------------------------------------------------------ | ||
# <auto-generated> | ||
# | ||
# This code was generated. | ||
# | ||
# - To turn off auto-generation set: | ||
# | ||
# [GitHubActions (AutoGenerate = false)] | ||
# | ||
# - To trigger manual generation invoke: | ||
# | ||
# nuke --generate-configuration GitHubActions_test --host GitHubActions | ||
# | ||
# </auto-generated> | ||
# ------------------------------------------------------------------------------ | ||
|
||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ubuntu-latest: | ||
name: ubuntu-latest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 10000 | ||
- name: 'Cache: .nuke/temp, ~/.nuget/packages' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.nuke/temp | ||
~/.nuget/packages | ||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} | ||
- name: 'Run: Test' | ||
run: ./TorznabClient.Demo/build.cmd Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
mode: Mainline | ||
branches: | ||
develop: | ||
is-mainline: true | ||
source-branches: [ ] | ||
increment: Patch | ||
tag: beta | ||
regex: (origin/)?development$ | ||
ignore: | ||
sha: [ ] | ||
merge-message-formats: { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:; set -eo pipefail | ||
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) | ||
:; ${SCRIPT_DIR}/build.sh "$@" | ||
:; exit $? | ||
|
||
@ECHO OFF | ||
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
|
||
bash --version 2>&1 | head -n 1 | ||
|
||
set -eo pipefail | ||
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) | ||
|
||
########################################################################### | ||
# CONFIGURATION | ||
########################################################################### | ||
|
||
BUILD_PROJECT_FILE="$SCRIPT_DIR/../build/_build.csproj" | ||
TEMP_DIRECTORY="$SCRIPT_DIR/../.nuke/temp" | ||
|
||
DOTNET_GLOBAL_FILE="$SCRIPT_DIR/../global.json" | ||
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh" | ||
DOTNET_CHANNEL="STS" | ||
|
||
export DOTNET_CLI_TELEMETRY_OPTOUT=1 | ||
export DOTNET_NOLOGO=1 | ||
|
||
########################################################################### | ||
# EXECUTION | ||
########################################################################### | ||
|
||
function FirstJsonValue { | ||
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}" | ||
} | ||
|
||
# If dotnet CLI is installed globally and it matches requested version, use for execution | ||
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then | ||
export DOTNET_EXE="$(command -v dotnet)" | ||
else | ||
# Download install script | ||
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh" | ||
mkdir -p "$TEMP_DIRECTORY" | ||
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL" | ||
chmod +x "$DOTNET_INSTALL_FILE" | ||
|
||
# If global.json exists, load expected version | ||
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then | ||
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")") | ||
if [[ "$DOTNET_VERSION" == "" ]]; then | ||
unset DOTNET_VERSION | ||
fi | ||
fi | ||
|
||
# Install by channel or version | ||
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix" | ||
if [[ -z ${DOTNET_VERSION+x} ]]; then | ||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path | ||
else | ||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path | ||
fi | ||
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet" | ||
export PATH="$DOTNET_DIRECTORY:$PATH" | ||
fi | ||
|
||
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)" | ||
|
||
if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then | ||
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true | ||
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true | ||
fi | ||
|
||
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet | ||
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
using Nuke.Common; | ||
using Nuke.Common.CI.GitHubActions; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.ProjectModel; | ||
using Nuke.Common.Tooling; | ||
using Nuke.Common.Tools.DotNet; | ||
using Nuke.Common.Tools.GitVersion; | ||
using Serilog; | ||
|
||
[GitHubActions( | ||
"test", | ||
GitHubActionsImage.UbuntuLatest, | ||
// On = [GitHubActionsTrigger.PullRequest, GitHubActionsTrigger.WorkflowDispatch, GitHubActionsTrigger.Push], | ||
InvokedTargets = [nameof(Test)], | ||
FetchDepth = 10000, | ||
OnPushBranches = ["main"], | ||
OnPullRequestBranches = ["main"] | ||
)] | ||
[GitHubActions( | ||
"publish", | ||
GitHubActionsImage.UbuntuLatest, | ||
On = [GitHubActionsTrigger.WorkflowDispatch], | ||
// InvokedTargets = [nameof(Pack), nameof(Push)], | ||
InvokedTargets = [nameof(Pack)], | ||
ImportSecrets = [nameof(NugetApiKey)], | ||
FetchDepth = 10000 | ||
)] | ||
class Build : NukeBuild | ||
{ | ||
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release; | ||
|
||
[GitVersion] readonly GitVersion GitVersion; | ||
[Parameter("API Key for the NuGet server.")] [Secret] readonly string NugetApiKey; | ||
[Parameter("NuGet server URL.")] readonly string NugetSource = "https://api.nuget.org/v3/index.json"; | ||
[Parameter("NuGet package version.")] readonly string PackageVersion; | ||
[Solution] readonly Solution Solution; | ||
Project PublishProject => Solution.GetProject("TorznabClient"); | ||
|
||
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; | ||
|
||
// ReSharper disable once AllUnderscoreLocalParameterName | ||
Target Clean => _ => _ | ||
.Before(Restore) | ||
.Executes(() => | ||
{ | ||
ArtifactsDirectory.CreateOrCleanDirectory(); | ||
DotNetTasks.DotNetClean(s => s | ||
.SetProject(Solution) | ||
); | ||
}); | ||
|
||
// ReSharper disable once AllUnderscoreLocalParameterName | ||
Target Restore => _ => _ | ||
.Executes(() => | ||
{ | ||
DotNetTasks.DotNetRestore(s => s | ||
.SetProjectFile(Solution) | ||
); | ||
}); | ||
|
||
// ReSharper disable once AllUnderscoreLocalParameterName | ||
Target Compile => _ => _ | ||
.DependsOn(Restore) | ||
.Executes(() => | ||
{ | ||
Log.Information("GitVersion = {Value}", GitVersion.MajorMinorPatch); | ||
DotNetTasks.DotNetBuild(s => s | ||
.SetProjectFile(Solution) | ||
.SetConfiguration(Configuration) | ||
.SetAssemblyVersion(GitVersion.AssemblySemVer) | ||
.SetFileVersion(GitVersion.AssemblySemFileVer) | ||
.SetInformationalVersion(GitVersion.InformationalVersion) | ||
.EnableNoRestore() | ||
); | ||
}); | ||
|
||
// ReSharper disable once AllUnderscoreLocalParameterName | ||
Target Test => _ => _ | ||
.DependsOn(Compile) | ||
.Executes(() => | ||
{ | ||
DotNetTasks.DotNetTest(s => s | ||
.SetProjectFile(Solution) | ||
.SetConfiguration(Configuration) | ||
.EnableNoRestore() | ||
.EnableNoBuild() | ||
); | ||
}); | ||
|
||
// ReSharper disable once AllUnderscoreLocalParameterName | ||
Target Pack => _ => _ | ||
.DependsOn(Clean, Test) | ||
.Before(Push) | ||
.Requires(() => Configuration == Configuration.Release) | ||
.Executes(() => | ||
{ | ||
DotNetTasks.DotNetPack(s => s | ||
.EnableNoRestore() | ||
.EnableNoBuild() | ||
.SetProject(PublishProject) | ||
.SetConfiguration(Configuration) | ||
.SetOutputDirectory(ArtifactsDirectory) | ||
.SetProperty("PackageVersion", PackageVersion ?? GitVersion.NuGetVersionV2) | ||
); | ||
}); | ||
|
||
// ReSharper disable once AllUnderscoreLocalParameterName | ||
Target Push => _ => _ | ||
.Executes(() => | ||
{ | ||
DotNetTasks.DotNetNuGetPush(s => s | ||
.SetSource(NugetSource) | ||
.SetApiKey(NugetApiKey) | ||
.CombineWith(ArtifactsDirectory.GlobFiles("*.nupkg"), (s, v) => s | ||
.SetTargetPath(v) | ||
) | ||
); | ||
}); | ||
|
||
/// Support plugins are available for: | ||
/// - JetBrains ReSharper https://nuke.build/resharper | ||
/// - JetBrains Rider https://nuke.build/rider | ||
/// - Microsoft VisualStudio https://nuke.build/visualstudio | ||
/// - Microsoft VSCode https://nuke.build/vscode | ||
public static int Main() => Execute<Build>(x => x.Compile); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.ComponentModel; | ||
using Nuke.Common.Tooling; | ||
|
||
[TypeConverter(typeof(TypeConverter<Configuration>))] | ||
public class Configuration : Enumeration | ||
{ | ||
public static Configuration Debug = new() { Value = nameof(Debug) }; | ||
public static Configuration Release = new() { Value = nameof(Release) }; | ||
|
||
public static implicit operator string(Configuration configuration) => configuration.Value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?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)../'))" />--> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?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)../'))" />--> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace></RootNamespace> | ||
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn> | ||
<NukeRootDirectory>..</NukeRootDirectory> | ||
<NukeScriptDirectory>..\TorznabClient.Demo</NukeScriptDirectory> | ||
<NukeTelemetryVersion>1</NukeTelemetryVersion> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Nuke.Common" Version="8.0.0"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]"/> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.