Add GitHubActions

This commit is contained in:
ITDancer139 2021-05-13 14:37:43 +02:00
parent 3e858fd7e6
commit 871d80bc52
2 changed files with 41 additions and 9 deletions

31
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,31 @@
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_ci --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------
name: ci
on:
push:
branches:
- master
jobs:
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run './build.cmd Ci'
run: ./build.cmd Ci

View File

@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using Nuke.Common; using Nuke.Common;
using Nuke.Common.CI; using Nuke.Common.CI;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Execution; using Nuke.Common.Execution;
using Nuke.Common.Git; using Nuke.Common.Git;
using Nuke.Common.IO; using Nuke.Common.IO;
@ -12,6 +13,11 @@ using static Nuke.Common.Tools.DotNet.DotNetTasks;
[CheckBuildProjectConfigurations] [CheckBuildProjectConfigurations]
[ShutdownDotNetAfterServerBuild] [ShutdownDotNetAfterServerBuild]
[GitHubActions("ci", GitHubActionsImage.UbuntuLatest,
OnPushBranches = new[] {"master"},
AutoGenerate = true,
InvokedTargets = new[] {nameof(Ci)},
CacheKeyFiles = new string[0])]
class Build : NukeBuild class Build : NukeBuild
{ {
/// Support plugins are available for: /// Support plugins are available for:
@ -19,22 +25,18 @@ class Build : NukeBuild
/// - JetBrains Rider https://nuke.build/rider /// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio /// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode /// - Microsoft VSCode https://nuke.build/vscode
public static int Main() => Execute<Build>(x => x.Package);
public static int Main() => Execute<Build>(x => x.Package);
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release; readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Solution] [Solution] readonly Solution Solution;
readonly Solution Solution;
Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve"); Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve");
[GitRepository] [GitRepository] readonly GitRepository GitRepository;
readonly GitRepository GitRepository;
[GitVersion(Framework = "netcoreapp3.1")] [GitVersion(Framework = "netcoreapp3.1")] readonly GitVersion GitVersion;
readonly GitVersion GitVersion;
AbsolutePath OutputDirectory => RootDirectory / "output"; AbsolutePath OutputDirectory => RootDirectory / "output";
@ -91,5 +93,4 @@ class Build : NukeBuild
Target Ci => _ => _ Target Ci => _ => _
.DependsOn(Package); .DependsOn(Package);
} }