-
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
4e2b8f7
commit 8e67849
Showing
5 changed files
with
182 additions
and
6 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,32 @@ | ||
name: FlexiMail Build | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Pulling Code | ||
uses: actions/checkout@v3 | ||
- name: Installing .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.* | ||
- name: Restoring Packages | ||
run: dotnet restore | ||
- name: Building Solution | ||
run: dotnet build --no-restore | ||
- name: Running Tests | ||
run: dotnet test --no-build --verbosity normal | ||
env: | ||
Authority: ${{ secrets.AUTHORITY }} | ||
ClientId: ${{ secrets.CLIENTID }} | ||
ClientSecret: ${{ secrets.CLIENTSECRET }} | ||
PrincipalName: ${{ secrets.PRINCIPALNAME }} | ||
Sid: ${{ secrets.SID }} | ||
SmtpAddress: ${{ secrets.SMTPADDRESS }} | ||
TenantId: ${{ secrets.TENANTID }} |
14 changes: 14 additions & 0 deletions
14
FlexiMail.Infrastructure.Build/FlexiMail.Infrastructure.Build.csproj
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>disable</ImplicitUsings> | ||
<Nullable>disable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ADotNet" Version="3.0.3" /> | ||
</ItemGroup> | ||
|
||
</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,106 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using ADotNet.Clients; | ||
using ADotNet.Models.Pipelines.GithubPipelines.DotNets; | ||
using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks; | ||
using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks.SetupDotNetTaskV3s; | ||
|
||
namespace FlexiMail.Infrastructure.Build | ||
{ | ||
internal class Program | ||
{ | ||
private const string BuildScriptPath = "../../../../.github/workflows/dotnet.yml"; | ||
|
||
private static void Main(string[] args) | ||
{ | ||
var adoNetClient = new ADotNetClient(); | ||
|
||
var githubPipeline = new GithubPipeline | ||
{ | ||
Name = "FlexiMail Build", | ||
|
||
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 | ||
{ | ||
EnvironmentVariables = new Dictionary<string, string> | ||
{ | ||
{ "Authority", "${{ secrets.AUTHORITY }}" }, | ||
{ "ClientId", "${{ secrets.CLIENTID }}" }, | ||
{ "ClientSecret", "${{ secrets.CLIENTSECRET }}" }, | ||
{ "PrincipalName", "${{ secrets.PRINCIPALNAME }}" }, | ||
{ "Sid", "${{ secrets.SID }}" }, | ||
{ "SmtpAddress", "${{ secrets.SMTPADDRESS }}" }, | ||
{ "TenantId", "${{ secrets.TENANTID }}" } | ||
}, | ||
|
||
RunsOn = BuildMachines.WindowsLatest, | ||
|
||
Steps = | ||
[ | ||
new CheckoutTaskV3 | ||
{ | ||
Name = "Pulling Code" | ||
}, | ||
|
||
|
||
new SetupDotNetTaskV3 | ||
{ | ||
Name = "Installing .NET", | ||
|
||
With = new TargetDotNetVersionV3 | ||
{ | ||
DotNetVersion = "8.0.*" | ||
} | ||
}, | ||
|
||
|
||
new RestoreTask | ||
{ | ||
Name = "Restoring Packages" | ||
}, | ||
|
||
|
||
new DotNetBuildTask | ||
{ | ||
Name = "Building Solution" | ||
}, | ||
|
||
|
||
new TestTask | ||
{ | ||
Name = "Running Tests" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}; | ||
|
||
var directoryPath = Path.GetDirectoryName(BuildScriptPath); | ||
if (!Directory.Exists(directoryPath)) | ||
{ | ||
Directory.CreateDirectory(directoryPath!); | ||
} | ||
|
||
adoNetClient.SerializeAndWriteToFile( | ||
adoPipeline: githubPipeline, | ||
path: BuildScriptPath); | ||
} | ||
} | ||
} |
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