Skip to content

Commit

Permalink
Merge pull request #404 from ChaosEngine/dev
Browse files Browse the repository at this point in the history
Dev to Master merge with dotnet-8 framework upgrade
  • Loading branch information
ChaosEngine authored Jan 13, 2024
2 parents 3b90587 + 50a39d6 commit 9a76073
Show file tree
Hide file tree
Showing 89 changed files with 1,670 additions and 5,742 deletions.
18 changes: 11 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
command: |
curl -O https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb
apt update && apt install -y dotnet-sdk-7.0
apt update && apt install -y dotnet-sdk-8.0
- run:
name: Show versions
command: |
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:

Pomelo-tests:
docker:
- image: mcr.microsoft.com/dotnet/sdk:7.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
# Steps to the job
steps:
- checkout
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:

InkBall-tests:
docker:
- image: mcr.microsoft.com/dotnet/sdk:7.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
# Steps to the job
steps:
- checkout
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:

DotnetPlayground-tests:
docker:
- image: mcr.microsoft.com/dotnet/sdk:7.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
# Steps to the job
steps:
- checkout
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
command: |
curl -O https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb
apt update && apt install -y dotnet-sdk-7.0
apt update && apt install -y dotnet-sdk-8.0
- run:
name: Show versions
command: |
Expand All @@ -223,7 +223,7 @@ jobs:

build:
docker:
- image: mcr.microsoft.com/dotnet/sdk:7.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
# Steps to the job
steps:
- checkout
Expand All @@ -235,7 +235,11 @@ jobs:
- run:
name: Install node/npm
# keep an eye on the node/npm version here
command: curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
command: |
curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh
chmod 500 nsolid_setup_deb.sh
./nsolid_setup_deb.sh 20
apt-get install -y nodejs
- run:
name: "Build Application according to some given configuration"
command: dotnet publish -c Release --self-contained -r linux-x64 DotnetPlayground.Web
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name: "CodeQL"

