diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json deleted file mode 100644 index 95adf14..0000000 --- a/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "gitversion.tool": { - "version": "5.12.0", - "commands": [ - "dotnet-gitversion" - ] - } - } -} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index 991f037..8d9bfc8 100644 Binary files a/.editorconfig and b/.editorconfig differ diff --git a/.gitattributes b/.gitattributes index 1ff0c42..8154320 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,63 +1,107 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### +## Set Git attributes for paths including line ending +## normalization, diff behavior, etc. +## +## Get latest from `dotnet new gitattributes` + +# Auto detect text files and perform LF normalization * text=auto -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files # -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files +# The above will handle all files NOT found below # -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.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 + +*.cs text diff=csharp +*.cshtml text diff=html +*.csx text diff=csharp +*.sln text eol=crlf + +# Content below from: https://github.com/gitattributes/gitattributes/blob/master/Common.gitattributes + +# 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 diff=markdown +*.mdx text diff=markdown +*.tex text diff=tex +*.adoc text +*.textile text +*.mustache text +# Per RFC 4180, .csv should be CRLF +*.csv text eol=crlf +*.tab text +*.tsv text +*.txt text +*.sql text +*.epub diff=astextplain + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as text by default. +*.svg text +# If you want to treat it as binary, +# use the following line instead. +# *.svg binary +*.eps binary + +# Scripts +# Force Unix scripts to always use lf line endings so that if a repo is accessed +# in Unix via a file share from Windows, the scripts will work +*.bash text eol=lf +*.fish text eol=lf +*.ksh text eol=lf +*.sh text eol=lf +*.zsh text eol=lf +# Likewise, force cmd and batch scripts to always use crlf +*.bat text eol=crlf +*.cmd text eol=crlf + +# Serialization +*.json text +*.toml text +*.xml text +*.yaml text +*.yml text + +# Archives +*.7z binary +*.bz binary +*.bz2 binary +*.bzip2 binary +*.gz binary +*.lz binary +*.lzma binary +*.rar binary +*.tar binary +*.taz binary +*.tbz binary +*.tbz2 binary +*.tgz binary +*.tlz binary +*.txz binary +*.xz binary +*.Z binary +*.zip binary +*.zst binary + +# Text files where line endings should be preserved +*.patch -text + +# Exclude files from exporting +.gitattributes export-ignore +.gitignore export-ignore +.gitkeep export-ignore diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a9e30a9..1936c3b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,16 +1,11 @@ version: 2 updates: - - package-ecosystem: "nuget" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "daily" + interval: weekly - - package-ecosystem: "nuget" - directory: "/build" + - package-ecosystem: nuget + directory: / schedule: - interval: "weekly" - - - package-ecosystem: "nuget" - directory: "/.config" - schedule: - interval: "weekly" + interval: weekly diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e515667..bce258a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,31 +1,40 @@ -name: build +name: Build on: + pull_request: push: branches: - master - pull_request: + +permissions: + contents: read env: DOTNET_NOLOGO: true jobs: build: - name: build + name: Build runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Fetch all tags and branches - run: git fetch --prune --unshallow + uses: actions/checkout@v7 + with: + fetch-depth: 0 + - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: - dotnet-version: '3.1.x' + dotnet-version: 3.1.x + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v4 + with: + versionSpec: 6.x + + - name: Calculate version + uses: gittools/actions/gitversion/execute@v4 + - name: Build run: ./build.ps1 - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - path: artifacts/*.nupkg diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml deleted file mode 100644 index e06415a..0000000 --- a/.github/workflows/merge.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: merge -on: pull_request - -permissions: - contents: write - pull-requests: write - -jobs: - merge: - runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v1 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Enable auto-merge for Dependabot PRs - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Approve a PR - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f024ce7..58ec182 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,31 +1,47 @@ -name: publish +name: Publish on: release: types: [published] +permissions: + contents: read + id-token: write + env: DOTNET_NOLOGO: true jobs: - publish: - name: publish + build: + name: Publish runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Fetch all tags and branches - run: git fetch --prune --unshallow + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: NuGet login + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_USER }} + - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: - dotnet-version: '3.1.x' + dotnet-version: 3.1.x + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v4 + with: + versionSpec: 6.x + + - name: Calculate version + uses: gittools/actions/gitversion/execute@v4 + - name: Deploy env: - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }} run: ./build.ps1 publish - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - path: artifacts/*.nupkg diff --git a/.gitignore b/.gitignore index e57aa53..0808c4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ ## 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 `dotnet new gitignore` + +# dotenv files +.env # User-specific files *.rsuser @@ -13,6 +16,9 @@ # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +# Mono auto generated files +mono_crash.* + # Build results [Dd]ebug/ [Dd]ebugPublic/ @@ -20,12 +26,14 @@ [Rr]eleases/ x64/ x86/ +[Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ +[Ll]ogs/ # Visual Studio 2015/2017 cache/options directory .vs/ @@ -39,9 +47,10 @@ Generated\ Files/ [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* -# NUNIT +# NUnit *.VisualState.xml TestResult.xml +nunit-*.xml # Build Results of an ATL Project [Dd]ebugPS/ @@ -51,11 +60,17 @@ dlldata.c # Benchmark Results BenchmarkDotNet.Artifacts/ -# .NET Core +# .NET project.lock.json project.fragment.lock.json artifacts/ +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + # StyleCop StyleCopReport.xml @@ -73,6 +88,8 @@ StyleCopReport.xml *.pgc *.pgd *.rsp +# but not Directory.Build.rsp, as it configures directory-level build defaults +!Directory.Build.rsp *.sbr *.tlb *.tli @@ -81,6 +98,7 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log +*.tlog *.vspscc *.vssscc .builds @@ -122,9 +140,6 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding add-in -.JustCode - # TeamCity is a build add-in _TeamCity* @@ -135,6 +150,11 @@ _TeamCity* .axoCover/* !.axoCover/settings.json +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + # Visual Studio code coverage results *.coverage *.coveragexml @@ -182,6 +202,8 @@ 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. @@ -206,6 +228,8 @@ BundleArtifacts/ Package.StoreAssociation.xml _pkginfo.txt *.appx +*.appxbundle +*.appxupload # Visual Studio cache files # files ending in .cache can be ignored @@ -231,8 +255,6 @@ orleans.codegen.cs # Since there are multiple workflows, uncomment next line to ignore bower_components # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) #bower_components/ -# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true -**/wwwroot/lib/ # RIA/Silverlight projects Generated_Code/ @@ -257,6 +279,9 @@ ServiceFabricBackup/ *.bim.layout *.bim_*.settings *.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl # Microsoft Fakes FakesAssemblies/ @@ -277,6 +302,17 @@ 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 +*.ncb +*.aps + # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -292,10 +328,6 @@ paket-files/ # FAKE - F# Make .fake/ -# JetBrains Rider -.idea/ -*.sln.iml - # CodeRush personal settings .cr/personal @@ -304,8 +336,8 @@ __pycache__/ *.pyc # Cake - Uncomment if you are using it -tools/** -!tools/packages.config +# tools/** +# !tools/packages.config # Tabs Studio *.tss @@ -337,5 +369,114 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ -# BeatPulse healthcheck temp database +# Visual Studio History (VSHistory) files +.vshistory/ + +# 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/ + +# 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 +.idea/ + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43211c0..cfe54e9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,4 +4,4 @@ First of all, thank you for wanting to contribute to Machine.Specifications! We ## Preparation -Before starting work on a new bug, feature, etc. ensure that an [issue](https://github.com/machine/machine.specifications/issues) has been raised. Indicate your intention to work on the issue by writing a comment against it. This will prevent duplication of effort. If the issue is a new feature, it's usually best to propose a design in the issue comments. \ No newline at end of file +Before starting work on a new bug, feature, etc. ensure that an [issue](https://github.com/machine/machine.specifications/issues) has been raised. Indicate your intention to work on the issue by writing a comment against it. This will prevent duplication of effort. If the issue is a new feature, it's usually best to propose a design in the issue comments. diff --git a/GitVersion.yml b/GitVersion.yml index 3bfcb7a..85a7762 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,3 +1 @@ -mode: ContinuousDelivery -commit-message-incrementing: Disabled -legacy-semver-padding: 0 +workflow: GitHubFlow/v1 diff --git a/README.md b/README.md index dc5c118..1e52f4e 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ -Machine.Specifications.Runner.VisualStudio -===================== +# Machine.Specifications.Runner.VisualStudio Test Adapter for Machine.Specifications (MSpec) compatible with the .NET Framework and .NET Core: dotnet test, Visual Studio IDE, TFS, Visual Studio Team Services To open an issue, please visit the [core issue tracker](https://github.com/machine/machine.specifications/issues). -# Documentation +## Documentation Simply install the NuGet package and you will automatically be able to use the below to run tests: @@ -14,6 +13,6 @@ Simply install the NuGet package and you will automatically be able to use the b * vstest.console * Visual Studio Online -# Release Notes +## Release Notes Release notes are available here: https://github.com/machine/machine.specifications.runner.visualstudio/releases diff --git a/build.ps1 b/build.ps1 index 0c688fb..603c8f4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -10,7 +10,7 @@ if ($null -eq (Get-Command "dotnet" -ErrorAction Ignore)) { Push-Location (Split-Path $MyInvocation.MyCommand.Definition) try { - & dotnet run --project build --no-launch-profile -- $args + & dotnet run ./build/build.cs -- $args } finally { Pop-Location diff --git a/build.sh b/build.sh index 48dc148..7e6904a 100644 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ set -euo pipefail if which dotnet > /dev/null; then - dotnet run --project build --no-launch-profile -- "$@" + dotnet run ./build/build.cs -- "$@" else echo "error(1): Could not find 'dotnet', please install .NET SDK" exit 1 diff --git a/build/build.cs b/build/build.cs index cbbadae..68016ef 100644 --- a/build/build.cs +++ b/build/build.cs @@ -1,11 +1,10 @@ -using System; -using System.IO; -using System.Text.Json; -using System.Threading.Tasks; +#:package Bullseye@6.1.0 +#:package SimpleExec@13.0.0 + using static Bullseye.Targets; using static SimpleExec.Command; -var version = await GetGitVersion(); +var version = new GitVersion(); Target("clean", () => { @@ -17,12 +16,12 @@ } }); -Target("restore", DependsOn("clean"), () => +Target("restore", dependsOn: ["clean"], () => { Run("dotnet", "restore"); }); -Target("build", DependsOn("restore"), () => +Target("build", dependsOn: ["restore"], () => { Run("dotnet", "build " + "--no-restore " + @@ -33,45 +32,34 @@ $"--property InformationalVersion={version.InformationalVersion}"); }); -Target("test", DependsOn("build"), () => +Target("test", dependsOn: ["build"], () => { Run("dotnet", "test --configuration Release --no-restore --no-build"); }); -Target("package", DependsOn("build", "test"), () => +Target("package", dependsOn: ["build", "test"], () => { Run("dotnet", $"pack --configuration Release --no-restore --no-build --output artifacts --property Version={version.SemVer}"); }); -Target("publish", DependsOn("package"), () => +Target("publish", dependsOn: ["package"], () => { var apiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"); Run("dotnet", $"nuget push {Path.Combine("artifacts", "*.nupkg")} --api-key {apiKey} --source https://api.nuget.org/v3/index.json"); }); -Target("default", DependsOn("package")); +Target("default", dependsOn: ["package"]); await RunTargetsAndExitAsync(args); -async Task GetGitVersion() -{ - Run("dotnet", "tool restore"); - - var (value, _) = await ReadAsync("dotnet", "dotnet-gitversion"); - - return JsonSerializer.Deserialize(value); -} - public class GitVersion { - public string SemVer { get; set; } - - public string AssemblySemVer { get; set; } + public string SemVer { get; } = Environment.GetEnvironmentVariable("GitVersion_SemVer") ?? "0.1.0"; - public string AssemblySemFileVer { get; set; } + public string AssemblySemVer { get; } = Environment.GetEnvironmentVariable("GitVersion_AssemblySemVer") ?? "0.1.0"; - public string InformationalVersion { get; set; } + public string AssemblySemFileVer { get; } = Environment.GetEnvironmentVariable("GitVersion_AssemblySemFileVer") ?? "0.1.0"; - public string PreReleaseTag { get; set; } + public string InformationalVersion { get; } = Environment.GetEnvironmentVariable("GitVersion_InformationalVersion") ?? "0.1.0"; } diff --git a/build/build.csproj b/build/build.csproj deleted file mode 100644 index ddaa255..0000000 --- a/build/build.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - Exe - net8.0 - - - - - - - - -