Skip to content

Commit

Permalink
Made tests work correctly in the dotnet sdk 7.0 dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardCooke committed Aug 23, 2023
1 parent e1986a4 commit 5df001d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.git
Dockerfile.NonEnglish
Dockerfile
Dockerfile
bin
obj
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt install -y wget
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install -y dotnet-sdk-3.1
RUN apt install -y dotnet-sdk-3.1 dotnet-sdk-6.0

FROM builder AS build
WORKDIR /src
Expand Down Expand Up @@ -46,10 +46,9 @@ RUN dotnet build -c Release --framework net70 YamlDotNet/YamlDotNet.csproj -o /o

RUN dotnet pack -c Release YamlDotNet/YamlDotNet.csproj -o /output/package /p:Version=$PACKAGE_VERSION

RUN dotnet test -c Release YamlDotNet.sln --framework net70 --logger:"trx;LogFileName=/output/tests.net60.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.sln --framework net60 --logger:"trx;LogFileName=/output/tests.net60.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net70 --logger:"trx;LogFileName=/output/tests.net70.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net60 --logger:"trx;LogFileName=/output/tests.net60.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework netcoreapp3.1 --logger:"trx;LogFileName=/output/tests.netcoreapp3.1.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net47 --logger:"trx;LogFileName=/output/tests.net47.trx" --logger:"console;Verbosity=detailed"

FROM alpine
VOLUME /output
Expand Down
10 changes: 4 additions & 6 deletions Dockerfile.NonEnglish
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ RUN apt update && \
apt-transport-https \
gnupg \
ca-certificates \
curl \
locales
curl

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# yes, we're using the bullseye (debian 11) image, however mono only has buster, but it still works for bullseye
Expand All @@ -18,7 +17,7 @@ RUN apt install -y wget
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install -y dotnet-sdk-3.1
RUN apt install -y dotnet-sdk-3.1 dotnet-sdk-6.0


FROM builder AS build
Expand Down Expand Up @@ -63,10 +62,9 @@ RUN echo -n "${LC_ALL}" > /etc/locale.gen && \
apt install -y locales && \
locale-gen

RUN dotnet test -c Release YamlDotNet.sln --framework net70 --logger:"trx;LogFileName=/output/tests.net70.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.sln --framework net60 --logger:"trx;LogFileName=/output/tests.net60.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net70 --logger:"trx;LogFileName=/output/tests.net70.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net60 --logger:"trx;LogFileName=/output/tests.net60.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework netcoreapp3.1 --logger:"trx;LogFileName=/output/tests.netcoreapp3.1.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net47 --logger:"trx;LogFileName=/output/tests.net47.trx" --logger:"console;Verbosity=detailed"

FROM alpine
VOLUME /output
Expand Down
2 changes: 1 addition & 1 deletion YamlDotNet.Samples/UseTypeConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Main()
var serializer = new SerializerBuilder()
.WithTypeConverter(new DateTimeOffsetConverter())
.Build();
var o = new { Hello = new DateTimeOffset(DateTime.Now, new TimeSpan(-6, 0, 0)) };
var o = new { Hello = DateTime.UtcNow };
var yaml = serializer.Serialize(o);
output.WriteLine(yaml);
}
Expand Down

0 comments on commit 5df001d

Please sign in to comment.