on:
push:
branches: [ master, dev, dotnet-7 ]
branches: [ master, dev, dotnet-8 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.x'
dotnet-version: '8.x'

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
- dev
- dotnet-7
- dotnet-8

jobs:
build:
Expand All @@ -19,14 +19,14 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Build with dotnet
env:
DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2
run: dotnet build --configuration Release
- name: Test with dotnet
env:
DBKind: "sqlite"
ConnectionStrings__Sqlite: "Filename=./bin/Debug/net7.0/Blogging.db"
ConnectionStrings__Sqlite: "Filename=./bin/Debug/net8.0/Blogging.db"
DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2
run: dotnet test -v m --configuration Debug
2 changes: 1 addition & 1 deletion .github/workflows/trivy-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Trivy scan
on:
push:
branches: [ master, dev, dotnet-7 ]
branches: [ master, dev, dotnet-8 ]
pull_request:
jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/DotnetPlayground.Web/bin/Debug/net7.0/DotnetPlayground.Web.dll",
"program": "${workspaceFolder}/DotnetPlayground.Web/bin/Debug/net8.0/DotnetPlayground.Web.dll",
"args": [],
"cwd": "${workspaceFolder}/DotnetPlayground.Web",
"stopAtEntry": false,
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"eslint.enable": true,
"eslint.nodePath": "DotnetPlayground.Web/node_modules",
"eslint.options": { "overrideConfigFile": "DotnetPlayground.Web/package.json" },
"eslint.validate": [ "javascript" ]
"eslint.validate": [ "javascript" ],
"dotnet.defaultSolution": "Dotnet-Playground.sln"
}
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
{
"label": "publish",
"windows": {
"command": "dotnet publish -c Release -r win-x64 --self-contained -p:PublishTrimmed=true -p:ShowLinkerSizeComparison=true -p:CrossGenDuringPublish=false DotnetPlayground.Web"
"command": "dotnet publish -c Release -r win-x64 --self-contained -p:ShowLinkerSizeComparison=true -p:CrossGenDuringPublish=false DotnetPlayground.Web"
},
"linux": {
"command": "dotnet publish -c Release -r linux-x64 --self-contained -p:PublishTrimmed=true -p:ShowLinkerSizeComparison=true -p:CrossGenDuringPublish=false DotnetPlayground.Web"
"command": "dotnet publish -c Release -r linux-x64 --self-contained -p:ShowLinkerSizeComparison=true -p:CrossGenDuringPublish=false DotnetPlayground.Web"
},
"type": "shell",
"presentation": {
Expand Down
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# syntax = docker/dockerfile:experimental
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
RUN --mount=type=cache,target=/root/.nuget --mount=type=cache,target=/root/.local/share/NuGet --mount=type=cache,target=/root/.npm/ --mount=type=cache,target=./DotnetPlayground.Web/node_modules
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
RUN curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh && \
chmod 500 nsolid_setup_deb.sh && \
./nsolid_setup_deb.sh 20 && \
apt-get install -y nodejs
WORKDIR /build

ENV DBKind="sqlite" ConnectionStrings__Sqlite="Filename=./bin/Debug/net7.0/Blogging.db"
ENV DBKind="sqlite" ConnectionStrings__Sqlite="Filename=./bin/Debug/net8.0/Blogging.db"
ARG SOURCE_COMMIT
ARG SOURCE_BRANCH
ARG BUILD_CONFIG=${BUILD_CONFIG:-Release}
Expand All @@ -25,24 +28,24 @@ COPY . .
RUN sed -i -e "s/GIT_HASH/$SOURCE_COMMIT/g" -e "s/GIT_BRANCH/$SOURCE_BRANCH/g" DotnetPlayground.Web/wwwroot/js/site.js
RUN dotnet test --no-restore -v m
RUN dotnet publish --no-restore -c $BUILD_CONFIG --self-contained -r linux-x64 \
-p:PublishTrimmed=true \
#-p:PublishTrimmed=true \
DotnetPlayground.Web





FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-bullseye-slim
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-bookworm-slim
WORKDIR /app
ENV USER=nobody TZ=Europe/Warsaw ASPNETCORE_URLS=http://+:5000
ENV USER=nobody TZ=Europe/Warsaw
ARG BUILD_CONFIG=${BUILD_CONFIG:-Release}
COPY --from=build --chown="$USER":"$USER" /build/DotnetPlayground.Web/bin/$BUILD_CONFIG/net7.0/linux-x64/publish/ /build/startApp.sh ./
COPY --from=build --chown="$USER":"$USER" /build/DotnetPlayground.Web/bin/$BUILD_CONFIG/net8.0/linux-x64/publish/ /build/startApp.sh ./

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

USER "$USER"

VOLUME /shared
EXPOSE 5000
EXPOSE 8080

ENTRYPOINT ["./DotnetPlayground.Web"]
18 changes: 9 additions & 9 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# syntax = docker/dockerfile:experimental
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
RUN --mount=type=cache,target=/root/.nuget --mount=type=cache,target=/root/.local/share/NuGet --mount=type=cache,target=/root/.npm/ --mount=type=cache,target=./DotnetPlayground.Web/node_modules
RUN apk add --update nodejs npm
WORKDIR /build

ENV DBKind="sqlite" ConnectionStrings__Sqlite="Filename=./bin/Debug/net7.0/Blogging.db"
ENV DBKind="sqlite" ConnectionStrings__Sqlite="Filename=./bin/Debug/net8.0/Blogging.db"
ARG SOURCE_COMMIT
ARG SOURCE_BRANCH
ARG BUILD_CONFIG=${BUILD_CONFIG:-Release}
Expand All @@ -19,31 +19,31 @@ COPY ./IdentityManager2/src/IdentityManager2/IdentityManager2.csproj ./IdentityM
COPY ./IdentityManager2/src/IdentityManager2/Assets/ ./IdentityManager2/src/IdentityManager2/Assets/
COPY ./DotnetPlayground.Web/DotnetPlayground.Web.csproj ./DotnetPlayground.Web/DotnetPlayground.Web.csproj
COPY ./*.sln ./NuGet.config ./
RUN dotnet restore -r alpine-x64
RUN dotnet restore -r linux-musl-x64

COPY . .
RUN sed -i -e "s/GIT_HASH/$SOURCE_COMMIT/g" -e "s/GIT_BRANCH/$SOURCE_BRANCH/g" DotnetPlayground.Web/wwwroot/js/site.js
RUN dotnet test --no-restore -v m
RUN dotnet publish --no-restore -c $BUILD_CONFIG --self-contained -r alpine-x64 \
-p:PublishTrimmed=true \
RUN dotnet publish --no-restore -c $BUILD_CONFIG --self-contained -r linux-musl-x64 \
#-p:PublishTrimmed=true \
DotnetPlayground.Web





FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
RUN apk add tzdata
WORKDIR /app
ENV USER=nobody TZ=Europe/Warsaw ASPNETCORE_URLS=http://+:5000
ENV USER=nobody TZ=Europe/Warsaw
ARG BUILD_CONFIG=${BUILD_CONFIG:-Release}
COPY --from=build --chown="$USER":"$USER" /build/DotnetPlayground.Web/bin/$BUILD_CONFIG/net7.0/alpine-x64/publish/ /build/startApp.sh ./
COPY --from=build --chown="$USER":"$USER" /build/DotnetPlayground.Web/bin/$BUILD_CONFIG/net8.0/linux-musl-x64/publish/ /build/startApp.sh ./

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

USER "$USER"

VOLUME /shared
EXPOSE 5000
EXPOSE 8080

ENTRYPOINT ["./DotnetPlayground.Web"]
2 changes: 1 addition & 1 deletion DotnetPlayground.Tests/BlogsControllersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public async Task CreatePost()
BlogId = 1,
Title = "Ok, here's one...",
Content = @"At a company that I used to work for, the CEO's brother was the
""system operator"".It was his job to do backups, maintentance,
""system operator"".It was his job to do backups, maintenance,
etc.Problem was, he didn't have a clue about Unix. We were re-
quired to go through him to do anything, though."
};
Expand Down
20 changes: 10 additions & 10 deletions DotnetPlayground.Tests/DotnetPlayground.Tests.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>
<LangVersion>latest</LangVersion>

<IsPackable>false</IsPackable>
Expand All @@ -10,21 +10,21 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion DotnetPlayground.Tests/HashesControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ internal static Moq.Mock<IHashesRepository> MockHashesRepository()
{
var found = hashes.Where(h =>
h.HashMD5.ToLowerInvariant().StartsWith(s) || h.HashSHA256.ToLowerInvariant().StartsWith(s) || h.Key.ToLowerInvariant().StartsWith(s))
.DefaultIfEmpty(new ThinHashes { Key = "nothing found" });
.DefaultIfEmpty(new ThinHashes { Key = "nothing found" }).ToList();

return Task.FromResult(found);
});
Expand Down
6 changes: 3 additions & 3 deletions DotnetPlayground.Tests/HashesRepositoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public async Task Paging_lots_of_elements(int itemsCount)
}
}));
}
Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
await repository.SaveAsync();
}

Expand Down Expand Up @@ -293,7 +293,7 @@ public async Task Paging_lots_of_elements(int itemsCount)
}
}));
}
Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
await repository.SaveAsync();
}

Expand Down Expand Up @@ -350,7 +350,7 @@ public async Task CalculateHashesInfo()

}));
}
Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
await repository.SaveAsync();
}

Expand Down
Loading

0 comments on commit 9a76073

Please sign in to comment.