From 5592a565c043ae807113a41294aa2f3d33d49e94 Mon Sep 17 00:00:00 2001 From: Tyler Date: Sun, 21 Jul 2024 20:20:23 -0400 Subject: [PATCH] Initial commit --- .../actions/tools/annotation/error/action.yml | 17 + .../tools/annotation/notice/action.yml | 17 + .../tools/annotation/warning/action.yml | 17 + .github/actions/tools/exit-code/action.yml | 47 +++ .github/dependabot.yml | 20 + .github/ruleset.json | 56 +++ .github/workflows/ct-matrix.yml | 124 ++++++ .github/workflows/push-creates-tag.yml | 80 ++++ .../workflows/tag-creates-nuget-package.yml | 84 ++++ .gitignore | 398 ++++++++++++++++++ LICENSE | 7 + Nuget.config | 12 + README.md | 64 +++ Testing.sln | 10 + 14 files changed, 953 insertions(+) create mode 100644 .github/actions/tools/annotation/error/action.yml create mode 100644 .github/actions/tools/annotation/notice/action.yml create mode 100644 .github/actions/tools/annotation/warning/action.yml create mode 100644 .github/actions/tools/exit-code/action.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/ruleset.json create mode 100644 .github/workflows/ct-matrix.yml create mode 100644 .github/workflows/push-creates-tag.yml create mode 100644 .github/workflows/tag-creates-nuget-package.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Nuget.config create mode 100644 README.md create mode 100644 Testing.sln diff --git a/.github/actions/tools/annotation/error/action.yml b/.github/actions/tools/annotation/error/action.yml new file mode 100644 index 0000000..a83af39 --- /dev/null +++ b/.github/actions/tools/annotation/error/action.yml @@ -0,0 +1,17 @@ +name: Error Annotation +description: Error Annotation + +inputs: + message: + description: "Message to Display" + required: true + +runs: + using: "composite" + steps: + - uses: actions/github-script@v7.0.1 + with: + script: | + var message = '${{ inputs.message }}'; + message = message.replace(/(\r\n|\n|\r)/gm, ''); + core.error(message); \ No newline at end of file diff --git a/.github/actions/tools/annotation/notice/action.yml b/.github/actions/tools/annotation/notice/action.yml new file mode 100644 index 0000000..2344420 --- /dev/null +++ b/.github/actions/tools/annotation/notice/action.yml @@ -0,0 +1,17 @@ +name: Notice Annotation +description: Notice Annotation + +inputs: + message: + description: "Message to Display" + required: true + +runs: + using: "composite" + steps: + - uses: actions/github-script@v7.0.1 + with: + script: | + var message = '${{ inputs.message }}'; + message = message.replace(/(\r\n|\n|\r)/gm, ''); + core.notice(message); \ No newline at end of file diff --git a/.github/actions/tools/annotation/warning/action.yml b/.github/actions/tools/annotation/warning/action.yml new file mode 100644 index 0000000..bd9d927 --- /dev/null +++ b/.github/actions/tools/annotation/warning/action.yml @@ -0,0 +1,17 @@ +name: Warning Annotation +description: Warning Annotation + +inputs: + message: + description: "Message to Display" + required: true + +runs: + using: "composite" + steps: + - uses: actions/github-script@v7.0.1 + with: + script: | + var message = '${{ inputs.message }}'; + message = message.replace(/(\r\n|\n|\r)/gm, ''); + core.warning(message); \ No newline at end of file diff --git a/.github/actions/tools/exit-code/action.yml b/.github/actions/tools/exit-code/action.yml new file mode 100644 index 0000000..0e4a053 --- /dev/null +++ b/.github/actions/tools/exit-code/action.yml @@ -0,0 +1,47 @@ +name: Exit Code +description: Exit Code + +inputs: + code: + description: "Exit Code Number (ensure it is unique across all workflows/actions)" + required: true + message: + description: "Exit Message" + required: false + default: '' + level: + description: "Annotation Level (Error, Warning, Debug, Notice)" + default: error + +runs: + using: "composite" + steps: + - id: createMessage + uses: actions/github-script@v7.0.1 + with: + result-encoding: string + script: > + return '[Exit Code: ${{ inputs.code }}] ${{ inputs.message }} | Note: Search for "code: ${{ inputs.code }}" in the .github/ directory to find the source of this error' + + - uses: ./.github/actions/tools/annotation/error + if: inputs.level == 'error' + with: + message: ${{ steps.createMessage.outputs.result }} + + - uses: ./.github/actions/tools/annotation/warning + if: inputs.level == 'warning' + with: + message: ${{ steps.createMessage.outputs.result }} + + - uses: ./.github/actions/tools/annotation/debug + if: inputs.level == 'debug' + with: + message: ${{ steps.createMessage.outputs.result }} + + - uses: ./.github/actions/tools/annotation/notice + if: inputs.level == 'notice' + with: + message: ${{ steps.createMessage.outputs.result }} + + - shell: cmd + run: exit ${{ inputs.code }} \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5f1f901 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +version: 2 + +updates: + - package-ecosystem: github-actions + directory: "/" + commit-message: + prefix: "(dependabot)" + reviewers: + - "${{ secrets.GHA_REVIEWER }}" + schedule: + interval: weekly + + - package-ecosystem: nuget + directory: "/" + commit-message: + prefix: "(dependabot)" + reviewers: + - "${{ secrets.NUGET_REVIEWER }}" + schedule: + interval: weekly diff --git a/.github/ruleset.json b/.github/ruleset.json new file mode 100644 index 0000000..c799030 --- /dev/null +++ b/.github/ruleset.json @@ -0,0 +1,56 @@ +{ + "id": 876151, + "name": "TJC NuGet Package Ruleset", + "target": "branch", + "source_type": "Repository", + "source": "TJC-Tools/TJC.Singleton", + "enforcement": "active", + "conditions": { + "ref_name": { + "exclude": [], + "include": [ + "~DEFAULT_BRANCH" + ] + } + }, + "rules": [ + { + "type": "deletion" + }, + { + "type": "non_fast_forward" + }, + { + "type": "pull_request", + "parameters": { + "required_approving_review_count": 1, + "dismiss_stale_reviews_on_push": true, + "require_code_owner_review": true, + "require_last_push_approval": true, + "required_review_thread_resolution": false + } + }, + { + "type": "required_linear_history" + }, + { + "type": "required_status_checks", + "parameters": { + "strict_required_status_checks_policy": true, + "required_status_checks": [ + { + "context": "Continuous Testing (Testing.sln, 8.0.x)", + "integration_id": 15368 + } + ] + } + } + ], + "bypass_actors": [ + { + "actor_id": 1, + "actor_type": "OrganizationAdmin", + "bypass_mode": "pull_request" + } + ] +} diff --git a/.github/workflows/ct-matrix.yml b/.github/workflows/ct-matrix.yml new file mode 100644 index 0000000..c5699ec --- /dev/null +++ b/.github/workflows/ct-matrix.yml @@ -0,0 +1,124 @@ +name: Testing Matrix +run-name: PR#${{ github.event.number }}${{ github.event.pull_request.draft && ' [DRAFT]' || '' }} - Continuous Testing (Matrix) - (${{ github.event.pull_request.head.ref }}-to-${{ github.event.pull_request.base.ref }}) + +on: + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - ready_for_review + +env: + build_directory: Build + test_project_suffix: Tests + +concurrency: + group: Continuous-Testing-${{ github.event.pull_request.head.ref }}-to-${{ github.event.pull_request.base.ref }} + cancel-in-progress: true + +jobs: + buildAndRunTests: + name: Continuous Testing + permissions: write-all + runs-on: windows-2022 + if: ${{ !github.event.pull_request.draft }} + strategy: + fail-fast: false + matrix: + solution: [ Testing.sln ] + dotnet-version: [ '8.0.x' ] + + steps: + - name: Checkout [${{ github.event.pull_request.head.ref }}] + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.TJC_TOKEN || secrets.GITHUB_TOKEN }} + submodules: recursive + + #################################################################################################### + ### Initialize ### + #################################################################################################### + # Check for Changes in the Non-Ignored Files; If there are none, then Skip Tests + # Skip: README, LICENSE, .gitignore, GitHub Workflows & Actions, etc. + - name: Check for Changes to Determine if Tests can be Skipped + id: getChanges + uses: tj-actions/changed-files@v44.5.5 + with: + files_ignore: | + README.md + LICENSE + .github/** + .gitignore + + - name: Check if Tests can be Skipped + id: getCanSkip + uses: actions/github-script@v7.0.1 + with: + result-encoding: string + script: | + var changes = '${{ fromJSON(steps.getChanges.outputs.any_modified) }}' + var skip = changes == 'false' + console.log('Skip:', skip) + return skip + + #################################################################################################### + ### Prepare to Run Tests ### + #################################################################################################### + - name: Setup .NET [${{ matrix.dotnet-version }}] + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ matrix.dotnet-version }} + + - name: Setup NuGet + uses: NuGet/setup-nuget@v2.0.0 + + - name: Restore NuGet + run: nuget restore ${{ env.PROJECT_FILE_PATH }} + + - name: Restore Dependencies + if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} + run: dotnet restore + + #################################################################################################### + ### Run Tests ### + #################################################################################################### + - name: Build + if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} + run: dotnet build --no-restore + + - name: Error - Build Failed for ${{ matrix.solution }} + if: failure() + uses: ./.github/actions/tools/annotation/error + with: + message: '[Error] Build Failed for ${{ matrix.solution }}' + + # Test 2 - Run All Unit Tests within Project + # Note: This Action Requires Windows + - name: Run Tests for [${{ matrix.solution }}] + if: ${{ !fromJSON(steps.getCanSkip.outputs.result) }} + run: dotnet test --no-build --verbosity normal + + - name: Error - Tests Failed for ${{ matrix.solution }} + if: failure() + uses: ./.github/actions/tools/annotation/error + with: + message: '[Error] Tests Failed for ${{ matrix.solution }}' + + #################################################################################################### + ### Notify Success ### + #################################################################################################### + - name: Success - Successfully Built & Ran Tests for ${{ matrix.solution }} + if: success() && !fromJSON(steps.getCanSkip.outputs.result) + uses: ./.github/actions/tools/annotation/notice + with: + message: '[Success] Built & Ran Tests for ${{ matrix.solution }}' + + - name: Success - Skipped Tests for ${{ matrix.solution }} + if: success() && fromJSON(steps.getCanSkip.outputs.result) + uses: ./.github/actions/tools/annotation/notice + with: + message: '[Success] Skipped Tests for ${{ matrix.solution }}' diff --git a/.github/workflows/push-creates-tag.yml b/.github/workflows/push-creates-tag.yml new file mode 100644 index 0000000..d99b75a --- /dev/null +++ b/.github/workflows/push-creates-tag.yml @@ -0,0 +1,80 @@ +name: Push -> Tag +run-name: Push [${{ github.ref_name }}] -> Tag + +on: + push: + branches: + - main + +concurrency: + group: Versioning-${{ github.ref_name }} + cancel-in-progress: false + +env: + PROJECT_DIR_PATH: {REPLACE_ME_WITH_FOLDER_OF_CSPROJ} # E.g. TJC.LibraryName + +jobs: + incrementPatch: + name: Push [${{ github.event.head_commit.message }}] + permissions: write-all + runs-on: windows-2022 + outputs: + VersionNumber: ${{ steps.incrementVersion.outputs.result }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.TJC_TOKEN || secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Check for Changes to See if Tagging can be Skipped + id: getChanges + uses: tj-actions/changed-files@v44.5.5 + with: + files: ${{ env.PROJECT_DIR_PATH }}/** + + - name: Get Last Version + id: getLastVersion + if: ${{ steps.getChanges.outputs.any_modified != 'false' }} + uses: actions/github-script@v7.0.1 + with: + result-encoding: string + script: | + try { + var latestTag = require("child_process").execSync("git describe --tags").toString().trim() + console.log('Latest Tag:', latestTag) + return latestTag + } catch { + return "" + } + + - name: Get Next Version [${{ steps.getLastVersion.outputs.result }}] + id: getNextVersion + if: ${{ steps.getChanges.outputs.any_modified != 'false' }} + uses: actions/github-script@v7.0.1 + with: + result-encoding: string + script: | + var latestTag = "${{ steps.getLastVersion.outputs.result }}" + if (latestTag == "") + return "v0.1.0" + var ver = latestTag.replace("v","").split("-")[0] + console.log('Last Version:', "v" + ver) + var major = ver.split(".")[0] + var minor = ver.split(".")[1] + var patch = parseInt(ver.split(".")[2]) + 1 + var next = "v" + major + "." + minor + "." + patch + console.log('Next Version:', next) + return next + + - name: Tag Version [${{ steps.getNextVersion.outputs.result }}] + if: ${{ steps.getChanges.outputs.any_modified != 'false' }} + run: | + git tag ${{ steps.getNextVersion.outputs.result }} + git push origin tag ${{ steps.getNextVersion.outputs.result }} + + - name: ${{ (steps.getChanges.outputs.any_modified == 'false') && 'Skipped Incrementing Version' || format('Incremented Version [{0}]', steps.getNextVersion.outputs.result) }} + if: success() + uses: ./.github/actions/tools/annotation/notice + with: + message: ${{ (steps.getChanges.outputs.any_modified == 'false') && 'Skipped Incrementing Version' || format('Incremented Version [{0}]', steps.getNextVersion.outputs.result) }} diff --git a/.github/workflows/tag-creates-nuget-package.yml b/.github/workflows/tag-creates-nuget-package.yml new file mode 100644 index 0000000..f68e20a --- /dev/null +++ b/.github/workflows/tag-creates-nuget-package.yml @@ -0,0 +1,84 @@ +name: Tag -> Create Package +run-name: Tag [${{ github.ref_name }}] -> Create Package + +on: + push: + tags: v** + +env: + PROJECT_FILE_PATH: {REPLACE_ME_WITH_PATH_TO_CSPROJ} # E.g. TJC.LibraryName/TJC.LibraryName.csproj + PROJECT_DIR_PATH: {REPLACE_ME_WITH_FOLDER_OF_CSPROJ} # E.g. TJC.LibraryName + +jobs: + package: + name: Create Package [${{ github.ref_name }}] + runs-on: windows-2022 + permissions: write-all + steps: + - name: Checkout [${{ github.ref_name }}] + uses: actions/checkout@v4 + with: + token: ${{ secrets.TJC_TOKEN || secrets.GITHUB_TOKEN }} + submodules: recursive + fetch-depth: 0 + + - name: Add GitHub NuGet Source + run: dotnet nuget add source --username "${{ github.repository_owner }}" --password ${{ secrets.TJC_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.*' + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v2.0.0 + + - name: Restore NuGet + run: nuget restore ${{ env.PROJECT_FILE_PATH }} + + - name: Get Version without Prefix/Suffix + id: getVer + uses: actions/github-script@v7.0.1 + with: + result-encoding: string + script: | + var tag = '${{ github.ref_name }}' + var simple = tag.replace('v','') + simple = simple.split('-')[0] + console.log('Version:', simple) + return simple + + - name: Build DLL + run: msbuild ${{ env.PROJECT_FILE_PATH }} /p:Configuration=Release + + - name: Pack NuGet Package [${{ steps.getVer.outputs.result }}] + run: dotnet pack ${{ env.PROJECT_FILE_PATH }} -p:Version='${{ steps.getVer.outputs.result }}' -c Release + + - name: List + run: ls ${{ env.PROJECT_DIR_PATH }}/bin/Release + + - name: Push Package to NuGet & GitHub Packages + shell: powershell + run: | + $files = gci -File "${{ env.PROJECT_DIR_PATH }}/bin/Release/*.nupkg" + foreach ($file in $files) + { + echo "Pushing NuGet Package: $file" + dotnet nuget push "$file" --api-key ${{ secrets.TJC_NUGET_PUBLISH }} --source https://api.nuget.org/v3/index.json + dotnet nuget push "$file" --api-key ${{ secrets.TJC_TOKEN }} --source github + } + + - name: ${{ format('Published NuGet Package [{0}]', steps.getVer.outputs.result) }} + if: success() + uses: ./.github/actions/tools/annotation/notice + with: + message: ${{ format('Published NuGet Package [{0}]', steps.getVer.outputs.result) }} + + - name: Error - Failed to Publish NuGet Package + if: failure() + uses: ./.github/actions/tools/annotation/error + with: + message: '[Error] Failed to Publish NuGet Package' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a30d25 --- /dev/null +++ b/.gitignore @@ -0,0 +1,398 @@ +## 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/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# 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/ +[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/ +# 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.* + +# 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/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# 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 +*.tlog +*.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 + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# 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 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 +**/*.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/ + +# 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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2e9a488 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2024 Tyler Carrol + +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. \ No newline at end of file diff --git a/Nuget.config b/Nuget.config new file mode 100644 index 0000000..313afde --- /dev/null +++ b/Nuget.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c0233e --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# NuGet Package Template +This repository is a template for **Public C# Libraries** that will be published as **NuGet Packages**. + +## Setup +1. Clone the repository +2. Open `Testing.sln` & create a **Class Library** (`TJC.LibraryName/TJC.LibraryName.csproj`) & **MSTest Test Project** (`TJC.LibraryName.Tests/TJC.LibraryName.Tests.csproj`) +3. Set **NuGet Package** settings in the `.csproj`, like below +```xml + + net8.0 + enable + enable + TJC LibraryName + Library Description + https://github.com/TJC-Tools/TJC.LibraryName + README.md + +``` +4. Copy `Nuget.config` into the `TJC.LibraryName` directory & add the following lines to the `.csproj` +```xml + + + + + + + PreserveNewest + + + + + + True + \ + + +``` +5. Add the `InternalsVisibleToAttribute` to the **project** `.csproj`, so that the **tests** `.csproj` can see `internal` **classes**, **methods** & **properties** +```xml + + + <_Parameter1>TJC.LibraryName.Tests + + +``` +6. In `workflows` replace the `{REPLACE_ME}` placeholders +7. In the `README.md` delete everything above the `---` and add some initial documentation +8. Delete the [ruleset](.github/ruleset.json) (back it up somewhere locally for later) +9. Amend the initial commit & force push the changes using `git push -f` +10. ~~Set `GitHub NuGet Package` visibility to `public`~~ +11. **Repository Settings** + - Import repository permissions from the local backup of [ruleset](.github/ruleset.json) + - **Pull Requests** + - Disable `Allow merge commits` + - Enable `Always suggest updating pull request branches` + - Enable `Automatically delete head branches` +12. On **GitHub** deselect **Releases**, **Packages** & **Deployments** +13. On **GitHub**, add a **Description**, **Website** link to [www.nuget.org/packages/TJC.LibraryName](https://www.nuget.org/packages/TJC.Test) & **Topics** + +--- + +[![NuGet Version and Downloads count](https://buildstats.info/nuget/TJC.LibraryName)](https://www.nuget.org/packages/TJC.LibraryName) + +## Items diff --git a/Testing.sln b/Testing.sln new file mode 100644 index 0000000..915d80d --- /dev/null +++ b/Testing.sln @@ -0,0 +1,10 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34316.72 +MinimumVisualStudioVersion = 10.0.40219.1 +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal