Skip to content

Commit

Permalink
Merge pull request #54 from dragonfruitnetwork/net8
Browse files Browse the repository at this point in the history
Upgrade to .NET 8
  • Loading branch information
aspriddell authored Dec 18, 2023
2 parents b71bb0e + b134c03 commit 4706577
Show file tree
Hide file tree
Showing 39 changed files with 229 additions and 330 deletions.
12 changes: 6 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"version": 1,
"isRoot": true,
"tools": {
"nvika": {
"version": "3.0.0",
"jetbrains.resharper.globaltools": {
"version": "2023.3.1",
"commands": [
"nvika"
"jb"
]
},
"jetbrains.resharper.globaltools": {
"version": "2022.1.2",
"nvika": {
"version": "3.0.0",
"commands": [
"jb"
"nvika"
]
}
}
Expand Down
29 changes: 16 additions & 13 deletions .github/workflows/codequality.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
name: Code Quality

on:
pull_request: { }
pull_request:
branches: master
push:
branches:
- master
branches: master

env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: false

jobs:
quality:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install .NET
uses: actions/setup-dotnet@v1
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore Tools
run: dotnet tool restore

- name: Restore Packages
run: dotnet restore

- name: Run InspectCode
run: dotnet jb inspectcode ${{github.workspace}}/DragonFruit.Sakura.sln --exclude="**/wwwroot/**.*" --exclude="**/*.razor" --output=${{github.workspace}}/inspectcodereport.xml --cachesDir=${{github.workspace}}/inspectcode --verbosity=WARN --no-build
- name: InspectCode
run: dotnet jb inspectcode DragonFruit.Sakura.sln --exclude="**/wwwroot/**.*" --exclude="**/*.razor" --output=inspectcodereport.xml --cachesDir=inspectcode --verbosity=WARN --no-build

- name: Run NVika
run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml"
- name: NVika
run: dotnet nvika parsereport inspectcodereport.xml
81 changes: 28 additions & 53 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
release:
types: [ published ]

permissions:
contents: write

env:
build-output: sakura-publish

Expand All @@ -19,7 +16,7 @@ jobs:
url: https://dragonfruit.network/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -33,59 +30,33 @@ jobs:
ignore_missing: true
version: ${{ github.ref_name }}

linux-container:
website-package:
runs-on: ubuntu-latest

needs:
- sentry-release

environment:
name: production
url: https://dragonfruit.network/

permissions:
packages: write

steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create build output folder
run: mkdir ${{ env.build-output }}

- name: Restore NuGet Packages
run: dotnet restore

- name: Build Project
run: dotnet publish -c Release -o ${{ env.build-output }} -p:Version=${{ github.ref_name }} DragonFruit.Sakura.Host/DragonFruit.Sakura.Host.csproj

- id: meta
name: Create metadata
uses: docker/metadata-action@v4
with:
images: dragonfruitdotnet/website
tags: |
type=raw,value=latest
type=ref,event=tag
- name: Dockerise
uses: docker/build-push-action@v3
with:
push: true
context: ${{ env.build-output }}
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
file: DragonFruit.Sakura.Host/Dockerfile
dotnet-version: '8.0.x'

- name: Build Program
run: dotnet publish -c Release -p:Version=${{ github.event.release.tag_name }} DragonFruit.Sakura

- name: Package Output
run: dotnet pack -c Release -p:Version=${{ github.event.inputs.version }} -o ./packages --no-build DragonFruit.Sakura

- name: Upload Package
run: dotnet nuget push -s https://nuget.pkg.github.com/dragonfruitnetwork/index.json -k ${{ github.token }} ./packages/*.nupkg

windows-iis:
runs-on: windows-latest

permissions:
contents: write

needs:
- sentry-release

Expand All @@ -94,14 +65,18 @@ jobs:
url: https://dragonfruit.network/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Build Program
run: dotnet publish -c Release -p:Version=${{ github.ref_name }} -p:PublishProfile=Web.pubxml DragonFruit.Sakura.Host
run: dotnet publish -c Release -p:Version=${{ github.event.release.tag_name }} -p:PublishProfile=Web.pubxml DragonFruit.Sakura.Host

- name: Archive Output
run: Compress-Archive -Path .\DragonFruit.Sakura.Host\bin\publish\* -DestinationPath Sakura-${{ github.ref_name }}.zip
run: Compress-Archive -Path .\DragonFruit.Sakura.Host\bin\publish\* -DestinationPath Sakura-${{ github.event.release.tag_name }}.zip

- name: Upload Deploy Package
uses: softprops/action-gh-release@v1
with:
files: Sakura-${{ github.ref_name }}.zip
files: Sakura-${{ github.event.release.tag_name }}.zip
8 changes: 0 additions & 8 deletions DragonFruit.Sakura.Host/Dockerfile

This file was deleted.

8 changes: 4 additions & 4 deletions DragonFruit.Sakura.Host/DragonFruit.Sakura.Host.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
Expand All @@ -11,9 +11,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.11" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" />
<PackageReference Include="Sentry.Extensions.Logging" Version="3.41.3" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions DragonFruit.Sakura.Host/Host.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@@fortawesome/[email protected]/css/all.min.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-utilities.min.css"/>

<script src="https://cdn.jsdelivr.net/npm/prismjs@1.26.0/prism.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-csharp.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-cshtml.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-csharp.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-cshtml.min.js" defer></script>

<script src="~/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
</head>
Expand Down
37 changes: 19 additions & 18 deletions DragonFruit.Sakura.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using MudBlazor.Services;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
using Sentry;

namespace DragonFruit.Sakura.Host
{
public static class Program
{
public static async Task Main(string[] args)
public static Task Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);

Expand All @@ -27,21 +25,24 @@ public static async Task Main(string[] args)
// enable _content files
builder.WebHost.UseStaticWebAssets();

builder.Logging.ClearProviders();
builder.Logging.AddSerilog(new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console(theme: AnsiConsoleTheme.Literate)
.WriteTo.Sentry(o =>
{
o.Dsn = builder.Configuration["Sentry:Dsn"];
builder.Logging.ClearProviders()
.AddSimpleConsole(o =>
{
o.SingleLine = true;
o.IncludeScopes = false;
o.TimestampFormat = "[dd/MM/yyyy hh:mm:ss] ";
})
.AddSentry(o =>
{
o.Dsn = builder.Configuration["Sentry:Dsn"];
o.Release = Assembly.GetExecutingAssembly().GetName().Version!.ToString(3);
o.MaxBreadcrumbs = 50;
o.MinimumEventLevel = LogEventLevel.Error;
o.MinimumBreadcrumbLevel = LogEventLevel.Debug;
o.MaxBreadcrumbs = 50;
o.MinimumEventLevel = LogLevel.Error;
o.MinimumBreadcrumbLevel = LogLevel.Debug;
var version = Assembly.GetExecutingAssembly().GetName().Version;
o.Release = version?.ToString(version.Build > 0 ? 3 : 2);
}).CreateLogger(), true);
o.DisableUnobservedTaskExceptionCapture();
});

builder.Services.AddApiAuthorization();
builder.Services.AddHttpContextAccessor();
Expand All @@ -62,7 +63,7 @@ public static async Task Main(string[] args)
app.MapFallbackToController("Host", "Blazor");
app.MapFallbackToController("/changelogs/{app}/{version}", "Host", "Blazor");

await app.RunAsync().ConfigureAwait(false);
return app.RunAsync();
}
}
}
1 change: 1 addition & 0 deletions DragonFruit.Sakura.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ Licensed under GNU AGPLv3. Refer to the LICENSE file for more info</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD5</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MMR/@EntryIndexedValue">MMR</s:String>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
1 change: 1 addition & 0 deletions DragonFruit.Sakura/Administration/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using DragonFruit.Sakura.Network
@layout AdminLayout

<PageTitle>Admin &middot; DragonFruit Network</PageTitle>
<MudContainer MaxWidth="MaxWidth.Large">
<MudStack>
<MudPaper Elevation="0" Class="p-4">
Expand Down
26 changes: 15 additions & 11 deletions DragonFruit.Sakura/DragonFruit.Sakura.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>true</IsPackable>
</PropertyGroup>

<PropertyGroup>
<Title>DragonFruit Sakura</Title>
<Authors>DragonFruit Network</Authors>
<Copyright>Copyright (c) DragonFruit Network</Copyright>
<Description>The face of DragonFruit Network</Description>
</PropertyGroup>

<PropertyGroup>
<PackageIcon>icon.png</PackageIcon>
<PackageId>DragonFruit.Sakura</PackageId>
Expand All @@ -15,16 +22,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DragonFruit.Data" Version="2023.727.0" />
<PackageReference Include="DragonFruit.Data.Serializers.SystemJson" Version="2023.727.0" />
<PackageReference Include="Markdig" Version="0.33.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.11" />
<PackageReference Include="MudBlazor" Version="6.1.9" />
<PackageReference Include="Sentry.Serilog" Version="3.39.1" />
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.BrowserConsole" Version="1.0.0" />
<PackageReference Include="DragonFruit.Data" Version="0.9.3-beta" />
<PackageReference Include="DragonFruit.Data.Roslyn" Version="0.9.3-beta" PrivateAssets="all" />
<PackageReference Include="Markdig" Version="0.34.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.0" />
<PackageReference Include="MudBlazor" Version="6.11.1" />
<PackageReference Include="Sentry.Extensions.Logging" Version="3.41.3" />
<PackageReference Include="SharpYaml" Version="2.1.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

namespace DragonFruit.Sakura.Network.Requests
{
public class AdminApiAppsListingRequest : YunaApiRequest
public partial class AdminApiAppsListingRequest : YunaApiRequest
{
protected override string Stub => "/apps";
protected override bool RequireAuth => true;

protected internal override bool RequiresAuthentication => true;
}
}
Loading

0 comments on commit 4706577

Please sign in to comment.