Skip to content

Commit

Permalink
Merge pull request #1335 from qdraw/feature/202401_net8
Browse files Browse the repository at this point in the history
Feature/202401 net8
  • Loading branch information
qdraw authored Jan 22, 2024
2 parents b0431b7 + 0a001a3 commit 59859cd
Show file tree
Hide file tree
Showing 217 changed files with 1,844 additions and 1,295 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/auto-update-swagger-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.417
dotnet-version: 8.0.101

- name: Cache nuget packages (*nix)
uses: actions/cache@v4
Expand Down Expand Up @@ -57,24 +57,26 @@ jobs:

- name: Copy
shell: bash
run: cp starsky/starsky/bin/Debug/net6.0/temp/starsky.json documentation/static/openapi/openapi.json
run: cp starsky/starsky/bin/Debug/net*.0/temp/starsky.json documentation/static/openapi/openapi.json

- name: Generate swagger
shell: bash
working-directory: ./documentation
run: node scripts/openapi.js

- name: Commit changes
- name: Commit changes openapi.json (if push to branch)
uses: EndBug/add-and-commit@v9
if: github.event_name != 'pull_request'
with:
author_name: SwaggerUpdateBot
author_email: qdraw@users.noreply.github.com
message: "[Swagger] Auto commited swagger/openapi list"
add: "documentation/static/openapi/openapi.json"
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Commit changes
- name: Commit changes docs/api/readme.md (if push to branch)
uses: EndBug/add-and-commit@v9
if: github.event_name != 'pull_request'
with:
author_name: SwaggerUpdateBot
author_email: qdraw@users.noreply.github.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.417
dotnet-version: 8.0.101

- name: Build --no-unit-test linux-arm,linux-arm64,win-x64,osx-x64,linux-x64
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/starsky-codecov-clientapp-netcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.417
dotnet-version: 8.0.101

- name: Cache node modules clientapp (*nix)
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/starsky-dotnetcore-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.417
dotnet-version: 8.0.101

- name: Cache nuget packages (*nix)
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/starsky-dotnetcore-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.417
dotnet-version: 8.0.101

- name: Build (Windows)
shell: pwsh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/starsky-sonarqube-clientapp-netcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.417
dotnet-version: 8.0.101

