diff --git a/.csharpierignore b/.csharpierignore new file mode 100644 index 0000000..2bfa6a4 --- /dev/null +++ b/.csharpierignore @@ -0,0 +1 @@ +tests/ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e0f6063 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,78 @@ +# EditorConfig is awesome: https://EditorConfig.org +# top-most EditorConfig file +root = true + +# DO NOT CHANGE SETTINGS IN THIS FILE. PLEASE CREATE PULL REQUEST IN REPOSITORY `dotnet-engineering`. + +# Don't use tabs for indentation. +[*] +insert_final_newline = true +indent_style = space +trim_trailing_whitespace = true +charset = utf-8 +end_of_line = lf + +# Code files +[*.{cs,csx,vb,vbx}] +indent_size = 4 +insert_final_newline = true +charset = utf-8-bom + +# Razor and cshtml files +# UTF-8-BOM is set as default, as all official template files use UTF-8-BOM +# See https://github.com/dotnet/aspnetcore/pull/23502 and https://github.com/dotnet/aspnetcore/issues/22753 +[*.{razor,cshtml}] +charset = utf-8-bom + +# Generated code +[*{_AssemblyInfo.cs,.notsupported.cs,.generated.cs}] +generated_code = true + +# XML project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,nativeproj,locproj}] +indent_size = 2 + +# Xml build files +[*.builds] +indent_size = 2 + +# Xml files +[*.{xml,stylecop,resx,ruleset}] +indent_size = 2 + +# XML config files +[*.{props,targets,ruleset,config,nuspec,vsixmanifest,vsct}] +indent_size = 2 + +# JSON files +[*.json] +indent_size = 2 + +# YAML files +[*.{yml,yaml}] +indent_size = 2 + +# Powershell files +[*.ps1] +indent_size = 2 + +# Shell scripts +[*.sh] +indent_size = 2 + +# Commandline scripts +[*.{cmd,bat}] +end_of_line = crlf +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false +insert_final_newline = false + +# Visual Studio Solution Files +[*.sln] +indent_style = tab + +[*.{received,verified}.txt] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/.filenesting.json b/.filenesting.json new file mode 100644 index 0000000..4698c7c --- /dev/null +++ b/.filenesting.json @@ -0,0 +1,3 @@ +{ + "help":"https://go.microsoft.com/fwlink/?linkid=866610" +} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..b0d8326 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Default owners for all projects +* @dailydevops/maintainers diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..dbde5e0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,47 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + commit-message: + prefix: "build(ci)" + labels: + - "dependency-actions" + + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "build(deps)" + labels: + - "dependency-nuget" + open-pull-requests-limit: 20 + groups: + coverlet: + patterns: + - "coverlet*" + testcontainers: + patterns: + - "testcontainers*" + verify: + patterns: + - "verify*" + xunit: + patterns: + - "xunit*" + + - package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "build(mods)" + labels: + - "dependency-gitmodule" diff --git a/.github/template-sync.yml b/.github/template-sync.yml new file mode 100644 index 0000000..d992756 --- /dev/null +++ b/.github/template-sync.yml @@ -0,0 +1,24 @@ +additional: + - "analyzer" + - "article.benchmarks" + - "describe" + - "develop" + - "extensions.tasks" + - "extensions.test" + - "guard" + - "healthchecks" + - "http.correlation" + - "trydispose" + +files: + - "!**/*" + - ".csharpierignore" + - ".editorconfig" + - ".github/CODEOWNERS" + - ".github/dependabot.yml" + - ".github/workflows/dependabot-merge.yml" + - ".github/workflows/update-license.yml" + + # you probably want to exclude these files: + - "!.github/workflows/template-sync.yml" + - "!.github/template-sync.yml" diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..b133a43 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + inputs: + dotnet-logging: + required: true + type: choice + default: minimal + options: + - quiet + - minimal + - normal + - detailed + - diagnostic + +jobs: + all: + name: Build & Tests + uses: dailydevops/pipelines/.github/workflows/cicd-dotnet.yml@53112058f174beec924c627f07793b7b62f2a93a + with: + dotnet-logging: ${{ inputs.dotnet-logging | 'minimal' }} + dotnet-version: | + 7.x + solution: ###SOLUTION### + secrets: inherit diff --git a/.github/workflows/dependabot-merge.yml b/.github/workflows/dependabot-merge.yml new file mode 100644 index 0000000..d924469 --- /dev/null +++ b/.github/workflows/dependabot-merge.yml @@ -0,0 +1,17 @@ +name: Auto Merge Minor Upgrades + +on: + pull_request: + +jobs: + dependabot: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + + steps: + - name: Dependabot Auto Merge + uses: ahmadnassri/action-dependabot-auto-merge@v2.6.6 + with: + target: minor + github-token: ${{ secrets.DEPENDABOT }} + command: squash and merge diff --git a/.github/workflows/template-sync.yml b/.github/workflows/template-sync.yml new file mode 100644 index 0000000..26d86f9 --- /dev/null +++ b/.github/workflows/template-sync.yml @@ -0,0 +1,23 @@ +name: Update template files + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + template-sync: + if: github.actor != 'dependabot[bot]' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: ahmadnassri/action-template-repository-sync@v2.4.6 + with: + github-token: ${{ secrets.TEMPLATE_SYNC }} + dry-run: false diff --git a/.github/workflows/update-license.yml b/.github/workflows/update-license.yml new file mode 100644 index 0000000..6d79163 --- /dev/null +++ b/.github/workflows/update-license.yml @@ -0,0 +1,29 @@ +name: Update copyright year in license file + +on: + schedule: + - cron: '0 6 1 1 *' + workflow_dispatch: + +jobs: + run: + runs-on: ubuntu-latest + steps: + + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: FantasticFiasco/action-update-license-year@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + prTitle: 'chore: Updated LICENSE' + commitTitle: 'chore: Updated LICENSE [skip ci]' + id: license + + - name: Merge PR + if: steps.license.outputs.pullRequestNumber != '' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh pr merge --squash --admin --delete-branch ${{ steps.license.outputs.pullRequestNumber }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e53b18f --- /dev/null +++ b/.gitignore @@ -0,0 +1,355 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates +*.bak + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ +[Gg]enerated/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Visual Studio Sarif directory +.sarif/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* +*.received.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4c32550 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "eng"] + path = eng + url = https://github.com/dailydevops/dotnet-engineering.git diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..33fd11e --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,12 @@ + + + + $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'eng')) + $([MSBuild]::NormalizeDirectory('$(DirEngineering)', 'settings')) + + + + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..60fb990 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..eaa9f90 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Directory.Solution.props b/Directory.Solution.props new file mode 100644 index 0000000..ae1cea1 --- /dev/null +++ b/Directory.Solution.props @@ -0,0 +1,10 @@ + + + + $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'eng')) + $([MSBuild]::NormalizeDirectory('$(DirEngineering)', 'settings')) + + + + + diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..45c48fe --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,4 @@ +mode: MainLine # Only add this if you want every version to be created automatically on your main branch. +major-version-bump-message: "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)" +minor-version-bump-message: "^(feat)(\\([\\w\\s-]*\\))?:" +patch-version-bump-message: "^(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:" \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f8a38ce --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Daily DevOps & .NET + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0e844c8 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# template-dotnet +.NET template for repositories diff --git a/eng b/eng new file mode 160000 index 0000000..3d3d425 --- /dev/null +++ b/eng @@ -0,0 +1 @@ +Subproject commit 3d3d42509cce4b8776918fa5cdd8e8a7ef9bffda diff --git a/new-project.ps1 b/new-project.ps1 new file mode 100644 index 0000000..cb9f4c1 --- /dev/null +++ b/new-project.ps1 @@ -0,0 +1,50 @@ +[CmdletBinding()] +param ( + # Parameter help description + [Parameter(Mandatory = $true)] + [String] + $ProjectName, + + # Parameter help description + [Parameter(Mandatory = $false)] + [ValidateSet('Library', 'Console', 'WebApi', 'WebApp', 'Function', 'BlazorServer', 'BlazorWasm', 'RazorLibrary', 'xUnit', 'NUnit', 'MSTest', 'Benchmarks')] + [String] + $ProjectType = 'Library', + + # Parameter help description + [Parameter(Mandatory = $false)] + [String] + $Framework = 'net7.0', + + # Parameter help description + [Parameter(Mandatory = $false)] + [Switch] + $DisableTests, + + # Parameter help description + [Parameter(Mandatory = $false)] + [Switch] + $DisableUnitTests, + + # Parameter help description + [Parameter(Mandatory = $false)] + [Switch] + $DisableIntegrationTests, + + [Parameter(Mandatory = $false)] + [Switch] + $EnableProjectGrouping +) + +. .\eng\scripts\new-project.ps1 + +New-Project ` + -ProjectName $ProjectName ` + -ProjectType $ProjectType ` + -Framework $Framework ` + -DisableTests $DisableTests ` + -DisableUnitTests $DisableUnitTests ` + -DisableIntegrationTests $DisableIntegrationTests ` + -SolutionFile "###SOLUTION###" ` + -OutputDirectory (Get-Location) ` + -EnableProjectGrouping $EnableProjectGrouping diff --git a/new-solution.ps1 b/new-solution.ps1 new file mode 100644 index 0000000..0c57ad1 --- /dev/null +++ b/new-solution.ps1 @@ -0,0 +1,17 @@ +[CmdletBinding()] +param ( + # Name of the solution to be created. + [Parameter(Mandatory = $true)] + [string] + $SolutionName +) + +Write-Output "Updating submodules ..." +git submodule update --init --recursive --remote | Out-Null + +Write-Output "Creating $SolutionName.sln ..." +$location = Get-Location +. .\eng\scripts\new-solution.ps1 + +New-Solution -SolutionName $SolutionName -Output $location +Remove-Item -Path "$location\new-solution.ps1" -Force diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..5290396 --- /dev/null +++ b/nuget.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/update-solution.ps1 b/update-solution.ps1 new file mode 100644 index 0000000..b6f2583 --- /dev/null +++ b/update-solution.ps1 @@ -0,0 +1,12 @@ +[CmdletBinding()] +param ( +) +Write-Output "Updating submodules ..." +git submodule update --init --recursive --remote | Out-Null + +. .\eng\scripts\update-solution.ps1 + +Update-Solution -OutputDirectory (Get-Location) + +Write-Output "Reinitializing git repository ..." +git init | Out-Null