diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 727dfd7..4903ba5 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "cake.tool": { - "version": "0.38.5", + "version": "1.3.0", "commands": [ "dotnet-cake" ] diff --git a/.editorconfig b/.editorconfig index 20a49b6..a48cb6d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,7 +11,7 @@ insert_final_newline = false trim_trailing_whitespace = true # .NET Code files -[*.{cs,csx,cake,vb}] +[*.{cs,csx,cake,vb,vbx,h,cpp,idl}] indent_style = tab tab_width = 4 insert_final_newline = true @@ -21,12 +21,12 @@ insert_final_newline = true indent_style = tab tab_width = 4 -# Visual Studio XML Project Files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +# MSBuild project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj}] indent_size = 2 -# Various XML Configuration Files -[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}] +# Xml config files +[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct,runsettings}] indent_size = 2 # JSON Files diff --git a/.gitattributes b/.gitattributes index bdb0cab..0940d5d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,17 +1,99 @@ # Auto detect text files and perform LF normalization * text=auto +# +# The above will handle all files NOT found below +# + +# Documents +*.bibtex text diff=bibtex +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.md text +*.tex text diff=tex +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +*.sql text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as an asset (binary) by default. +*.svg text +# If you want to treat it as binary, +# use the following line instead. +# *.svg binary +*.eps binary + +# Scripts +*.bash text eol=lf +*.fish text eol=lf +*.sh text eol=lf +# These are explicitly windows files and should use crlf +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Serialisation +*.json text +*.toml text +*.xml text +*.yaml text +*.yml text + +# Archives +*.7z binary +*.gz binary +*.tar binary +*.tgz binary +*.zip binary + # Custom for Visual Studio -*.cs diff=csharp +*.cs diff=csharp +*.sln text eol=crlf +*.csproj text eol=crlf +*.vbproj text eol=crlf +*.vcxproj text eol=crlf +*.vcproj text eol=crlf +*.dbproj text eol=crlf +*.fsproj text eol=crlf +*.lsproj text eol=crlf +*.wixproj text eol=crlf +*.modelproj text eol=crlf +*.sqlproj text eol=crlf +*.wwaproj text eol=crlf +*.xproj text eol=crlf +*.props text eol=crlf +*.filters text eol=crlf +*.vcxitems text eol=crlf # Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +# The macOS codesign tool is extremely picky, and requires LF line endings. +*.plist eol=lf diff --git a/.gitignore b/.gitignore index c9431a4..5fa8eb2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ ## 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 +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # User-specific files *.rsuser @@ -27,6 +27,7 @@ mono_crash.* [Rr]eleases/ x64/ x86/ +[Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ @@ -65,6 +66,9 @@ project.lock.json project.fragment.lock.json artifacts/ +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + # StyleCop StyleCopReport.xml @@ -90,6 +94,7 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log +*.tlog *.vspscc *.vssscc .builds @@ -142,7 +147,9 @@ _TeamCity* !.axoCover/settings.json # Coverlet is a free, cross platform Code Coverage Tool -coverage*[.json, .xml, .info] +coverage*.json +coverage*.xml +coverage*.info # Visual Studio code coverage results *.coverage @@ -291,6 +298,15 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files + # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -314,6 +330,7 @@ __pycache__/ *.pyc # Cake +.cake/** tools/** BuildArtifacts/ @@ -347,6 +364,9 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ +# Visual Studio History (VSHistory) files +.vshistory/ + # BeatPulse healthcheck temp database healthchecksdb @@ -356,6 +376,33 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + # WinMerge *.bak diff --git a/GitReleaseManager.yaml b/GitReleaseManager.yaml index 721c1ba..10d750e 100644 --- a/GitReleaseManager.yaml +++ b/GitReleaseManager.yaml @@ -1,12 +1,42 @@ +create: + include-footer: false + footer-heading: Where to get it + footer-content: You can download this release from [nuget.org](https://www.nuget.org/packages/Cake.SendGrid/{milestone}) + footer-includes-milestone: true + milestone-replace-text: '{milestone}' +close: + use-issue-comments: true + issue-comment: |- + :tada: This issue has been resolved in version {milestone} :tada: + + The release is available on: + + - [GitHub Release](https://github.com/{owner}/{repository}/releases/tag/{milestone}) + - [NuGet Package](https://www.nuget.org/packages/Cake.SendGrid/{milestone}) + + Your **[GitReleaseManager](https://github.com/GitTools/GitReleaseManager)** bot :package::rocket: +export: + include-created-date-in-title: true + created-date-string-format: MMMM dd, yyyy + perform-regex-removal: true + regex-text: '### Where to get it(\r\n)*You can .*\)' + multiline-regex: true issue-labels-include: -- Breaking change -- Feature -- Bug -- Improvement -- Documentation + - Breaking Change + - Bug + - New Feature + - Improvement + - Enhancement + - Documentation + - Security issue-labels-exclude: -- Build + - Question + - Duplicate + - Invalid + - Wontfix + - Build + - Internal Refactoring issue-labels-alias: - - name: Documentation - header: Documentation - plural: Documentation \ No newline at end of file + - name: Documentation + header: Documentation + plural: Documentation diff --git a/GitVersion.yml b/GitVersion.yml index ec58f47..c43da67 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,16 +1,26 @@ mode: ContinuousDelivery branches: - release: - regex: releases?[/-] + master: + regex: (master|main) + mode: ContinuousDelivery + tag: + increment: Patch + prevent-increment-of-merged-branch-version: true + track-merge-target: false + feature: + regex: feature(s)?[/-] mode: ContinuousDeployment - tag: rc develop: regex: dev(elop)?(ment)?$ mode: ContinuousDeployment - tag: alpha + tag: beta hotfix: regex: hotfix(es)?[/-] mode: ContinuousDeployment - tag: beta + tag: hotfix + release: + regex: release(s)?[/-] + mode: ContinuousDeployment + tag: rc ignore: sha: [] diff --git a/Source/Cake.SendGrid/Cake.SendGrid.csproj b/Source/Cake.SendGrid/Cake.SendGrid.csproj index be70f59..98a9e7e 100644 --- a/Source/Cake.SendGrid/Cake.SendGrid.csproj +++ b/Source/Cake.SendGrid/Cake.SendGrid.csproj @@ -1,7 +1,7 @@ - net6.0;net5.0;netcoreapp3.1 + net6.0;net7.0;net8.0 anycpu true Library @@ -27,9 +27,9 @@ - - - + + + diff --git a/Source/StyleCopRules.ruleset b/Source/StyleCopRules.ruleset index 5510b6e..29c2d50 100644 --- a/Source/StyleCopRules.ruleset +++ b/Source/StyleCopRules.ruleset @@ -1,4 +1,4 @@ - + diff --git a/appveyor.psm1 b/appveyor.psm1 new file mode 100644 index 0000000..40eb9f0 --- /dev/null +++ b/appveyor.psm1 @@ -0,0 +1,67 @@ +# Inspired by: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/tools/appveyor.psm1 + +$ErrorActionPreference = 'Stop' + +# Implements the AppVeyor 'install' step and installs the desired .NET SDK if not already installed. +function Invoke-AppVeyorInstall { + + Write-Verbose -Verbose "Determining the desired version of .NET SDK" + $globalDotJson = Get-Content (Join-Path $PSScriptRoot 'global.json') -Raw | ConvertFrom-Json + $desiredDotNetCoreSDKVersion = $globalDotJson.sdk.version + Write-Verbose -Verbose "We have determined that the desired version of the .NET SDK is $desiredDotNetCoreSDKVersion" + + Write-Verbose -Verbose "Checking availability of .NET SDK $desiredDotNetCoreSDKVersion" + $desiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $desiredDotNetCoreSDKVersion + + if (-not $desiredDotNetCoreSDKVersionPresent) { + Write-Verbose -Verbose "We have determined that the desired version of the .NET SDK is not present on this machine" + Write-Verbose -Verbose "Installing .NET SDK $desiredDotNetCoreSDKVersion" + $originalSecurityProtocol = [Net.ServicePointManager]::SecurityProtocol + try { + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 + if ($IsLinux -or $isMacOS) { + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh + + # Normally we would execute dotnet-install.sh like so: + # bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion + # + # and we would also update the PATH environment variable like so: + # $OLDPATH = [System.Environment]::GetEnvironmentVariable("PATH") + # $NEWPATH = "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$OLDPATH" + # [Environment]::SetEnvironmentVariable("PATH", "$NEWPATH") + # + # This is supposed to result in the desired .NET SDK to be installed side-by-side + # with the other version(s) of the SDK already installed. However, my experience + # on Ubuntu images in Appveyor has been that the recently installed SDK is the only + # one detected and the previous versions are no longer detected as being installed. + # + # This whole thing is problematic because GitVersion.Tool 5.7 is not compatible with + # .NET 6 (in fact, it doesn't even install) and you must have .NET 5 installed side-by-side + # with .NET 6 in order to install and use GitVersion.Tool + # + # I spent a whole day trying to find a solution but ultimately the only reliable solution + # I was able to come up with is to install in the default location (which is /usr/share/dotnet) + # using 'sudo' because you need admin privileges to access the default install location. + # + # November 2022: I tried removing this workaround since GetVersion.Tool was updated more + # than 2 years ago but it led to another problem: https://ci.appveyor.com/project/Jericho/zoomnet/builds/48579496/job/pymt60j9b53ayxta#L78 + # + # Therefore this workaround seems like a permanent solution. + + sudo bash dotnet-install.sh --version $desiredDotNetCoreSDKVersion --install-dir /usr/share/dotnet + } + else { + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 + .\dotnet-install.ps1 -Version $desiredDotNetCoreSDKVersion + } + } + finally { + [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol + Remove-Item .\dotnet-install.* + } + Write-Verbose -Verbose "Installed .NET SDK $desiredDotNetCoreSDKVersion" + } + else { + Write-Verbose -Verbose "We have determined that the desired version of the .NET SDK is already installed on this machine" + } +} diff --git a/appveyor.yml b/appveyor.yml index 5e80ce5..67f738c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,14 +1,26 @@ -# Before Build +# environment variables +environment: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # For faster CI builds + DOTNET_ROLL_FORWARD: Major # See https://github.com/GitTools/GitVersion/issues/2906 until 5.8.0 is released + +# scripts that are called at very beginning, before repo cloning init: - git config --global core.autocrlf true +# scripts that run after cloning repository +install: + - ps: Import-Module .\appveyor.psm1; Invoke-AppveyorInstall + # scripts to run before build before_build: - dotnet --info -# Build script +# to run your custom scripts instead of automatic MSBuild build_script: - - ps: .\build.ps1 --target=CI + - ps: .\build.ps1 recipe.cake --target=CI + +# scripts to run after build +after_build: # Tests test: off @@ -24,14 +36,13 @@ branches: # Build cache cache: - - tools -> recipe.cake + - .cake -> recipe.cake # Environment configuration -image: Visual Studio 2022 +image: + - Ubuntu1804 + - Visual Studio 2022 -#---------------------------------# -# Skip builds for doc changes # -#---------------------------------# +# Skip builds for doc changes skip_commits: - # Regex for matching commit message message: /\(doc\).*/ diff --git a/build.ps1 b/build.ps1 index bfb88fc..21821d2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,23 +1,13 @@ $ErrorActionPreference = 'Stop' -function Run([string[]]$arguments) { - $cmd = @("& dotnet") - $cmd += $arguments - $cmdLine = $cmd -join " " - Write-Verbose "> $cmdLine" - Invoke-Expression $cmdLine +Set-Location -LiteralPath $PSScriptRoot - if ($LASTEXITCODE -ne 0) { - Write-Host "Non-Zero exit code ($($LASTEXITCODE)), exiting..." - exit $LASTEXITCODE - } -} +$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1' +$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1' +$env:DOTNET_NOLOGO = '1' -Run tool, restore +dotnet tool restore +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } -Run cake, recipe.cake, --bootstrap - -$arguments = @("cake"; "recipe.cake") -$arguments += @($args) - -Run $arguments \ No newline at end of file +dotnet cake @args +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/build.sh b/build.sh index 794d59a..31be886 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,12 @@ -#!/bin/bash -dotnet tool restore +#!/usr/bin/env bash +set -euox pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")" -dotnet cake recipe.cake --bootstrap +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export DOTNET_NOLOGO=1 + +dotnet tool restore -dotnet cake recipe.cake "$@" \ No newline at end of file +dotnet cake "$@" diff --git a/cake.config b/cake.config new file mode 100644 index 0000000..a90fc5a --- /dev/null +++ b/cake.config @@ -0,0 +1,10 @@ +; The configuration file for Cake. + +[Nuget] +LoadDependencies=true + +[Paths] +Tools=./.cake + +[Settings] +EnableScriptCache=true \ No newline at end of file diff --git a/global.json b/global.json index d6c2c37..8e621ca 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,7 @@ { "sdk": { - "version": "6.0.100", - "rollForward": "latestFeature" + "version": "8.0.100", + "rollForward": "patch", + "allowPrerelease": false } } \ No newline at end of file diff --git a/recipe.cake b/recipe.cake index 6e00c22..69c36cc 100644 --- a/recipe.cake +++ b/recipe.cake @@ -1,4 +1,4 @@ -#load nuget:?package=Cake.Recipe&version=2.2.1 +#load nuget:?package=Cake.Recipe&version=3.1.1 Environment.SetVariableNames(); @@ -10,9 +10,9 @@ BuildParameters.SetParameters(context: Context, repositoryOwner: "cake-contrib", repositoryName: "Cake.SendGrid", shouldRunDotNetCorePack: true, - shouldRunDupFinder: false, shouldRunInspectCode: false, shouldRunCodecov: false, + shouldPostToGitter: false, appVeyorAccountName: "cakecontrib", shouldCalculateVersion: true);