- name: Use Java 17
uses: actions/setup-java@v4
Expand Down
2 changes: 1 addition & 1 deletion documentation/documentation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- not needed to scan -->
Expand Down
4 changes: 2 additions & 2 deletions pipelines/azure/steps/use_dotnet_version.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.0.417'
displayName: 'Use .NET Core sdk 8.0.101'
enabled: true
inputs:
packageType: sdk
version: 6.0.417
version: 8.0.101
installationPath: $(Agent.ToolsDirectory)/dotnet
2 changes: 2 additions & 0 deletions starsky-tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
create-docusaurus-tmp-folder/**

19 changes: 16 additions & 3 deletions starsky-tools/build-tools/dotnet-sdk-version-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { getFiles } = require("./lib/get-files-directory");
const { prefixPath } = require("./lib/prefix-path.const.js");
const { httpsGet } = require("./lib/https-get.js");

let newRunTimeVersion = "6.0.x";
let newRunTimeVersion = "8.0.x";

// https://docs.microsoft.com/en-us/dotnet/standard/frameworks

Expand Down Expand Up @@ -84,7 +84,7 @@ getLatestDotnetRelease().then((newTargetVersion) => {
await addReferencedProjectMonikers(frameworkMonikerByPath);

const sortedFrameworkMonikerByPath =
await sortNetFrameworkMoniker(refFrameworkMonikerByPath);
await sortNetFrameworkMoniker(refFrameworkMonikerByPath, newTargetVersion);

await updateNetFrameworkMoniker(sortedFrameworkMonikerByPath);

Expand Down Expand Up @@ -561,7 +561,7 @@ async function addReferencedProjectMonikers(frameworkMonikerByPath) {
return frameworkMonikerByPath;
}

async function sortNetFrameworkMoniker(frameworkMonikerByPath) {
async function sortNetFrameworkMoniker(frameworkMonikerByPath, newTargetVersionAsFallback) {
// references
for (let [filePath, netMonikers] of Object.entries(
frameworkMonikerByPath
Expand All @@ -572,6 +572,14 @@ async function sortNetFrameworkMoniker(frameworkMonikerByPath) {
// console.log(filePath + ' referencedProjectPaths')
// console.log(referencedProjectPaths)

if (referencedProjectPaths.length === 0) {
const netMonikerFallback = "net" + newTargetVersionAsFallback.match(/^\d\.\d/ig,"")[0];
frameworkMonikerByPath[filePath].push(netMonikerFallback);
console.log(
`🎁 ${filePath} - is using default ${netMonikerFallback}`
);
}

for (const refPath of referencedProjectPaths) {
for (const netMoniker of netMonikers) {
if (!frameworkMonikerByPath[refPath]) {
Expand Down Expand Up @@ -702,6 +710,11 @@ async function updateNetFrameworkMoniker(sortedFrameworkMonikerByPath) {
}
usedTargetFrameworkMonikers[filePath].push(lastNet);
}
else {
console.log(
`❌ ✖ ${filePath} - is skipped to ${usedTargetFrameworkMonikers}`
);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion starsky-tools/socket/ChannelWSClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
28 changes: 14 additions & 14 deletions starsky/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN echo "react done"

# no alpine build since there is no support for multi-arch
# docker buildx imagetools inspect mcr.microsoft.com/dotnet/sdk:6.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
ARG BUILDPLATFORM
ARG TARGETPLATFORM
# insert demo user and content
Expand Down Expand Up @@ -112,7 +112,7 @@ RUN if [ "$TEST" = "true" ]; then \

# build runtime image (multiarch)
# docker buildx imagetools inspect mcr.microsoft.com/dotnet/aspnet:6.0
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS release
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS release
WORKDIR /app
ARG TOOLS=false

Expand All @@ -126,31 +126,31 @@ else \
fi

# Create a group and user
RUN groupadd --gid 1000 app \
&& useradd --uid 1000 --gid app --shell /bin/bash --create-home app
RUN groupadd --gid 1000 starsky \
&& useradd --uid 1000 --gid starsky --shell /bin/bash --create-home starsky

# copy dlls
COPY --chown=app:app --from=build-env /app/starsky/out /app
COPY --chown=starsky:starsky --from=build-env /app/starsky/out /app

# copy dependencies & demo content
COPY --chown=app:app --from=build-env /app/dependencies /app/dependencies
COPY --chown=app:app --from=build-env /app/temp /app/temp
COPY --chown=app:app --from=build-env /app/data.db /app/app__data.db
COPY --chown=starsky:starsky --from=build-env /app/dependencies /app/dependencies
COPY --chown=starsky:starsky --from=build-env /app/temp /app/temp
COPY --chown=starsky:starsky --from=build-env /app/data.db /app/app__data.db

# copy react build
COPY --chown=app:app --from=react-build /app/starsky/clientapp ./clientapp
COPY --chown=starsky:starsky --from=react-build /app/starsky/clientapp ./clientapp

# Makes sure the test stage is run when using docker buildkit
COPY --chown=app:app --from=test /testresults /tmp
COPY --chown=starsky:starsky --from=test /testresults /tmp

# you could mount this location
RUN mkdir -p /app/photos && chown app:app /app/photos
RUN mkdir -p /app/thumbnailTempFolder && chown app:app /app/thumbnailTempFolder
RUN mkdir -p /app/photos && chown starsky:starsky /app/photos
RUN mkdir -p /app/thumbnailTempFolder && chown starsky:starsky /app/thumbnailTempFolder

# and change owner of folder
RUN chown app:app /app
RUN chown starsky:starsky /app

USER app
USER starsky

ENV ASPNETCORE_Environment=Production
ENTRYPOINT ["dotnet", "starsky.dll"]
14 changes: 8 additions & 6 deletions starsky/build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ void ShowSettingsInfo()

ShowSettingsInfo();
DotnetRuntimeSpecificHelper.Clean(GetRuntimesWithoutGeneric());
DotnetRuntimeSpecificHelper.RestoreNetCoreCommand(Solution,
GetRuntimesWithoutGeneric());
DotnetRuntimeSpecificHelper.BuildNetCoreCommand(Solution,
GetRuntimesWithoutGeneric(),Configuration);
DotnetRuntimeSpecificHelper.PublishNetCoreGenericCommand(Solution,
GetRuntimesWithoutGeneric(),Configuration);

foreach ( var runtime in GetRuntimesWithoutGeneric() )
{
DotnetRuntimeSpecificHelper.RestoreNetCoreCommand(Solution, runtime);
DotnetRuntimeSpecificHelper.BuildNetCoreCommand(Solution, Configuration, runtime);
DotnetRuntimeSpecificHelper.PublishNetCoreGenericCommand(Configuration, runtime);
}

DotnetRuntimeSpecificHelper.CopyDependenciesFiles(NoDependencies,
"generic-netcore",GetRuntimesWithoutGeneric());

Expand Down
9 changes: 6 additions & 3 deletions starsky/build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace />
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<!-- https://github.com/nuke-build/nuke/issues/818 -->
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0" />
<PackageReference Include="Nuke.Common" Version="7.0.6" />
<PackageReference Include="ReportGenerator.Core" Version="5.1.13" />
<PackageReference Include="ReportGenerator.Core" Version="5.2.0" />
<PackageReference Include="SimpleExec" Version="11.0.0" />
</ItemGroup>

Expand Down
22 changes: 6 additions & 16 deletions starsky/build/helpers/DotnetGenericHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using build;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static build.Build;
Expand All @@ -12,24 +13,20 @@ public static class DotnetGenericHelper
{
public static void RestoreNetCoreCommand(Solution solution)
{
ProjectAssetsCopier.CopyAssetFileToCurrentRuntime(GenericRuntimeName, solution);
DotNetRestore(_ => _
.SetProjectFile(solution));
ProjectAssetsCopier.CopyNewAssetFileByRuntimeId(GenericRuntimeName, solution);
Console.WriteLine("solution: " + solution);
DotNetRestore(p => p
.SetProjectFile(solution.Path)
);
}

public static void BuildNetCoreGenericCommand(Solution solution,
Configuration configuration)
{
ProjectAssetsCopier.CopyAssetFileToCurrentRuntime(GenericRuntimeName, solution);

DotNetBuild(_ => _
.SetConfiguration(configuration)
.EnableNoRestore()
.EnableNoLogo()
.SetProjectFile(solution));

ProjectAssetsCopier.CopyNewAssetFileByRuntimeId(GenericRuntimeName, solution);
}

/// <summary>
Expand All @@ -49,9 +46,7 @@ public static void DownloadDependencies(Solution solution,
Console.WriteLine("skip --no-dependencies");
return;
}

ProjectAssetsCopier.CopyAssetFileToCurrentRuntime(GenericRuntimeName, solution);


var genericDepsFullPath = Path.Combine(BasePath(), genericNetcoreFolder, "dependencies");
Console.WriteLine($"genericDepsFullPath: {genericDepsFullPath}");

Expand All @@ -75,7 +70,6 @@ public static void DownloadDependencies(Solution solution,
}

Environment.SetEnvironmentVariable("app__DependenciesFolder", string.Empty);
ProjectAssetsCopier.CopyNewAssetFileByRuntimeId(GenericRuntimeName, solution);

Console.WriteLine($" genericDepsFullPath: {genericDepsFullPath}");
Console.WriteLine("DownloadDependencies done");
Expand All @@ -90,8 +84,6 @@ public static void PublishNetCoreGenericCommand(Solution solution,
return;
}

ProjectAssetsCopier.CopyAssetFileToCurrentRuntime(GenericRuntimeName, solution);

foreach ( var publishProject in PublishProjectsList )
{
var publishProjectFullPath = Path.Combine(
Expand All @@ -107,12 +99,10 @@ public static void PublishNetCoreGenericCommand(Solution solution,
.EnableNoRestore()
.EnableNoBuild()
.EnableNoDependencies()
.EnableSelfContained()
.SetOutput(outputFullPath)
.SetProject(publishProjectFullPath)
.EnableNoLogo());
}
ProjectAssetsCopier.CopyNewAssetFileByRuntimeId(GenericRuntimeName, solution);
}

static string BasePath()
Expand Down
Loading

0 comments on commit 59859cd

Please sign in to comment.