diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df41a57..2346fd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,6 +61,14 @@ jobs: - name: 🤘 checkout uses: actions/checkout@v4 + - name: ⚙ dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.x + 8.x + 9.x + - name: 🙏 build run: dotnet build -m:1 -bl:build.binlog diff --git a/.github/workflows/dotnet-file-core.yml b/.github/workflows/dotnet-file-core.yml new file mode 100644 index 0000000..1230687 --- /dev/null +++ b/.github/workflows/dotnet-file-core.yml @@ -0,0 +1,88 @@ +# Synchronizes .netconfig-configured files with dotnet-file +name: dotnet-file-core +on: + workflow_call: + +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@v7 + 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/includes.yml b/.github/workflows/includes.yml index 15a781e..d787ccb 100644 --- a/.github/workflows/includes.yml +++ b/.github/workflows/includes.yml @@ -11,6 +11,9 @@ on: jobs: includes: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: 🤖 defaults uses: devlooped/actions-bot@v1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c7001f4..8eeedca 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,14 @@ jobs: - name: 🤘 checkout uses: actions/checkout@v4 + - name: ⚙ dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.x + 8.x + 9.x + - name: 🙏 build run: dotnet build -m:1 -bl:build.binlog diff --git a/.gitignore b/.gitignore index 6639458..2ac54a7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ BenchmarkDotNet.Artifacts /app .vs .vscode +.genaiscript .idea local.settings.json diff --git a/.netconfig b/.netconfig index a3ec867..b129e17 100644 --- a/.netconfig +++ b/.netconfig @@ -56,13 +56,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 = 59aaf432369b5ea597831d4feec5a6ac4024c2e3 + etag = 1374e3f8c9b7af69c443605c03f7262300dcb7d783738d9eb9fe84268ed2d10c weak [file ".gitignore"] url = https://github.com/devlooped/oss/blob/main/.gitignore - sha = 02811fa23b0a102b9b33048335d41e515bf75737 - etag = a9c37ae312afac14b78436a7d018af4483d88736b5f780576f2c5a0b3f14998c + sha = e0be248fff1d39133345283b8227372b36574b75 + etag = c449ec6f76803e1891357ca2b8b4fcb5b2e5deeff8311622fd92ca9fbf1e6575 weak [file "Directory.Build.rsp"] url = https://github.com/devlooped/oss/blob/main/Directory.Build.rsp @@ -112,8 +112,8 @@ weak [file ".github/workflows/includes.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/includes.yml - sha = d152e7437fd0d6f6d9363d23cb3b78c07335ea49 - etag = ec40db34f379d0c6d83b2ec15624f330318a172cc4f85b5417c63e86eaf601df + sha = 85829f2510f335f4a411867f3dbaaa116c3ab3de + etag = 086f6b6316cc6ea7089c0dcc6980be519e6ed6e6201e65042ef41b82634ec0ee weak [file ".github/workflows/combine-prs.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/combine-prs.yml @@ -225,16 +225,16 @@ weak [file "src/SponsorLink/SponsorLink/SponsorLink.cs"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.cs - sha = efda32a6eaaeffa485fb480e31adfd2f8130bd48 + sha = 3f72a9fd35274a659dd380a7d5b747d71b9732a1 - etag = 555128f4279241225b4dc8bb2ec8835894edfe9f6b9223399ee8cb3dc7adaf06 + etag = 616598e0ecb6d2ce97660aa6ac049e2a31a1c953669743b7b612b61d40c37706 weak [file "src/SponsorLink/SponsorLink/SponsorLink.csproj"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.csproj - sha = f74ea7a8c7f81c5bceefb3ed7ef4249b1d8574a3 + sha = 0d22f1ee7d7afc93e11060887de0e1773884978e - etag = d87299dc7de83bd69c5b3232e8f58c8df66dc587c22c6f4539b8829d9d860c52 + etag = dbf30ffb9baa63e45a4c821bc1433e4289b9af84855c2a306eaa116874a1c9f2 weak [file "src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLinkAnalyzer.cs @@ -322,10 +322,10 @@ weak [file "src/SponsorLink/Tests/Tests.csproj"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/Tests.csproj - sha = b75813df2c8623fbf084e54617c1131dde31180c + sha = 0d22f1ee7d7afc93e11060887de0e1773884978e - etag = 145c7fb55216852edef0876fc52d0e706c79e3c1f2aab3782ef900d9c34884f8 + etag = 5db4da024e4ecfb90be14feb4db952efa2109ee2ec84e715921291808d57b749 weak [file "src/SponsorLink/Tests/keys/kzu.key"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/keys/kzu.key @@ -374,15 +374,15 @@ weak [file "src/SponsorLink/SponsorLink.Analyzer.targets"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Analyzer.targets - sha = 1f083cf675260f176cc36c70220080a2e6211ddf + sha = fb82cf346cea86140a51ae49b9bc730d72f7c7ac - etag = 25b42de9005557475d1d21f28822d690727c2cc0cddc64fdd0d6c13da672cee8 + etag = 284f794d03adabf10ac5e25ef87d257821a82eac112efe65d6fe23d675f9af7f weak [file "src/SponsorLink/SponsorLink.Analyzer.Tests.targets"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Analyzer.Tests.targets - sha = 058dbbc3582042d7fdcaf5741db59d2b46ea1222 - etag = 2d8bac60892b5565e3419b1fa775c5b977af202304ef3c25a4c6d04c7ac9faf1 + sha = df44ccc14cc11b5674c55aca9ba8596bdbcf8438 + etag = a3e9cbcc227dd56a7bed236eaded136f1b80f9f36a4fabce8be695ee844bf881 weak [file "src/TableStorage/System/Chunk.cs"] url = https://github.com/dotnet/runtime/blob/main/src/libraries/System.Linq/src/System/Linq/Chunk.cs @@ -413,3 +413,8 @@ etag = 1d6ca61601815a20581fc13f9efdad151ee0e5cf952318723265d5c183d3e1cc weak +[file ".github/workflows/dotnet-file-core.yml"] + url = https://github.com/devlooped/oss/blob/main/.github/workflows/dotnet-file-core.yml + sha = 875284ba5d565f529aba2f5d24ab8ed27c1d1c79 + etag = 8de1d974bf73b1945b5c8be684c3a0b7364114a0d795c9d68837aed9b3aff331 + weak diff --git a/readme.md b/readme.md index 14ab625..d87302f 100644 --- a/readme.md +++ b/readme.md @@ -333,7 +333,6 @@ The versioning scheme for packages is: [![Clarius Org](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/clarius.png "Clarius Org")](https://github.com/clarius) -[![Kirill Osenkov](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/KirillOsenkov.png "Kirill Osenkov")](https://github.com/KirillOsenkov) [![MFB Technologies, Inc.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/MFB-Technologies-Inc.png "MFB Technologies, Inc.")](https://github.com/MFB-Technologies-Inc) [![Torutek](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/torutek-gh.png "Torutek")](https://github.com/torutek-gh) [![DRIVE.NET, Inc.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/drivenet.png "DRIVE.NET, Inc.")](https://github.com/drivenet) @@ -352,9 +351,7 @@ The versioning scheme for packages is: [![Jonathan ](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Jonathan-Hickey.png "Jonathan ")](https://github.com/Jonathan-Hickey) [![Charley Wu](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/akunzai.png "Charley Wu")](https://github.com/akunzai) [![Jakob Tikjøb Andersen](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jakobt.png "Jakob Tikjøb Andersen")](https://github.com/jakobt) -[![Seann Alexander](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/seanalexander.png "Seann Alexander")](https://github.com/seanalexander) [![Tino Hager](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/tinohager.png "Tino Hager")](https://github.com/tinohager) -[![Mark Seemann](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/ploeh.png "Mark Seemann")](https://github.com/ploeh) [![Ken Bonny](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/KenBonny.png "Ken Bonny")](https://github.com/KenBonny) [![Simon Cropp](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/SimonCropp.png "Simon Cropp")](https://github.com/SimonCropp) [![agileworks-eu](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/agileworks-eu.png "agileworks-eu")](https://github.com/agileworks-eu) @@ -364,6 +361,8 @@ The versioning scheme for packages is: [![ChilliCream](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/ChilliCream.png "ChilliCream")](https://github.com/ChilliCream) [![4OTC](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/4OTC.png "4OTC")](https://github.com/4OTC) [![Vincent Limo](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/v-limo.png "Vincent Limo")](https://github.com/v-limo) +[![Jordan S. Jones](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jordansjones.png "Jordan S. Jones")](https://github.com/jordansjones) +[![domischell](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/DominicSchell.png "domischell")](https://github.com/DominicSchell) diff --git a/src/SponsorLink/SponsorLink.Analyzer.Tests.targets b/src/SponsorLink/SponsorLink.Analyzer.Tests.targets index b2e6e7b..1ce67f6 100644 --- a/src/SponsorLink/SponsorLink.Analyzer.Tests.targets +++ b/src/SponsorLink/SponsorLink.Analyzer.Tests.targets @@ -7,12 +7,12 @@ - + - + @@ -21,19 +21,29 @@ - - + + + + + $([MSBuild]::ValueOrDefault('%(FullPath)', '').Replace('net6.0', 'netstandard2.0').Replace('net8.0', 'netstandard2.0').Replace('netcoreapp3.1', 'netstandard2.0')) + + + + diff --git a/src/SponsorLink/SponsorLink.Analyzer.targets b/src/SponsorLink/SponsorLink.Analyzer.targets index 34a90ef..9aae475 100644 --- a/src/SponsorLink/SponsorLink.Analyzer.targets +++ b/src/SponsorLink/SponsorLink.Analyzer.targets @@ -84,14 +84,14 @@ - + - + diff --git a/src/SponsorLink/SponsorLink/SponsorLink.cs b/src/SponsorLink/SponsorLink/SponsorLink.cs index eecd218..eec50c8 100644 --- a/src/SponsorLink/SponsorLink/SponsorLink.cs +++ b/src/SponsorLink/SponsorLink/SponsorLink.cs @@ -107,6 +107,15 @@ public static IncrementalValueProvider GetStatusOptions(this Incr => context.GetSponsorAdditionalFiles().Combine(context.AnalyzerConfigOptionsProvider) .Select((source, _) => new StatusOptions(source.Left, source.Right.GlobalOptions)); + /// + /// Gets the status options for use within a source generator, to avoid depending on + /// analyzer runs. Used in combination with . + /// + public static StatusOptions GetStatusOptions(this GeneratorExecutionContext context) + => new StatusOptions( + context.AdditionalFiles.Where(x => x.IsSponsorManifest(context.AnalyzerConfigOptions) || x.IsSponsorableAnalyzer(context.AnalyzerConfigOptions)).ToImmutableArray(), + context.AnalyzerConfigOptions.GlobalOptions); + static bool IsSponsorManifest(this AdditionalText text, AnalyzerConfigOptionsProvider provider) => provider.GetOptions(text).TryGetValue("build_metadata.SponsorManifest.ItemType", out var itemType) && itemType == "SponsorManifest" && diff --git a/src/SponsorLink/SponsorLink/SponsorLink.csproj b/src/SponsorLink/SponsorLink/SponsorLink.csproj index 70beb73..cf62d1b 100644 --- a/src/SponsorLink/SponsorLink/SponsorLink.csproj +++ b/src/SponsorLink/SponsorLink/SponsorLink.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/SponsorLink/Tests/Tests.csproj b/src/SponsorLink/Tests/Tests.csproj index 3f44e41..a56aa30 100644 --- a/src/SponsorLink/Tests/Tests.csproj +++ b/src/SponsorLink/Tests/Tests.csproj @@ -10,7 +10,7 @@ - +