diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index a3ba5bf8..cdf1c451 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -51,3 +51,7 @@ updates:
Spectre:
patterns:
- "Spectre.Console*"
+- package-ecosystem: github-actions
+ directory: /
+ schedule:
+ interval: weekly
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0144ec81..e3923e56 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,8 +1,8 @@
-ο»Ώ# Builds and runs tests on Ubuntu. The full OS matrix runs in publish and release.
+# Builds and runs tests on Ubuntu. The full OS matrix runs in publish and release.
# Pushes CI feed if secrets.SLEET_CONNECTION is provided
name: build
-on:
+on:
workflow_dispatch:
push:
branches: [ main, dev, 'feature/*', 'rel/*' ]
@@ -12,6 +12,9 @@ on:
pull_request:
types: [opened, synchronize, reopened]
+permissions:
+ contents: read
+
env:
DOTNET_NOLOGO: true
@@ -24,13 +27,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: π€ checkout
- uses: actions/checkout@v4
- with:
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
submodules: recursive
fetch-depth: 0
- name: β dotnet
- uses: devlooped/actions-dotnet-env@v1
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: β ensure format
run: |
@@ -43,13 +46,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: π€ checkout
- uses: actions/checkout@v4
- with:
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
submodules: recursive
fetch-depth: 0
- name: β dotnet
- uses: devlooped/actions-dotnet-env@v1
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: π build
run: dotnet build -m:1 -bl:build.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/}
@@ -61,43 +64,54 @@ jobs:
run: dotnet pack -m:1 -bl:pack.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/}
- name: πΌ packages
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: bin-ubuntu-latest
path: bin/*.nupkg
-
+
# Push the CI package to the sleet feed when a connection is configured
- name: π sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
+ SLEET_FEED_URL: ${{ vars.SLEET_FEED_URL }}
if: env.SLEET_CONNECTION != ''
run: |
- dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed ${{ vars.SLEET_FEED_URL }} | jq '.["sleet:version"]' -r)
- sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found"
+ dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed "$SLEET_FEED_URL" | jq '.["sleet:version"]' -r)
+ sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=$SLEET_CONNECTION" -p "SLEET_FEED_TYPE=azure" || echo "No packages found"
native-aot:
- name: native-aot-${{ matrix.framework }}
- runs-on: ubuntu-latest
+ name: ${{ matrix.prefix }}-${{ matrix.framework }}
+ runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
+ os: [ubuntu-latest, windows-latest]
framework: [net8.0, net10.0]
+ include:
+ - os: ubuntu-latest
+ prefix: native-aot
+ rid: linux-x64
+ exe: CompiledAot
+ - os: windows-latest
+ prefix: native-aot-windows
+ rid: win-x64
+ exe: CompiledAot.exe
steps:
- name: checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
submodules: recursive
- name: dotnet
- uses: devlooped/actions-dotnet-env@v1
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: packages
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
- name: publish and execute
run: |
- dotnet publish src/Acceptance/CompiledAot/CompiledAot.csproj -c Release -f ${{ matrix.framework }} -r linux-x64 -p:UseSharedCompilation=false -warnaserror -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
- src/Acceptance/CompiledAot/bin/Release/${{ matrix.framework }}/linux-x64/publish/CompiledAot
+ dotnet publish src/Acceptance/CompiledAot/CompiledAot.csproj -c Release -f ${{ matrix.framework }} -r ${{ matrix.rid }} -p:UseSharedCompilation=false -warnaserror -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
+ src/Acceptance/CompiledAot/bin/Release/${{ matrix.framework }}/${{ matrix.rid }}/publish/${{ matrix.exe }}
acceptance:
name: acceptance
@@ -105,13 +119,13 @@ jobs:
needs: build
steps:
- name: π€ checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: β dotnet
- uses: devlooped/actions-dotnet-env@v1
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: π½ packages
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
@@ -124,6 +138,27 @@ jobs:
run: dotnet test Acceptance.slnx -f net10.0 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
working-directory: src/Acceptance
+ samples:
+ name: samples
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: π€ checkout
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+
+ - name: β dotnet
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
+
+ - name: π½ packages
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: bin-ubuntu-latest
+ path: bin
+
+ - name: π§ͺ test
+ run: dotnet test Samples.slnx -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
+ working-directory: samples
+
# The compilers that run on .NET Framework load analyzers from the analyzer references alone.
# They come with Visual Studio, which the Windows image has.
framework-compiler:
@@ -132,13 +167,13 @@ jobs:
needs: build
steps:
- name: π€ checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: β dotnet
- uses: devlooped/actions-dotnet-env@v1
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: π½ packages
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 9a25b78d..3d729c7d 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,5 +1,6 @@
-ο»Ώ# Builds a final release version on every supported OS and pushes to nuget.org
-# whenever a release is published. Packages are pushed only after the whole matrix passes.
+# Builds a final release version on every supported OS and pushes to nuget.org
+# whenever a release is published. Packages are pushed only after the whole matrix,
+# native-aot, and acceptance checks pass.
# Requires: vars.NUGET_OIDC (or secrets.NUGET_OIDC) and a nuget.org trusted publishing policy
name: publish
@@ -7,6 +8,9 @@ on:
release:
types: [prereleased, released]
+permissions:
+ contents: read
+
env:
DOTNET_NOLOGO: true
Configuration: Release
@@ -24,13 +28,13 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: π€ checkout
- uses: actions/checkout@v4
- with:
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
submodules: recursive
fetch-depth: 0
- name: β dotnet
- uses: devlooped/actions-dotnet-env@v1
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: π build
run: dotnet build -m:1 -bl:build.binlog -p:version=${GITHUB_REF#refs/*/v} -p:RepositoryBranch=${GITHUB_REF#refs/*/}
@@ -43,7 +47,7 @@ jobs:
- name: πΌ logs
if: ${{ always() }}
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: logs-${{ matrix.os }}
path: '*.binlog'
@@ -60,11 +64,68 @@ jobs:
- name: πΌ packages
if: matrix.os == 'ubuntu-latest'
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: bin-ubuntu-latest
path: bin/*.nupkg
+ native-aot:
+ name: native-aot-${{ matrix.os }}-${{ matrix.framework }}
+ runs-on: ${{ matrix.os }}
+ needs: build
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest]
+ framework: [net8.0, net10.0]
+ include:
+ - os: ubuntu-latest
+ rid: linux-x64
+ exe: CompiledAot
+ - os: windows-latest
+ rid: win-x64
+ exe: CompiledAot.exe
+ steps:
+ - name: checkout
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
+ submodules: recursive
+ - name: dotnet
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
+ - name: packages
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: bin-ubuntu-latest
+ path: bin
+ - name: publish and execute
+ run: |
+ dotnet publish src/Acceptance/CompiledAot/CompiledAot.csproj -c Release -f ${{ matrix.framework }} -r ${{ matrix.rid }} -p:UseSharedCompilation=false -warnaserror -p:version=${GITHUB_REF#refs/*/v}
+ src/Acceptance/CompiledAot/bin/Release/${{ matrix.framework }}/${{ matrix.rid }}/publish/${{ matrix.exe }}
+
+ acceptance:
+ name: acceptance
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: π€ checkout
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+
+ - name: β dotnet
+ uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
+
+ - name: π½ packages
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: bin-ubuntu-latest
+ path: bin
+
+ - name: π generate comparison stunts
+ run: dotnet run --file GenerateReferenceStunts.cs
+ working-directory: src/Acceptance
+
+ - name: π§ͺ test
+ run: dotnet test Acceptance.slnx -f net10.0 -p:version=${GITHUB_REF#refs/*/v}
+ working-directory: src/Acceptance
+
# Pushes with nuget.org Trusted Publishing (GitHub Actions OIDC), no long-lived API key.
# Only this job may request an OIDC token. The nuget.org policy, created by the
# NuGet/login user (vars.NUGET_OIDC, or secrets.NUGET_OIDC when the variable is empty),
@@ -80,7 +141,7 @@ jobs:
# https://learn.microsoft.com/nuget/nuget-org/trusted-publishing
# https://github.com/NuGet/login
publish:
- needs: build
+ needs: [build, native-aot, acceptance]
if: github.event.action != 'prereleased'
runs-on: ubuntu-latest
environment: nuget
@@ -89,16 +150,18 @@ jobs:
id-token: write
steps:
- name: π½ packages
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
- name: π nuget login
id: login
- uses: NuGet/login@v1
+ uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1
with:
user: ${{ vars.NUGET_OIDC || secrets.NUGET_OIDC }}
- name: π nuget
- run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ steps.login.outputs.NUGET_API_KEY }} --skip-duplicate
+ env:
+ NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
+ run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k "$NUGET_API_KEY" --skip-duplicate
diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml
index 441fdc3b..1b8f2174 100644
--- a/.github/workflows/site.yml
+++ b/.github/workflows/site.yml
@@ -1,4 +1,5 @@
# Builds the website (docs/, a Lunet site) and deploys it to GitHub Pages.
+# Pull requests run the Lunet build as a dry run without deploying.
# Requires: Settings > Pages > Build and deployment > Source set to "GitHub Actions".
name: site
@@ -13,15 +14,20 @@ on:
- src/Stunts.Extensions/**
- src/Directory.*
- .github/workflows/site.yml
+ pull_request:
+ paths:
+ - docs/**
+ - src/Stunts/**
+ - src/Stunts.Extensions/**
+ - src/Directory.*
+ - .github/workflows/site.yml
permissions:
contents: read
- pages: write
- id-token: write
-# One deployment at a time; a newer one waits for the running one to end.
+# One deployment at a time on main; PR builds do not block deployments.
concurrency:
- group: pages
+ group: pages-${{ github.ref }}
cancel-in-progress: false
jobs:
@@ -29,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: π οΈ build
- uses: lunet-io/actions/lunet-build@v1
+ uses: lunet-io/actions/lunet-build@2ea1efa0c38b53c50c3f7dd54aaf25ae4dfee6c7 # v1
with:
site_path: docs
build_command: pwsh ./build.ps1
@@ -38,11 +44,16 @@ jobs:
deploy:
needs: build
+ if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ pages: write
+ id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: π deploy
id: deploy
- uses: actions/deploy-pages@v4
+ uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
diff --git a/Stunts.slnx b/Stunts.slnx
index 52b4cac4..2332f76d 100644
--- a/Stunts.slnx
+++ b/Stunts.slnx
@@ -16,7 +16,6 @@
-
diff --git a/_config.yml b/_config.yml
deleted file mode 100644
index 04e60939..00000000
--- a/_config.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-theme: jekyll-theme-slate
-
-exclude: [ 'src/', '*.sln', '*.slnx', 'Gemfile*', '*.rsp' ]
diff --git a/assets/css/style.scss b/assets/css/style.scss
deleted file mode 100644
index 5e165a3c..00000000
--- a/assets/css/style.scss
+++ /dev/null
@@ -1,26 +0,0 @@
----
----
-
-@import "jekyll-theme-slate";
-
-.inner {
- max-width: 960px;
-}
-
-pre, code {
- background-color: unset;
- font-size: unset;
-}
-
- code {
- font-size: 0.80em;
-}
-
-h1 > img {
- border: unset;
- box-shadow: unset;
- vertical-align: middle;
- -moz-box-shadow: unset;
- -o-box-shadow: unset;
- -ms-box-shadow: unset;
-}
diff --git a/samples/Samples/Samples.csproj b/samples/Samples/Samples.csproj
index 956fd743..16c25bba 100644
--- a/samples/Samples/Samples.csproj
+++ b/samples/Samples/Samples.csproj
@@ -4,14 +4,12 @@
net10.0
enable
false
- $(MSBuildProjectDirectory)\..\..\bin
-
diff --git a/samples/nuget.config b/samples/nuget.config
index 3a972258..19b2dec3 100644
--- a/samples/nuget.config
+++ b/samples/nuget.config
@@ -1,9 +1,13 @@
+
+
+
+
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index c2de97ba..cda9fd0a 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -6,10 +6,10 @@
-
+
-
+
diff --git a/src/Directory.props b/src/Directory.props
index 05499ce5..47d5f149 100644
--- a/src/Directory.props
+++ b/src/Directory.props
@@ -14,14 +14,17 @@
https://clarius.org/stunts
0.6.2
+
+
+ 5.0.0
+ 5.0
+ 1.5.1
+ 1.16.0
-
- 5.0.0
- 5.0
obj\$(RoslynVersion)\
Debug
bin\$(RoslynVersion)\$(Configuration)
diff --git a/src/Directory.targets b/src/Directory.targets
deleted file mode 100644
index 2761604d..00000000
--- a/src/Directory.targets
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Stunts.CodeAnalysis/Stunts.CodeAnalysis.csproj b/src/Stunts.CodeAnalysis/Stunts.CodeAnalysis.csproj
index 6bc3a722..12525fba 100644
--- a/src/Stunts.CodeAnalysis/Stunts.CodeAnalysis.csproj
+++ b/src/Stunts.CodeAnalysis/Stunts.CodeAnalysis.csproj
@@ -6,7 +6,6 @@
true
analyzers\dotnet
- true
true
@@ -16,7 +15,7 @@
-
+
@@ -44,6 +43,7 @@
+ ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/src/Stunts.CodeFixes/Stunts.CodeFixes.csproj b/src/Stunts.CodeFixes/Stunts.CodeFixes.csproj
index b51eefe8..a369ad02 100644
--- a/src/Stunts.CodeFixes/Stunts.CodeFixes.csproj
+++ b/src/Stunts.CodeFixes/Stunts.CodeFixes.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/src/Stunts.CompiledProxy/Stunts.CompiledProxy.targets b/src/Stunts.CompiledProxy/Stunts.CompiledProxy.targets
index 565bb8da..58014e2b 100644
--- a/src/Stunts.CompiledProxy/Stunts.CompiledProxy.targets
+++ b/src/Stunts.CompiledProxy/Stunts.CompiledProxy.targets
@@ -16,8 +16,8 @@
-
-
+
+
diff --git a/src/Stunts.UnitTests/.Scenarios.cs b/src/Stunts.UnitTests/.Scenarios.cs
index 61fd548b..abf06291 100644
--- a/src/Stunts.UnitTests/.Scenarios.cs
+++ b/src/Stunts.UnitTests/.Scenarios.cs
@@ -34,10 +34,9 @@ public class Scenarios
[MemberData(nameof(GetScenarios))]
public void Run(string path)
{
- // Getting the generated output can be flaky sometimes, so retry
- var (diagnostics, compilation) = Retry(() => GetGeneratedOutput(
+ var (diagnostics, compilation) = GetGeneratedOutput(
Path.IsPathRooted(path) ? path :
- Path.Combine(ThisAssembly.Project.MSBuildProjectDirectory, path)));
+ Path.Combine(ThisAssembly.Project.MSBuildProjectDirectory, path));
Assert.True(diagnostics.IsEmpty,
"Generated code produced diagnostics:\r\n" +
@@ -60,24 +59,6 @@ public void Run(string path)
}
}
- T Retry(Func func, int times = 2)
- {
- for (var i = 1; i <= times; i++)
- {
- try
- {
- return func();
- }
- catch (Exception) when (i < times)
- {
- Thread.Sleep(500);
- GC.Collect();
- }
- }
-
- return default;
- }
-
public static IEnumerable