diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 467a1fc7..f94e83ae 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -256,21 +256,30 @@ jobs: - name: console (linux-aot-chiseled) if: runner.os == 'Linux' && (success() || failure()) run: docker build -t console -f src/FrameworkTests/AotConsole/Dockerfiles/linux-aot-chiseled . && docker run --rm -t console - - name: console (windows) + - name: console (servercore) if: runner.os == 'Windows' && (success() || failure()) - run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows" windows && docker build -t console -f windows . && docker run --rm -t console - - name: console (windows-aot) + run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-servercore" windows-servercore && docker build -t console -f windows-servercore . && docker run --rm -t console + - name: console (servercore-aot) if: runner.os == 'Windows' && (success() || failure()) - run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-aot" windows-aot && docker build -t console -f windows . && docker run --rm -t console + run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-servercore-aot" windows-servercore-aot && docker build -t console -f windows-servercore-aot . && docker run --rm -t console + - name: console (nanoserver) + if: runner.os == 'Windows' && (success() || failure()) + run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-nanoserver" windows-nanoserver && docker build -t console -f windows-nanoserver . && docker run --rm -t console + - name: console (nanoserver-aot) + if: runner.os == 'Windows' && (success() || failure()) + run: xcopy /y "src\FrameworkTests\AotConsole\Dockerfiles\windows-nanoserver-aot" windows-nanoserver-aot && docker build -t console -f windows-nanoserver-aot . && docker run --rm -t console - name: docker system prune if: success() || failure() run: docker system prune -a -f - name: unittests (linux) if: runner.os == 'Linux' && (success() || failure()) run: docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f src/Tests/Dockerfiles/linux . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests - - name: unittests (windows) + - name: unittests (servercore) + if: runner.os == 'Windows' && (success() || failure()) + run: xcopy /y "src\Tests\Dockerfiles\windows-servercore" windows-servercore && docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f windows-servercore . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests + - name: unittests (nanoserver) if: runner.os == 'Windows' && (success() || failure()) - run: xcopy /y "src\Tests\Dockerfiles\windows" windows && docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f windows . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests + run: xcopy /y "src\Tests\Dockerfiles\windows-nanoserver" windows-nanoserver && docker build -t unittests --build-arg TARGET_FRAMEWORK=net8.0 -f windows-nanoserver . && docker run --rm --mount type=bind,source=${{ github.workspace }}/src/Tests,target=/app/TestResults -t unittests - name: Upload test results if: success() || failure() uses: actions/upload-artifact@main diff --git a/windows b/src/FrameworkTests/AotConsole/Dockerfiles/windows-nanoserver similarity index 100% rename from windows rename to src/FrameworkTests/AotConsole/Dockerfiles/windows-nanoserver diff --git a/src/FrameworkTests/AotConsole/Dockerfiles/windows-nanoserver-aot b/src/FrameworkTests/AotConsole/Dockerfiles/windows-nanoserver-aot new file mode 100644 index 00000000..8fff9507 --- /dev/null +++ b/src/FrameworkTests/AotConsole/Dockerfiles/windows-nanoserver-aot @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-ltsc2022 AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["src/FrameworkTests/AotConsole/AotConsole.csproj", "src/FrameworkTests/AotConsole/AotConsole.csproj"] +COPY ["src/PDFtoImage", "src/PDFtoImage"] +RUN dotnet restore "./src/FrameworkTests/AotConsole/AotConsole.csproj" /p:TargetFramework=net8.0 +COPY . . +WORKDIR "/src/src" +RUN dotnet build "./FrameworkTests/AotConsole/AotConsole.csproj" -c %BUILD_CONFIGURATION% -o /app/build --no-restore + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./FrameworkTests/AotConsole/AotConsole.csproj" -c %BUILD_CONFIGURATION% -o /app/publish --no-restore + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["PDFtoImage.FrameworkTests.AotConsole.exe"] \ No newline at end of file diff --git a/src/FrameworkTests/AotConsole/Dockerfiles/windows b/src/FrameworkTests/AotConsole/Dockerfiles/windows-servercore similarity index 100% rename from src/FrameworkTests/AotConsole/Dockerfiles/windows rename to src/FrameworkTests/AotConsole/Dockerfiles/windows-servercore diff --git a/src/FrameworkTests/AotConsole/Dockerfiles/windows-aot b/src/FrameworkTests/AotConsole/Dockerfiles/windows-servercore-aot similarity index 100% rename from src/FrameworkTests/AotConsole/Dockerfiles/windows-aot rename to src/FrameworkTests/AotConsole/Dockerfiles/windows-servercore-aot diff --git a/src/Tests/Dockerfiles/windows-nanoserver b/src/Tests/Dockerfiles/windows-nanoserver new file mode 100644 index 00000000..214b5e39 --- /dev/null +++ b/src/Tests/Dockerfiles/windows-nanoserver @@ -0,0 +1,22 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2022 AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build +ARG BUILD_CONFIGURATION=Release +ARG TARGET_FRAMEWORK=net8.0 +WORKDIR /src +COPY ["src/Tests/Tests.csproj", "src/Tests/Tests.csproj"] +COPY ["src/PDFtoImage", "src/PDFtoImage"] +RUN dotnet restore "./src/Tests/Tests.csproj" /p:TargetFramework=%TARGET_FRAMEWORK% +COPY . . +WORKDIR "/src/src" +RUN dotnet build "./Tests/Tests.csproj" -c %BUILD_CONFIGURATION% -o /app/build/%TARGET_FRAMEWORK% --no-restore -f %TARGET_FRAMEWORK% + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./Tests/Tests.csproj" -c %BUILD_CONFIGURATION% -o /app/publish --no-restore -f %TARGET_FRAMEWORK% + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "test", "publish/PDFtoImage.Tests.dll", "/logger:console;verbosity=detailed", "/logger:trx;verbosity=detailed"] \ No newline at end of file diff --git a/src/Tests/Dockerfiles/windows b/src/Tests/Dockerfiles/windows-servercore similarity index 100% rename from src/Tests/Dockerfiles/windows rename to src/Tests/Dockerfiles/windows-servercore