Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Jan 16, 2025
1 parent 29b0b9d commit eb6738f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pure.DI check
name: dotnetsdk push

on: [ push, pull_request ]

Expand All @@ -13,7 +13,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand Down
34 changes: 33 additions & 1 deletion build/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
const string image = "dotnetsdk";
var tags = new[] { "latest", "9.0" };
const string projectBodyToTest = """
<Project Sdk=\"Microsoft.NET.Sdk\">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
</PropertyGroup>
</Project>
""";

new DockerCustom("build", "-t", image, "docker").TryRun();

var tempDir = Directory.CreateTempSubdirectory("dotnetsdk");
try
{
File.WriteAllText(
Path.Combine(tempDir.FullName, "MyLib.csproj"),
projectBodyToTest);

var dotnetNew = new DotNetNew()
.WithName("MyLib")
.WithTemplateName("classlib");

new DockerRun()
.WithAutoRemove(true)
.WithImage(image)
.WithVolumes((tempDir.FullName, "/MyLib"))
.WithContainerWorkingDirectory("/MyLib")
.WithCommandLine(dotnetNew)
.Build().EnsureSuccess();
}
finally
{
tempDir.Delete(true);
}

new DockerCustom("login").TryRun();
foreach (var tag in tags)
{
var repoImage = $"nikolayp/{image}:{tag}";
new DockerCustom("tag", image, repoImage).TryRun();
new DockerCustom("image", "push", repoImage).TryRun();
new DockerCustom("image", "push", repoImage).TryRun();
}
5 changes: 5 additions & 0 deletions dotnetsdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "build", "build\build.csproj", "{2D8545B4-7AAE-4C6A-A2AA-C18390555C89}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docker", "Docker", "{D33B8A79-15E4-4864-BD4F-7F8F89AB224D}"
ProjectSection(SolutionItems) = preProject
docker\Dockerfile = docker\Dockerfile
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 2 additions & 0 deletions dotnetsdk.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<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">
<s:Boolean x:Key="/Default/UserDictionary/Words/=classlib/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

0 comments on commit eb6738f

Please sign in to comment.