From 8f8a3af1dbf6a820aa8e30f0060103108ab29329 Mon Sep 17 00:00:00 2001 From: "Nikolay.IT" Date: Mon, 24 Aug 2026 16:52:36 +0300 Subject: [PATCH 1/2] Replace the Azure pipeline with a GitHub Actions build Builds and tests the template solution in Release on windows-latest, builds the renamer tool, and drops azure-pipelines.yml. The Azure DevOps project behind the old pipeline is gone. Claude-Session: https://claude.ai/code/session_01Nyppsn3VF6d1Sno5orPWiV --- .github/workflows/build.yml | 54 +++++++++++++++++++++++++++++++++++++ README.md | 2 +- azure-pipelines.yml | 34 ----------------------- 3 files changed, 55 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..3937b110 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + +jobs: + build: + name: Build and test + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 10.0.x + + - name: Restore + run: dotnet restore src/AspNetCoreTemplate.sln + + - name: Build + run: dotnet build src/AspNetCoreTemplate.sln -c Release --no-restore + + - name: Test + run: > + dotnet test src/AspNetCoreTemplate.sln + -c Release --no-build --logger "trx;LogFileName=test-results.trx" + + # The renamer tool has its own solution and still targets net6.0; the + # current SDK builds it from the NuGet targeting pack. + - name: Build the template renamer + run: dotnet build tools/TemplateRenamer/TemplateRenamer.sln -c Release + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: '**/TestResults/*.trx' + if-no-files-found: ignore diff --git a/README.md b/README.md index 90685d79..549f7291 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A ready-to-use template for ASP.NET Core with repositories, services, models map ## Build status -[![Build Status](https://nikolayit.visualstudio.com/AspNetCoreTemplate/_apis/build/status/NikolayIT.ASP.NET-Core-Template?branchName=master)](https://nikolayit.visualstudio.com/AspNetCoreTemplate/_build/latest?definitionId=15&branchName=master) +[![Build](https://github.com/NikolayIT/ASP.NET-Core-Template/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/NikolayIT/ASP.NET-Core-Template/actions/workflows/build.yml) ## Authors diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 6d417832..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,34 +0,0 @@ -# ASP.NET -# Build and test ASP.NET projects. -# Add steps that publish symbols, save build artifacts, deploy, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 - -trigger: -- master - -pool: - vmImage: 'windows-latest' - -variables: - solution: '**/*.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - -steps: -- task: NuGetToolInstaller@1 - -- task: NuGetCommand@2 - inputs: - restoreSolution: '$(solution)' - -- task: VSBuild@1 - inputs: - solution: '$(solution)' - msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - -- task: VSTest@2 - inputs: - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' From 4af8fcaa4795f8769bef3207d47221a1764a8943 Mon Sep 17 00:00:00 2001 From: "Nikolay.IT" Date: Mon, 24 Aug 2026 16:56:43 +0300 Subject: [PATCH 2/2] Keep the SQL Server-backed web tests out of CI The two WebTests examples boot the app through WebApplicationFactory and need a database, which the hosted runner does not have. Claude-Session: https://claude.ai/code/session_01Nyppsn3VF6d1Sno5orPWiV --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3937b110..b3620dd1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,9 +35,12 @@ jobs: - name: Build run: dotnet build src/AspNetCoreTemplate.sln -c Release --no-restore + # AspNetCoreTemplate.Web.Tests is excluded: its two example tests boot the + # whole app through WebApplicationFactory, which connects to SQL Server. + # Run them locally against a database. - name: Test run: > - dotnet test src/AspNetCoreTemplate.sln + dotnet test src/Tests/AspNetCoreTemplate.Services.Data.Tests/AspNetCoreTemplate.Services.Data.Tests.csproj -c Release --no-build --logger "trx;LogFileName=test-results.trx" # The renamer tool has its own solution and still targets net6.0; the