Skip to content

Commit 632d031

Browse files
Add tests
1 parent 29b0b9d commit 632d031

File tree

5 files changed

+49
-5
lines changed

5 files changed

+49
-5
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pure.DI check
1+
name: dotnetsdk push
22

33
on: [ push, pull_request ]
44

@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup dotnet
1414
uses: actions/setup-dotnet@v3
1515
with:
16-
dotnet-version: '8.0.x'
16+
dotnet-version: '9.0.x'
1717

1818
- name: Login to Docker Hub
1919
uses: docker/login-action@v3

build/Program.cs

+33-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,43 @@
11
const string image = "dotnetsdk";
22
var tags = new[] { "latest", "9.0" };
3+
const string projectBodyToTest = """
4+
<Project Sdk=\"Microsoft.NET.Sdk\">
5+
<PropertyGroup>
6+
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
7+
</PropertyGroup>
8+
</Project>
9+
""";
310

411
new DockerCustom("build", "-t", image, "docker").TryRun();
12+
13+
var tempDir = Directory.CreateTempSubdirectory("dotnetsdk");
14+
try
15+
{
16+
File.WriteAllText(
17+
Path.Combine(tempDir.FullName, "MyLib.csproj"),
18+
projectBodyToTest);
19+
20+
var dotnetNew = new DotNetNew()
21+
.WithName("MyLib")
22+
.WithTemplateName("classlib");
23+
24+
new DockerRun()
25+
.WithAutoRemove(true)
26+
.WithImage(image)
27+
.WithVolumes((tempDir.FullName, "/MyLib"))
28+
.WithContainerWorkingDirectory("/MyLib")
29+
.WithCommandLine(dotnetNew)
30+
.Build().EnsureSuccess();
31+
}
32+
finally
33+
{
34+
tempDir.Delete(true);
35+
}
36+
537
new DockerCustom("login").TryRun();
638
foreach (var tag in tags)
739
{
840
var repoImage = $"nikolayp/{image}:{tag}";
941
new DockerCustom("tag", image, repoImage).TryRun();
10-
new DockerCustom("image", "push", repoImage).TryRun();
42+
new DockerCustom("image", "push", repoImage).TryRun();
1143
}

build/build.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="CSharpInteractive" Version="1.1.2" />
11+
<PackageReference Include="CSharpInteractive" Version="1.1.5" />
1212
</ItemGroup>
1313

1414
</Project>

dotnetsdk.sln

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "build", "build\build.csproj", "{2D8545B4-7AAE-4C6A-A2AA-C18390555C89}"
44
EndProject
5+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docker", "Docker", "{D33B8A79-15E4-4864-BD4F-7F8F89AB224D}"
6+
ProjectSection(SolutionItems) = preProject
7+
docker\Dockerfile = docker\Dockerfile
8+
EndProjectSection
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub", "GitHub", "{41669751-C634-42A3-A87E-FB786A8C7BBE}"
11+
ProjectSection(SolutionItems) = preProject
12+
.github\workflows\main.yml = .github\workflows\main.yml
13+
EndProjectSection
14+
EndProject
515
Global
616
GlobalSection(SolutionConfigurationPlatforms) = preSolution
717
Debug|Any CPU = Debug|Any CPU

dotnetsdk.sln.DotSettings

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=classlib/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

0 commit comments

Comments
 (0)