Skip to content

Commit

Permalink
Merge pull request #2 from atc-net/feature/vNext1
Browse files Browse the repository at this point in the history
Feature/v next1
  • Loading branch information
davidkallesen authored Sep 12, 2023
2 parents 6df9db3 + d2b5dd2 commit e1daa99
Show file tree
Hide file tree
Showing 88 changed files with 4,826 additions and 807 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net
dotnet_diagnostic.CA1040.severity = none # Avoid empty interface
dotnet_diagnostic.CA1724.severity = none # The type name App conflicts in whole or in part with the namespace name
dotnet_diagnostic.CA1848.severity = none # Skip for now: Use the LoggerMessage delegates
dotnet_diagnostic.CA2227.severity = none # Skip for now: Read only collection
dotnet_diagnostic.CA2254.severity = none # Skip for now: Template should be a static expression
dotnet_diagnostic.CA5351.severity = none # Do Not Use Broken Cryptographic Algorithms - Its ok, only using to calculate a file-hash

Expand Down
60 changes: 30 additions & 30 deletions .github/workflows/post-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,41 @@ jobs:
with:
setAllVars: true

- name: ⚙️ Setup dotnet 7.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
# - name: ⚙️ Setup dotnet 7.0.x
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: '7.0.x'

- name: ⚙️ Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
# - name: ⚙️ Set up JDK 11
# uses: actions/setup-java@v1
# with:
# java-version: 1.11

- name: 📐 Ensure nuget.org added as package source on Windows
run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
continue-on-error: true
# - name: 📐 Ensure nuget.org added as package source on Windows
# run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
# continue-on-error: true

- name: 🔁 Restore packages
run: dotnet restore Atc.Installer-WithoutSetup.sln
# - name: 🔁 Restore packages
# run: dotnet restore Atc.Installer-WithoutSetup.sln

- name: 🛠️ Build
run: dotnet build Atc.Installer-WithoutSetup.sln -c Release --no-restore /p:UseSourceLink=true
# - name: 🛠️ Build
# run: dotnet build Atc.Installer-WithoutSetup.sln -c Release --no-restore /p:UseSourceLink=true

- name: 🧪 Run unit tests
run: dotnet test Atc.Installer-WithoutSetup.sln -c Release --no-build --filter "Category!=Integration"
# - name: 🧪 Run unit tests
# run: dotnet test Atc.Installer-WithoutSetup.sln -c Release --no-build --filter "Category!=Integration"

- name: 🌩️ SonarCloud install scanner
run: dotnet tool install --global dotnet-sonarscanner
# - name: 🌩️ SonarCloud install scanner
# run: dotnet tool install --global dotnet-sonarscanner

- name: 🌩️ SonarCloud analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: pwsh
run: |
dotnet sonarscanner begin /k:"atc-wpf" /o:"atc-net" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build Atc.Installer-WithoutSetup.sln -c Release /p:UseSourceLink=true --no-restore
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
# - name: 🌩️ SonarCloud analyze
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# shell: pwsh
# run: |
# dotnet sonarscanner begin /k:"atc-wpf" /o:"atc-net" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
# dotnet build Atc.Installer-WithoutSetup.sln -c Release /p:UseSourceLink=true --no-restore
# dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

- name: ⏩ Merge to stable-branch
run: |
Expand All @@ -74,5 +74,5 @@ jobs:
git merge --ff-only main
git push origin stable
- name: 🗳️ Creating library package for pre-release
run: dotnet pack Atc.Installer-WithoutSetup.sln -c Release --no-restore -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH_NAME
# - name: 🗳️ Creating library package for pre-release
# run: dotnet pack Atc.Installer-WithoutSetup.sln -c Release --no-restore -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH_NAME
48 changes: 24 additions & 24 deletions .github/workflows/pre-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ jobs:
with:
fetch-depth: 0

- name: ⚙️ Setup dotnet 7.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
# - name: ⚙️ Setup dotnet 7.0.x
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: '7.0.x'

- name: 📐 Ensure nuget.org added as package source on Windows
run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
continue-on-error: true
# - name: 📐 Ensure nuget.org added as package source on Windows
# run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
# continue-on-error: true

- name: 🔁 Restore packages
run: dotnet restore Atc.Installer-WithoutSetup.sln
# - name: 🔁 Restore packages
# run: dotnet restore Atc.Installer-WithoutSetup.sln

- name: 🛠️ Building library in release mode
run: dotnet build Atc.Installer-WithoutSetup.sln -c Release --no-restore
# - name: 🛠️ Building library in release mode
# run: dotnet build Atc.Installer-WithoutSetup.sln -c Release --no-restore

dotnet-test:
runs-on: windows-latest
Expand All @@ -41,20 +41,20 @@ jobs:
with:
fetch-depth: 0

- name: ⚙️ Setup dotnet 7.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
# - name: ⚙️ Setup dotnet 7.0.x
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: '7.0.x'

- name: 📐 Ensure nuget.org added as package source on Windows
run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
continue-on-error: true
# - name: 📐 Ensure nuget.org added as package source on Windows
# run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
# continue-on-error: true

- name: 🔁 Restore packages
run: dotnet restore Atc.Installer-WithoutSetup.sln
# - name: 🔁 Restore packages
# run: dotnet restore Atc.Installer-WithoutSetup.sln

- name: 🛠️ Build
run: dotnet build Atc.Installer-WithoutSetup.sln -c Release --no-restore /p:UseSourceLink=true
# - name: 🛠️ Build
# run: dotnet build Atc.Installer-WithoutSetup.sln -c Release --no-restore /p:UseSourceLink=true

- name: 🧪 Run unit tests
run: dotnet test Atc.Installer-WithoutSetup.sln -c Release --no-build --filter "Category!=Integration"
# - name: 🧪 Run unit tests
# run: dotnet test Atc.Installer-WithoutSetup.sln -c Release --no-build --filter "Category!=Integration"
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
<ItemGroup Label="Code Analyzers">
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.81" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.84" PrivateAssets="All" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.7.0.75501" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.9.0.77355" PrivateAssets="All" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions setup/Atc.Installer/Atc.Installer.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Atc.Installer"
"ProductCode" = "8:{3F307C9D-74FA-4720-A46B-9BE093C3A265}"
"PackageCode" = "8:{93937C48-D568-4997-A6D2-5564D5653779}"
"PackageCode" = "8:{D56B6FCA-3775-4E78-B08E-55417E9AA2C7}"
"UpgradeCode" = "8:{F7F3665E-9FEB-4AE3-B0EA-F3791208A1A8}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
Expand Down Expand Up @@ -760,7 +760,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_B80DFB6270524AC7B2F3C294312B6821"
{
"SourcePath" = "8:..\\..\\src\\Atc.Installer.Wpf.App\\obj\\Debug\\net7.0-windows\\apphost.exe"
"SourcePath" = "8:..\\..\\src\\Atc.Installer.Wpf.App\\obj\\Release\\net7.0-windows\\apphost.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_91076E7FEDE74F62A97DBDFD99B106F9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<ItemGroup>
<PackageReference Include="Atc" Version="2.0.349" />
<PackageReference Include="Azure.Identity" Version="1.10.0-beta.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.17.0" />
<PackageReference Include="Azure.Identity" Version="1.10.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.18.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ private static List<string> GetBlobsToDownload(

if (latestReleasedBlobName is not (null, null) &&
(contentHash is null || (latestReleasedBlobName.ContentHash is not null &&
contentHash != ConvertBase64ToHex(latestReleasedBlobName.ContentHash))))
contentHash != ConvertBase64ToHex(latestReleasedBlobName.ContentHash))) &&
!blobsToDownload.Contains(latestReleasedBlobName.BlobName!, StringComparer.Ordinal))
{
blobsToDownload.Add(latestReleasedBlobName.BlobName!);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public bool IsMicrosoftDonNet7()
=> iaInstallerService.IsMicrosoftDonNet7();

public bool IsNodeJs18()
=> TaskHelper.RunSync(() => iaInstallerService.IsNodeJs18());
=> TaskHelper.RunSync(iaInstallerService.IsNodeJs18);

public bool IsInstalledManagementConsole()
{
Expand Down
12 changes: 12 additions & 0 deletions src/Atc.Installer.Integration/Atc.Installer.Integration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<COMReference Include="NetFwTypeLib">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>0</VersionMinor>
<VersionMajor>1</VersionMajor>
<Guid>58fbcf7c-e7a9-467c-80b3-fc65e8fcca08</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Atc" Version="2.0.349" />
</ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions src/Atc.Installer.Integration/Enums/FirewallDirectionType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// ReSharper disable CheckNamespace
namespace Atc.Installer.Integration;

public enum FirewallDirectionType
{
Inbound,
Outbound,
}
9 changes: 9 additions & 0 deletions src/Atc.Installer.Integration/Enums/FirewallProtocolType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ReSharper disable CheckNamespace
namespace Atc.Installer.Integration;

public enum FirewallProtocolType
{
Any,
Tcp,
Udp,
}
16 changes: 16 additions & 0 deletions src/Atc.Installer.Integration/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ public static IList<string> GetTemplateKeys(
.ToList();
}

public static IList<string> SplitTemplate(
this string value)
{
ArgumentNullException.ThrowIfNull(value);

var list = new List<string>();
var sa1 = value.Split("[[", StringSplitOptions.RemoveEmptyEntries);
foreach (var sx1 in sa1)
{
var sa2 = sx1.Split("]]", StringSplitOptions.RemoveEmptyEntries);
list.AddRange(sa2);
}

return list;
}

public static string ReplaceTemplateWithKey(
this string value,
string templateKey,
Expand Down
3 changes: 2 additions & 1 deletion src/Atc.Installer.Integration/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
global using Atc;
global using Atc.Helpers;

global using Microsoft.Win32;
global using Microsoft.Win32;
global using NetFwTypeLib;
49 changes: 49 additions & 0 deletions src/Atc.Installer.Integration/IWindowsFirewallService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace Atc.Installer.Integration;

public interface IWindowsFirewallService
{
bool DoesRuleExist(
string ruleName);

bool IsRuleEnabled(
string ruleName);

(bool IsSucceeded, string? ErrorMessage) AddInboundRuleForAllowTcp(
string ruleName,
string description,
int port);

(bool IsSucceeded, string? ErrorMessage) AddInboundRuleForAllowUdp(
string ruleName,
string description,
int port);

(bool IsSucceeded, string? ErrorMessage) AddInboundRuleForAllowAny(
string ruleName,
string description,
int port);

(bool IsSucceeded, string? ErrorMessage) AddOutboundRuleForAllowTcp(
string ruleName,
string description,
int port);

(bool IsSucceeded, string? ErrorMessage) AddOutboundRuleForAllowUdp(
string ruleName,
string description,
int port);

(bool IsSucceeded, string? ErrorMessage) AddOutboundRuleForAllowAny(
string ruleName,
string description,
int port);

(bool IsSucceeded, string? ErrorMessage) EnableRule(
string ruleName);

(bool IsSucceeded, string? ErrorMessage) DisableRule(
string ruleName);

(bool IsSucceeded, string? ErrorMessage) RemoveRule(
string ruleName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ public class ApplicationOption

public string? RawInstallationPath { get; set; }

public IList<string> DependentComponents { get; init; } = new List<string>();
public IList<string> DependentComponents { get; set; } = new List<string>();

public IList<string> DependentServices { get; init; } = new List<string>();

public IDictionary<string, object> ApplicationSettings { get; init; } = new Dictionary<string, object>(StringComparer.Ordinal);
public IDictionary<string, object> ApplicationSettings { get; set; } = new Dictionary<string, object>(StringComparer.Ordinal);

public IList<FolderPermissionOption> FolderPermissions { get; init; } = new List<FolderPermissionOption>();
public IList<FolderPermissionOption> FolderPermissions { get; set; } = new List<FolderPermissionOption>();

public IList<ConfigurationSettingsFileOption> ConfigurationSettingsFiles { get; init; } = new List<ConfigurationSettingsFileOption>();
public IList<FirewallRuleOption> FirewallRules { get; set; } = new List<FirewallRuleOption>();

public IList<ConfigurationSettingsFileOption> ConfigurationSettingsFiles { get; set; } = new List<ConfigurationSettingsFileOption>();

public IList<EndpointOption> Endpoints { get; init; } = new List<EndpointOption>();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Atc.Installer.Integration.InstallationConfigurations;

public class FirewallRuleOption
{
public string Name { get; set; } = string.Empty;

public int Port { get; set; }

public FirewallProtocolType Protocol { get; set; } = FirewallProtocolType.Tcp;

public FirewallDirectionType Direction { get; set; } = FirewallDirectionType.Inbound;

public override string ToString()
=> $"{nameof(Name)}: {Name}, {nameof(Port)}: {Port}, {nameof(Protocol)}: {Protocol}, {nameof(Direction)}: {Direction}";
}
Loading

0 comments on commit e1daa99

Please sign in to comment.