Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFRA:UsefulTime Build Project Initialize #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: UsefulTime Build Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: windows-2022
steps:
- name: Check out
uses: actions/checkout@v2
- name: Setup .Net
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.300-preview.24203.14
include-prerelease: true
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
89 changes: 89 additions & 0 deletions UsefulTime.Build.Project/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//==================================================
// Copyright (c) Coalition Of Good-Hearted Engineers
// Free To Use To Find Comfort And Peace
//==================================================
using ADotNet.Clients;
using ADotNet.Models.Pipelines.GithubPipelines.DotNets;
using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks;
using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks.SetupDotNetTaskV1s;

internal class Program
{
private static void Main(string[] args)
{
var aDotNetClient = new ADotNetClient();

var githubPipeline = new GithubPipeline
{
Name = "UsefulTime Build Pipeline",

OnEvents = new Events
{
Push = new PushEvent
{
Branches = new string[] { "main" }
},

PullRequest = new PullRequestEvent
{
Branches = new string[] { "main" }
}
},

Jobs = new Dictionary<string, Job>
{
{
"build",
new Job
{
RunsOn = BuildMachines.Windows2022,

Steps = new List<GithubTask>
{
new CheckoutTaskV2
{
Name = "Check out"
},

new SetupDotNetTaskV1
{
Name = "Setup .Net",

TargetDotNetVersion = new TargetDotNetVersion
{
DotNetVersion = "8.0.300-preview.24203.14",
IncludePrerelease = true
}
},

new RestoreTask
{
Name = "Restore"
},

new DotNetBuildTask
{
Name = "Build"
},

new TestTask
{
Name = "Test"
}
}
}
}
}
};

string buildScriptPath = "../../../../.github/workflows/dotnet.yml";
string directoryPath = Path.GetDirectoryName(buildScriptPath);

Check warning on line 80 in UsefulTime.Build.Project/Program.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 80 in UsefulTime.Build.Project/Program.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);

Check warning on line 84 in UsefulTime.Build.Project/Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'path' in 'DirectoryInfo Directory.CreateDirectory(string path)'.

Check warning on line 84 in UsefulTime.Build.Project/Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'path' in 'DirectoryInfo Directory.CreateDirectory(string path)'.
}

aDotNetClient.SerializeAndWriteToFile(githubPipeline, path: buildScriptPath);
}
}
14 changes: 14 additions & 0 deletions UsefulTime.Build.Project/UsefulTime.Build.Project.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ADotNet" Version="3.0.3" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions UsefulTime.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34902.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsefulTime.Build.Project", "UsefulTime.Build.Project\UsefulTime.Build.Project.csproj", "{8AEE94B6-7922-441A-BA9E-B7F84FB0D235}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8AEE94B6-7922-441A-BA9E-B7F84FB0D235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8AEE94B6-7922-441A-BA9E-B7F84FB0D235}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8AEE94B6-7922-441A-BA9E-B7F84FB0D235}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8AEE94B6-7922-441A-BA9E-B7F84FB0D235}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9FE72585-A909-410F-B6C4-D46516942E97}
EndGlobalSection
EndGlobal
Loading