Skip to content

Commit

Permalink
Merge pull request #48 from ewilliams0305/47-multi-target
Browse files Browse the repository at this point in the history
47 multi target
  • Loading branch information
ewilliams0305 authored Jul 14, 2024
2 parents 09960b1 + 2dc6504 commit bde6a9b
Show file tree
Hide file tree
Showing 25 changed files with 347 additions and 555 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/dotnet-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: PUBLISH BETA

on:
workflow_dispatch:

pull_request:
types:
- closed
branches:
- 'development'
- 'dev/**'
- 'fix/**'
- 'bug/**'
- 'hotfix/**'
- 'feat/**'
- 'feature/**'

jobs:
build:
if: github.event.pull_request.merged == true

runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
id: gitversion

- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Dotnet Restore
run: dotnet restore ./**.sln

- name: Build Source Projects
run: dotnet build ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release

- name: Pack NuGet Packages
run: dotnet pack ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release -o bin/nugetPackages

- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages

release:
if: needs.build.outputs.CommitsSinceVersionSource > 0
runs-on: ubuntu-latest
needs: build

steps:
- name: Download nuget package artifact
uses: actions/download-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages

- name: Create Release
uses: ncipollo/[email protected]
with:
tag: ${{ needs.build.outputs.Version }}
name: Release ${{ needs.build.outputs.Version }}
body: Released via github actions workflow, see repository README.md
generateReleaseNotes: true
artifacts: "bin/nugetPackages/*.nupkg"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Push packages to Nuget
run: |
for file in $(find bin/nugetPackages -type f -name "*.nupkg"); do
echo $file
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done
86 changes: 86 additions & 0 deletions .github/workflows/dotnet-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: PUBLISH RELEASE

on:
workflow_dispatch:

pull_request:
types: [closed]
branches: [main]

jobs:
build:
if: github.event.pull_request.merged == true

runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
id: gitversion

- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Dotnet Restore
run: dotnet restore ./**.sln

- name: Build Source Projects
run: dotnet build ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release

- name: Pack NuGet Packages
run: dotnet pack ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release -o bin/nugetPackages

- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages

release:
if: needs.build.outputs.CommitsSinceVersionSource > 0 && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build

steps:
- name: Download nuget package artifact
uses: actions/download-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages

- name: Create Release
uses: ncipollo/[email protected]
with:
tag: ${{ needs.build.outputs.Version }}
name: Release ${{ needs.build.outputs.Version }}
body: Released via github actions workflow, see repository README.md
generateReleaseNotes: true
artifacts: "bin/nugetPackages/*.nupkg"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Push packages to Nuget
run: |
for file in $(find bin/nugetPackages -type f -name "*.nupkg"); do
echo $file
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done
33 changes: 33 additions & 0 deletions .github/workflows/dotnet-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: DOTNET TEST

on:

pull_request:
types: [opened, reopened, synchronize]
branches:
- "**"

jobs:
dotnet-test:

env:
BUILD_CONFIG: 'Release'
SOLUTION: './**.sln'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Restore dependencies
run: dotnet restore $SOLUTION

- name: Build Solution
run: dotnet build $SOLUTION --no-restore

- name: Test Solution
run: dotnet test $SOLUTION --no-restore --verbosity normal
9 changes: 3 additions & 6 deletions WebLogger.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ VisualStudioVersion = 17.5.33627.172
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebLogger", "source\WebLogger\WebLogger.csproj", "{C55C9870-5C71-4928-87D9-56A476B339B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebLogger.Crestron", "source\WebLogger.Crestron\WebLogger.Crestron.csproj", "{30686F8E-CB48-4B5F-B6D1-F36ACA553930}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebLogger.Crestron", "source\WebLogger.Crestron\WebLogger.Crestron.csproj", "{30686F8E-CB48-4B5F-B6D1-F36ACA553930}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebLogger.CrestronApp", "examples\WebLogger.CrestronApp\WebLogger.CrestronApp.csproj", "{9BBF2F7E-53D0-4395-AFC9-73DEA57FCC14}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebLogger.ConsoleApp", "examples\WebLogger.ConsoleApp\WebLogger.ConsoleApp.csproj", "{510BD36C-8ADB-4E15-8757-AECDA6F50A92}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7451F827-4A16-4E7E-9E5F-4813936FE4B4}"
ProjectSection(SolutionItems) = preProject
source\Directory.Build.props = source\Directory.Build.props
README.md = README.md
EndProjectSection
EndProject
Expand All @@ -28,7 +29,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebLogger.Serilog", "source
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebLogger.Generators", "source\WebLogger.Generators\WebLogger.Generators.csproj", "{102E0DD8-91A8-440E-B76F-104D022D0C1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebLogger.Benchmarks", "tests\WebLogger.Benchmarks\WebLogger.Benchmarks.csproj", "{8C3A18B4-6AE5-48BF-85DF-ADECCF299636}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebLogger.Benchmarks", "tests\WebLogger.Benchmarks\WebLogger.Benchmarks.csproj", "{8C3A18B4-6AE5-48BF-85DF-ADECCF299636}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -45,13 +46,9 @@ Global
{30686F8E-CB48-4B5F-B6D1-F36ACA553930}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30686F8E-CB48-4B5F-B6D1-F36ACA553930}.Release|Any CPU.Build.0 = Release|Any CPU
{9BBF2F7E-53D0-4395-AFC9-73DEA57FCC14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BBF2F7E-53D0-4395-AFC9-73DEA57FCC14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BBF2F7E-53D0-4395-AFC9-73DEA57FCC14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BBF2F7E-53D0-4395-AFC9-73DEA57FCC14}.Release|Any CPU.Build.0 = Release|Any CPU
{510BD36C-8ADB-4E15-8757-AECDA6F50A92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{510BD36C-8ADB-4E15-8757-AECDA6F50A92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{510BD36C-8ADB-4E15-8757-AECDA6F50A92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{510BD36C-8ADB-4E15-8757-AECDA6F50A92}.Release|Any CPU.Build.0 = Release|Any CPU
{B3044627-698D-4E76-81CA-34EFE79C3927}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3044627-698D-4E76-81CA-34EFE79C3927}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3044627-698D-4E76-81CA-34EFE79C3927}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
1 change: 1 addition & 0 deletions examples/WebLogger.ConsoleApp/WebLogger.ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 1 addition & 5 deletions examples/WebLogger.CrestronApp/ControlSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using Serilog;
using System;
using System.Collections.Generic;
using System.Reflection;
using WebLogger.Crestron;
using WebLogger.Utilities;

Expand All @@ -18,7 +15,6 @@ public ControlSystem()
{
try
{
Thread.MaxNumberOfUserThreads = 20;
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControllerProgramEventHandler);
}
catch (Exception e)
Expand Down Expand Up @@ -53,7 +49,7 @@ public override void InitializeSystem()
{
options.Commands = commands;
options.Secured = false;
options.DestinationWebpageDirectory = Path.Combine(Directory.GetApplicationRootDirectory(), "html/logger");
options.DestinationWebpageDirectory = Crestron.SimplSharp.CrestronIO.Path.Combine(Directory.GetApplicationRootDirectory(), "html/logger");
options.WebSocketTcpPort = 54321;
},
logger =>
Expand Down
Loading

0 comments on commit bde6a9b

Please sign in to comment.