diff --git a/.editorconfig b/.editorconfig index 4cab270..3ba6837 100644 --- a/.editorconfig +++ b/.editorconfig @@ -30,6 +30,8 @@ indent_size = 2 # Dotnet code style settings: [*.{cs,vb}] +tab_width = 4 + # Sort using and Import directives with System.* appearing first dotnet_sort_system_directives_first = true # Avoid "this." and "Me." if not necessary @@ -57,6 +59,9 @@ dotnet_style_require_accessibility_modifiers = omit_if_default:error # IDE0040: Add accessibility modifiers dotnet_diagnostic.IDE0040.severity = error +# IDE1100: Error reading content of source file 'Project.TargetFrameworkMoniker' (i.e. from ThisAssembly) +dotnet_diagnostic.IDE1100.severity = none + [*.cs] # Top-level files are definitely OK csharp_using_directive_placement = outside_namespace:silent diff --git a/.gitattributes b/.gitattributes index 7c37579..3095556 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,24 +1,9 @@ -# sln, csproj files (and friends) are always CRLF, even on linux -*.sln text eol=crlf -*.proj text eol=crlf -*.csproj text eol=crlf +# normalize by default +* text=auto encoding=UTF-8 +*.sh text eol=lf +*.sbn eol=lf # These are windows specific files which we may as well ensure are # always crlf on checkout *.bat text eol=crlf *.cmd text eol=crlf - -# Opt in known filetypes to always normalize line endings on checkin -# and always use native endings on checkout -*.c text -*.config text -*.h text -*.cs text -*.md text -*.tt text -*.txt text - -# Some must always be checked out as lf so enforce that for those files -# If these are not lf then bash/cygwin on windows will not be able to -# excute the files -*.sh text eol=lf \ No newline at end of file diff --git a/.github/actions/dotnet/action.yml b/.github/actions/dotnet/action.yml new file mode 100644 index 0000000..c876ae3 --- /dev/null +++ b/.github/actions/dotnet/action.yml @@ -0,0 +1,35 @@ +name: ⚙ dotnet +description: Configures dotnet if the repo/org defines the DOTNET custom property + +runs: + using: composite + steps: + - name: 🔎 dotnet + id: dotnet + shell: bash + run: | + VERSIONS=$(gh api repos/${{ github.repository }}/properties/values | jq -r '.[] | select(.property_name == "DOTNET") | .value') + # Remove extra whitespace from VERSIONS + VERSIONS=$(echo "$VERSIONS" | tr -s ' ' | tr -d ' ') + # Convert comma-separated to newline-separated + NEWLINE_VERSIONS=$(echo "$VERSIONS" | tr ',' '\n') + # Validate versions + while IFS= read -r version; do + if ! [[ $version =~ ^[0-9]+(\.[0-9]+(\.[0-9]+)?)?(\.x)?$ ]]; then + echo "Error: Invalid version format: $version" + exit 1 + fi + done <<< "$NEWLINE_VERSIONS" + # Write multiline output to $GITHUB_OUTPUT + { + echo 'versions<> $GITHUB_OUTPUT + + - name: ⚙ dotnet + if: steps.dotnet.outputs.versions != '' + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + ${{ steps.dotnet.outputs.versions }} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c95eb73..11c5d7d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -24,6 +24,11 @@ updates: Extensions: patterns: - "Microsoft.Extensions*" + exclude-patterns: + - "Microsoft.Extensions.AI*" + ExtensionsAI: + patterns: + - "Microsoft.Extensions.AI*" Web: patterns: - "Microsoft.AspNetCore*" @@ -38,3 +43,6 @@ updates: ProtoBuf: patterns: - "protobuf-*" + Spectre: + patterns: + - "Spectre.Console*" diff --git a/.github/release.yml b/.github/release.yml index 9a018cd..c178589 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -8,7 +8,6 @@ changelog: - invalid - wontfix - need info - - docs - techdebt authors: - devlooped-bot @@ -24,6 +23,7 @@ changelog: - title: 📝 Documentation updates labels: - docs + - documentation - title: 🔨 Other labels: - '*' diff --git a/.github/workflows/dotnet-env.yml b/.github/workflows/dotnet-env.yml new file mode 100644 index 0000000..a76d0fd --- /dev/null +++ b/.github/workflows/dotnet-env.yml @@ -0,0 +1,44 @@ +name: dotnet-env +on: + workflow_dispatch: + push: + branches: + - main + paths: + - '**/*.*proj' + +jobs: + which-dotnet: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: 🤖 defaults + uses: devlooped/actions-bot@v1 + with: + name: ${{ secrets.BOT_NAME }} + email: ${{ secrets.BOT_EMAIL }} + gh_token: ${{ secrets.GH_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: 🤘 checkout + uses: actions/checkout@v4 + with: + token: ${{ env.GH_TOKEN }} + + - name: 🤌 dotnet + uses: devlooped/actions-which-dotnet@v1 + + - name: ✍ pull request + uses: peter-evans/create-pull-request@v7 + with: + base: main + branch: which-dotnet + delete-branch: true + labels: dependencies + title: "⚙ Update dotnet versions" + body: "Update dotnet versions" + commit-message: "Update dotnet versions" + token: ${{ env.GH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/dotnet-file-core.yml b/.github/workflows/dotnet-file-core.yml new file mode 100644 index 0000000..824f52c --- /dev/null +++ b/.github/workflows/dotnet-file-core.yml @@ -0,0 +1,95 @@ +# Synchronizes .netconfig-configured files with dotnet-file +name: dotnet-file-core +on: + workflow_call: + secrets: + BOT_NAME: + required: false + BOT_EMAIL: + required: false + GH_TOKEN: + required: false + +env: + DOTNET_NOLOGO: true + +defaults: + run: + shell: pwsh + +jobs: + sync: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: 🤖 defaults + uses: devlooped/actions-bot@v1 + with: + name: ${{ secrets.BOT_NAME }} + email: ${{ secrets.BOT_EMAIL }} + gh_token: ${{ secrets.GH_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: 🤘 checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: main + token: ${{ env.GH_TOKEN }} + + - name: ⌛ rate + if: github.event_name != 'workflow_dispatch' + run: | + # add random sleep since we run on fixed schedule + sleep (get-random -max 60) + # get currently authenticated user rate limit info + $rate = gh api rate_limit | convertfrom-json | select -expandproperty rate + # if we don't have at least 100 requests left, wait until reset + if ($rate.remaining -lt 10) { + $wait = ($rate.reset - (Get-Date (Get-Date).ToUniversalTime() -UFormat %s)) + echo "Rate limit remaining is $($rate.remaining), waiting for $($wait / 1000) seconds to reset" + sleep $wait + $rate = gh api rate_limit | convertfrom-json | select -expandproperty rate + echo "Rate limit has reset to $($rate.remaining) requests" + } + + - name: 🔄 sync + run: | + dotnet tool update -g dotnet-gcm + # store credentials in plaintext for linux compat + git config --local credential.credentialStore plaintext + dotnet gcm store --protocol=https --host=github.com --username=$env:GITHUB_ACTOR --password=$env:GH_TOKEN + gh auth status + + dotnet tool update -g dotnet-file + $changelog = "$([System.IO.Path]::GetTempPath())dotnet-file.md" + dotnet file sync -c:$changelog + if (test-path $changelog) { + echo 'CHANGES<> $env:GITHUB_ENV + cat $changelog >> $env:GITHUB_ENV + echo 'EOF' >> $env:GITHUB_ENV + cat $changelog + } else { + echo 'No changelog was generated' + } + + - name: +Mᐁ includes + uses: devlooped/actions-includes@v1 + with: + validate: false + + - name: ✍ pull request + uses: peter-evans/create-pull-request@v8 + with: + base: main + branch: dotnet-file-sync + delete-branch: true + labels: dependencies + author: ${{ env.BOT_AUTHOR }} + committer: ${{ env.BOT_AUTHOR }} + commit-message: ⬆️ Bump files with dotnet-file sync + + ${{ env.CHANGES }} + title: "⬆️ Bump files with dotnet-file sync" + body: ${{ env.CHANGES }} + token: ${{ env.GH_TOKEN }} diff --git a/.github/workflows/dotnet-file.yml b/.github/workflows/dotnet-file.yml index 083f24d..402f6ba 100644 --- a/.github/workflows/dotnet-file.yml +++ b/.github/workflows/dotnet-file.yml @@ -12,5 +12,10 @@ env: jobs: run: + permissions: + contents: write uses: devlooped/oss/.github/workflows/dotnet-file-core.yml@main - secrets: inherit \ No newline at end of file + secrets: + BOT_NAME: ${{ secrets.BOT_NAME }} + BOT_EMAIL: ${{ secrets.BOT_EMAIL }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/includes.yml b/.github/workflows/includes.yml index 15a781e..fc6dbeb 100644 --- a/.github/workflows/includes.yml +++ b/.github/workflows/includes.yml @@ -5,12 +5,16 @@ on: branches: - 'main' paths: - - '**.md' + - '**.md' - '!changelog.md' + - 'osmfeula.txt' jobs: includes: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: 🤖 defaults uses: devlooped/actions-bot@v1 @@ -28,14 +32,33 @@ jobs: - name: +Mᐁ includes uses: devlooped/actions-includes@v1 + - name: 📝 OSMF EULA + shell: pwsh + run: | + $file = "osmfeula.txt" + $props = "src/Directory.Build.props" + if (-not (test-path $file) -or -not (test-path $props)) { + exit 0 + } + + $product = dotnet msbuild $props -getproperty:Product + if (-not $product) { + write-error 'To use OSMF EULA, ensure the $(Product) property is set in Directory.props' + exit 1 + } + + ((get-content -raw $file) -replace '\$product\$',$product).trim() | set-content $file + - name: ✍ pull request - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v8 with: - add-paths: '**.md' + add-paths: | + **.md + *.txt base: main branch: markdown-includes delete-branch: true - labels: docs + labels: dependencies author: ${{ env.BOT_AUTHOR }} committer: ${{ env.BOT_AUTHOR }} commit-message: +Mᐁ includes diff --git a/.gitignore b/.gitignore index 6639458..0fe79fb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,10 @@ BenchmarkDotNet.Artifacts /app .vs .vscode +.genaiscript .idea local.settings.json +.env *.suo *.sdf diff --git a/.netconfig b/.netconfig index 998f5a0..54bf22f 100644 --- a/.netconfig +++ b/.netconfig @@ -14,23 +14,23 @@ skip [file ".editorconfig"] url = https://github.com/devlooped/oss/blob/main/.editorconfig - sha = e81ab754b366d52d92bd69b24bef1d5b1c610634 - etag = 7298c6450967975a8782b5c74f3071e1910fc59686e48f9c9d5cd7c68213cf59 + sha = a62c45934ac2952f2f5d54d8aea4a7ebc1babaff + etag = b5e919b472a52d4b522f86494f0f2c0ba74a6d9601454e20e4cbaf744317ff62 weak [file ".gitattributes"] url = https://github.com/devlooped/oss/blob/main/.gitattributes - sha = 0683ee777d7d878d4bf013d7deea352685135a05 - etag = 7acb32f5fa6d4ccd9c824605a7c2b8538497f0068c165567807d393dcf4d6bb7 + sha = 4a9aa321c4982b83c185cf8dffed181ff84667d5 + etag = 09cad18280ed04b67f7f87591e5481510df04d44c3403231b8af885664d8fd58 weak [file ".github/dependabot.yml"] url = https://github.com/devlooped/oss/blob/main/.github/dependabot.yml - sha = 49661dbf0720cde93eb5569be7523b5912351560 - etag = c147ea2f3431ca0338c315c4a45b56ee233c4d30f8d6ab698d0e1980a257fd6a + sha = e733294084fb3e75d517a2e961e87df8faae7dc6 + etag = 3bf8d9214a15c049ca5cfe80d212a8cbe4753b8a638a9804ef73d34c7def9618 weak [file ".github/release.yml"] url = https://github.com/devlooped/oss/blob/main/.github/release.yml - sha = 1afd173fe8f81b510c597737b0d271218e81fa73 - etag = 482dc2c892fc7ce0cb3a01eb5d9401bee50ddfb067d8cb85873555ce63cf5438 + sha = 0c23e24704625cf75b2cb1fdc566cef7e20af313 + etag = 310df162242c95ed19ed12e3c96a65f77e558b46dced676ad5255eb12caafe75 weak [file ".github/workflows/build.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/build.yml @@ -47,13 +47,13 @@ weak [file ".github/workflows/dotnet-file.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/dotnet-file.yml - sha = 7afe350f7e80a230e922db026d4e1198ba15cae1 - etag = 65e9794df6caff779eb989c8f71ddf4d4109b24a75af79e4f8d0fe6ba7bd9702 + sha = 8fa147d4799d73819040736c399d0b1db2c2d86c + etag = 1ca805a23656e99c03f9d478dba8ccef6e571f5de2ac0e9bb7e3c5216c99a694 weak [file ".github/workflows/includes.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/includes.yml - sha = d152e7437fd0d6f6d9363d23cb3b78c07335ea49 - etag = ec40db34f379d0c6d83b2ec15624f330318a172cc4f85b5417c63e86eaf601df + sha = 06628725a6303bb8c4cf3076a384fc982a91bc0b + etag = 478f91d4126230e57cc601382da1ba23f9daa054645b4af89800d8dd862e64fd weak [file ".github/workflows/publish.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/publish.yml @@ -65,8 +65,8 @@ weak [file ".gitignore"] url = https://github.com/devlooped/oss/blob/main/.gitignore - sha = 02811fa23b0a102b9b33048335d41e515bf75737 - etag = a9c37ae312afac14b78436a7d018af4483d88736b5f780576f2c5a0b3f14998c + sha = 3776526342afb3f57da7e80f2095e5fdca3c31c9 + etag = 11767f73556aa4c6c8bcc153b77ee8e8114f99fa3b885b0a7d66d082f91e77b3 weak [file "Directory.Build.rsp"] url = https://github.com/devlooped/oss/blob/main/Directory.Build.rsp @@ -75,8 +75,8 @@ weak [file "_config.yml"] url = https://github.com/devlooped/oss/blob/main/_config.yml - sha = fa83a5161ba52bc5d510ce0ba75ee0b1f8d4bc63 - etag = 9139148f845adf503fd3c3c140eb64421fc476a1f9c027fc50825c0efb05f557 + sha = 68b409c486842062e0de0e5b11e6fdb7cd12d6e2 + etag = d608aa0ddaedc2d8a87260f50756e8d8314964ad4671b76bd085bcb458757010 weak [file "assets/css/style.scss"] url = https://github.com/devlooped/oss/blob/main/assets/css/style.scss @@ -90,11 +90,31 @@ weak [file "src/Directory.Build.props"] url = https://github.com/devlooped/oss/blob/main/src/Directory.Build.props - sha = b76de49afb376aa48eb172963ed70663b59b31d3 - etag = c8b56f3860cc7ccb8773b7bd6189f5c7a6e3a2c27e9104c1ee201fbdc5af9873 + sha = 0ff8b7b79a82112678326d1dc5543ed890311366 + etag = 3ebde0a8630d526b80f15801179116e17a857ff880a4442e7db7b075efa4fd63 weak [file "src/Directory.Build.targets"] url = https://github.com/devlooped/oss/blob/main/src/Directory.Build.targets - sha = 33a20db26e47589769284817b271ce67ea9ccfd8 - etag = 1a3a0151b5771ee97ed8351254ff4c18a0ff568e0df5c33c6830f069bfbb067b + sha = 4339749ef4b8f66def75931df09ef99c149f8421 + etag = 8b4492765755c030c4c351e058a92f53ab493cab440c1c0ef431f6635c4dae0e + weak +[file ".github/actions/dotnet/action.yml"] + url = https://github.com/devlooped/oss/blob/main/.github/actions/dotnet/action.yml + sha = f2b690ce307acb76c5b8d7faec1a5b971a93653e + etag = 27ea11baa2397b3ec9e643a935832da97719c4e44215cfd135c49cad4c29373f + weak +[file ".github/workflows/dotnet-env.yml"] + url = https://github.com/devlooped/oss/blob/main/.github/workflows/dotnet-env.yml + sha = 77e83f238196d2723640abef0c7b6f43994f9747 + etag = fcb9759a96966df40dcd24906fd328ddec05953b7e747a6bb8d0d1e4c3865274 + weak +[file ".github/workflows/dotnet-file-core.yml"] + url = https://github.com/devlooped/oss/blob/main/.github/workflows/dotnet-file-core.yml + sha = d00364faaa84c414b868c0758b9e1a5fc0520dcc + etag = d3b7d8ca69e6d22066a2348f02b409e2d6fb900f5039f68940c14e4ce6021826 + weak +[file "src/nuget.config"] + url = https://github.com/devlooped/oss/blob/main/src/nuget.config + sha = 032439dbf180fca0539a5bd3a019f18ab3484b76 + etag = da7c0104131bd474b52fc9bc9f9bda6470e24ae38d4fb9f5c4f719bc01370ab5 weak diff --git a/_config.yml b/_config.yml index a61f7e0..04e6093 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,3 @@ theme: jekyll-theme-slate -exclude: [ 'src/', '*.sln', 'Gemfile*', '*.rsp' ] \ No newline at end of file +exclude: [ 'src/', '*.sln', '*.slnx', 'Gemfile*', '*.rsp' ] diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 381c383..29281ee 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,4 +1,4 @@ - + @@ -20,6 +20,7 @@ Daniel Cazzulino + Devlooped Copyright (C) Daniel Cazzulino and Contributors. All rights reserved. false MIT @@ -42,6 +43,10 @@ true + + false + + true @@ -126,11 +131,22 @@ <_VersionLabel>$(_VersionLabel.Replace('/merge', '')) <_VersionLabel>$(_VersionLabel.Replace('/', '-')) + + <_VersionLabel>$(_VersionLabel.Replace('_', '-')) $(_VersionLabel) $(_VersionLabel) + + + true + 42.42.0 + $(VersionSuffix).$(GITHUB_RUN_NUMBER) @@ -153,6 +169,18 @@ + + + 1.0.0 + $(VersionPrefix)-$(VersionSuffix) + $(VersionPrefix) + + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 20d7f0b..083afa6 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -34,23 +34,28 @@ + @@ -101,19 +106,17 @@ $(BUDDY_EXECUTION_BRANCH) - - - PrepareResources;$(CoreCompileDependsOn) + + + CoreResGen;$(CoreCompileDependsOn) - + - - - + + - MSBuild:Compile $(IntermediateOutputPath)\$([MSBuild]::ValueOrDefault('%(RelativeDir)', '').Replace('\', '.').Replace('/', '.'))%(Filename).g$(DefaultLanguageSourceExtension) $(Language) $(RootNamespace) @@ -162,6 +165,9 @@ @(_GitSourceRoot) + + $([System.IO.Path]::GetFileNameWithoutExtension($(PrivateRepositoryUrl))) + $(ProductFromUrl) @@ -172,9 +178,9 @@ Condition="'$(SourceControlInformationFeatureSupported)' == 'true' And '$(IsPackable)' == 'true'"> - $(RepositoryUrl) + $(RepositoryUrl.Replace('.git', '')) $(Description) - $(RepositoryUrl)/blob/main/changelog.md + $(RepositoryUrl.Replace('.git', ''))/blob/main/changelog.md diff --git a/src/nuget.config b/src/nuget.config new file mode 100644 index 0000000..1c18c96 --- /dev/null +++ b/src/nuget.config @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + +