git clone https://github.com/cwouyang/uContract.NET.git
cd uContract.NET
dotnet testRider configuration (one-time, per-developer):
-
Install the CSharpier plugin from the Rider marketplace; restart Rider.
-
Settings -> Tools -> CSharpier: enable "Run on save" and "Reformat code on save". Pin the plugin version to match the CLI version in
.config/dotnet-tools.json(currently1.2.6). -
Settings -> Keymap: rebind
Ctrl+Alt+L(Reformat Code) to the CSharpier Format action so the IDE shortcut matches CI. -
Settings -> Editor -> Code Cleanup: create a
uContract-safeprofile containing only "CSharpier Format". Do not run Full Cleanup on this codebase. -
Settings -> Editor -> Code Style -> C#: enable "Load from EditorConfig" so
.editorconfiggoverns per-project style. -
Run once per clone:
git config blame.ignoreRevsFile .git-blame-ignore-revs
To verify, introduce a whitespace error in any .cs file and trigger Rider Reformat. The result must be byte-identical to dotnet csharpier format output; if it differs, re-check the plugin version pin and the CSharpier-only cleanup profile.
Run before every commit:
dotnet tool restore
dotnet csharpier check .
dotnet build -p:ContinuousIntegrationBuild=true
dotnet test --no-build --verbosity normalThe GitHub Actions workflow runs the same steps in this order:
dotnet tool restore
dotnet csharpier check .
dotnet build -p:ContinuousIntegrationBuild=true --no-restore
dotnet test --no-build --verbosity normalIf all four succeed locally, CI will succeed.
Land each step as its own commit so the formatting-only commit can be added to .git-blame-ignore-revs cleanly:
- Bump the version in
.config/dotnet-tools.json. Commit:chore(build): bump CSharpier to <new-version> dotnet tool restore && dotnet csharpier format .Commit:style: apply CSharpier <new-version> reformat- Append the SHA of the reformat commit to
.git-blame-ignore-revs. Commit:chore: add CSharpier <new-version> reformat to blame-ignore list
- Bump the
Versionattribute on theRoslynator.AnalyzersPackageReferenceinDirectory.Build.props. Commit:chore(build): bump Roslynator.Analyzers to <new-version> - Address any new diagnostics, one logical fix group per commit.
Commit:
refactor: fix RCSxxxx <description>
- One concern per PR -- do not mix refactoring with behavioral changes
- Tests are required for all changes
- For API changes, open an issue first
- Update
<Version>insrc/uContract/uContract.csproj - Promote the public API baseline (per ADR-0019):
- Move every entry from
src/uContract/PublicAPI.Unshipped.txttosrc/uContract/PublicAPI.Shipped.txt - Keep the
#nullable enableheader in both files; Unshipped retains only the header after promotion - This makes
PublicAPI.Shipped.txtthe canonical record of the APIs committed atv{version}
- Move every entry from
- Update
CHANGELOG.md-- move Unreleased items under the new version heading - Commit:
release: prepare v{version}(version bump, baseline promotion, and CHANGELOG in a single commit) - Push to master
- On GitHub, create a Release with tag
v{version}targeting master - The publish workflow runs automatically:
- Validates tag matches csproj version
- Runs tests and packs the NuGet package
- Waits for manual approval (check the Actions tab)
- Approve the deployment in the Actions tab
- Package is published to NuGet.org and attached to the GitHub Release
Before the first release, configure the GitHub Environment:
- GitHub repo > Settings > Environments > create
nuget - Enable "Required reviewers" > add yourself
- Add
NUGET_API_KEYas an environment secret (generate at https://www.nuget.org/account/apikeys)