Skip to content

Commit

Permalink
Merge pull request #1 from iAmBipinPaul/nuke-update-to-dotnet-8
Browse files Browse the repository at this point in the history
Nuke update to dotnet 8
  • Loading branch information
iAmBipinPaul authored Mar 29, 2024
2 parents 5870e19 + 338b6b9 commit 4bcf1ac
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 57 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/aspnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: ASP.NET Core CI
on: [push]
on:
push:
branches: [ nuke ]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -8,6 +10,6 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.402'
dotnet-version: '8.0.x'
- name: buld with Nuke
run: dotnet run --project ./build/_build.csproj -GitHubAccessToken ${{ secrets.GithubAccessToken }}
1 change: 0 additions & 1 deletion .nuke

This file was deleted.

4 changes: 4 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "./build.schema.json",
"Solution": "AspNetCoreDevOps.sln"
}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dist: xenial
dist: jammy
sudo: required
language: csharp
mono: none
dotnet: 6.0.402
dotnet: 8.0.203
solution: AspNetCoreDevOps.sln
services:
- docker
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Continuous integration
## Continuous integration

| Build server | Platform | Build status | Integration tests |
|-----------------------------|-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|
Expand Down
13 changes: 0 additions & 13 deletions aspnetcore-nuke.yml

This file was deleted.

6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pool:
vmImage: 'Ubuntu 18.04'
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: DotNetCoreInstaller@0
- task: UseDotNet@2
inputs:
version: '6.0.402' # replace this value with the version that you need for your project
version: '8.x' # replace this value with the version that you need for your project
- script: |
dotnet run --project ./build/_build.csproj -GitHubAccessToken $(GithubAccessToken)
21 changes: 8 additions & 13 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@
using Nuke.Common.CI.AzurePipelines;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.CI.TravisCI;
using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.Docker;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;

[CheckBuildProjectConfigurations]
[UnsetVisualStudioEnvironmentVariables]

class Build : NukeBuild
{
/// Support plugins are available for:
Expand Down Expand Up @@ -47,16 +42,16 @@ class Build : NukeBuild
string branch = "";
[Parameter("Github access token for packages")]
readonly string GitHubAccessToken;
string repo = "docker.pkg.github.com/iambipinpaul/aspnetcoredevops/aspnetcoredevops";
string repo = "ghcr.io/iambipinpaul/aspnetcoredevops";
string user = "iambipinpaul";

Target Clean => _ => _
.Before(Restore)
.Executes(() =>
{
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
EnsureCleanDirectory(OutputDirectory);
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(path => path.DeleteDirectory());
TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(path => path.DeleteDirectory());
OutputDirectory.CreateOrCleanDirectory();
});
Target Restore => _ => _
.DependsOn(Clean)
Expand Down Expand Up @@ -103,7 +98,7 @@ class Build : NukeBuild
.Executes(() =>
{
DockerTasks.DockerLogin(b => b
.SetServer("docker.pkg.github.com")
.SetServer("ghcr.io")
.SetUsername(user)
.SetPassword(GitHubAccessToken)
Expand Down Expand Up @@ -184,7 +179,7 @@ class Build : NukeBuild
}
else
{
tag = $"github-{GitRepository.Branch.Split('/').Last()}-{GitHubActions.Instance.GitHubSha}";
tag = $"github-{GitRepository.Branch.Split('/').Last()}-{GitHubActions.Instance.RunId}";
}
}
}
Expand All @@ -206,7 +201,7 @@ class Build : NukeBuild
.Executes(() =>
{
DockerTasks.DockerLogout(b => b
.SetServer("docker.pkg.github.com")
.SetServer("ghcr.io")
);
});
Target CheckBranch => _ => _
Expand Down
4 changes: 2 additions & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
Expand All @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="5.0.2" />
<PackageReference Include="Nuke.Common" Version="8.0.0" />
</ItemGroup>

</Project>
9 changes: 7 additions & 2 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine-amd64 AS buildimg
FROM mcr.microsoft.com/dotnet/sdk:8.0.203-alpine3.19-amd64 AS buildimg
WORKDIR /app
COPY . .
WORKDIR /app/src/AspNetCoreDevOps.Api
RUN dotnet publish -c Release -o output

FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine-amd64
FROM mcr.microsoft.com/dotnet/aspnet:8.0.3-alpine3.19-amd64
WORKDIR output
COPY --from=buildimg /app/src/AspNetCoreDevOps.Api/output .

LABEL org.opencontainers.image.source https://github.com/iAmBipinPaul/AspNetCoreDevOps

ENTRYPOINT ["dotnet","AspNetCoreDevOps.Api.dll"]


14 changes: 7 additions & 7 deletions src/AspNetCoreDevOps.Api/AspNetCoreDevOps.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>aspnet-Travis_CI.Api-BF4C3663-4721-4A76-BDE9-4FF423EF6E85</UserSecretsId>
</PropertyGroup>

Expand All @@ -12,15 +12,15 @@
<None Remove="wwwroot\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.10">
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.10" PrivateAssets="All" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.07" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" PrivateAssets="All" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -12,11 +12,11 @@

<ItemGroup>

<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions tools/AspNetCoreDevOps.Seeder/AspNetCoreDevOps.Seeder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>AspNetCoreDevOps.Seeder</RootNamespace>
</PropertyGroup>

Expand All @@ -14,10 +14,10 @@

<ItemGroup>
<PackageReference Include="Faker.NETCore" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="NBuilder" Version="6.1.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.7" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="NUnit" Version="4.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 4bcf1ac

Please sign in to comment.