Thanks for helping improve d2lang-cs. Focused pull requests with tests are the easiest to review and release safely.
Install the stable .NET 10 SDK and the .NET 8 runtime to run the compatibility tests. The D2 CLI is optional for normal library development and required when checking generated D2 syntax locally. CI currently uses D2 CLI v0.9.0.
Fork and clone the repository, then create a branch from main:
git switch main git pull --ff-only git switch -c feature/short-description
Restore, build, and test from the repository root:
dotnet restore d2lang-cs.slnx
dotnet build d2lang-cs.slnx --configuration Release --no-restore
dotnet test test/Tests.csproj --configuration Release --no-buildCreate both NuGet packages with SDK package validation enabled:
dotnet pack src/d2lang-cs.csproj \ --configuration Release \ --output artifacts/packages \ -p:EnablePackageValidation=true dotnet pack src/D2Lang.EntityFrameworkCore/D2Lang.EntityFrameworkCore.csproj \ --configuration Release \ --output artifacts/packages \ -p:EnablePackageValidation=true
Install the D2 CLI, run the example, and validate its output:
dotnet run --project example/cli/d2-sample-cli.csproj \
--configuration Release > /tmp/d2lang-cs-example.d2
d2 validate /tmp/d2lang-cs-example.d2When changing serialization, add tests for both the exact emitted source and parser acceptance. Include cases with reserved characters, quotes, whitespace, multiline text, URLs, and nested containers where relevant.
- Keep changes focused on one concern.
- Add or update tests for behavior changes.
- Update the README when public behavior, requirements, or compatibility changes.
- Avoid unrelated formatting or generated-file changes.
- Run the release build, tests, package validation, and relevant D2 validation before requesting review.
- Call out intentional compatibility or output-format changes in the description.
Pull requests run clean builds and tests on Linux and Windows. CI also publishes test results, Cobertura coverage artifacts, a coverage summary, a validated NuGet package artifact, and the example D2 source validation result.
Releases are published by .github/workflows/release.yml. Maintainers should:
-
Confirm the intended commit is on
mainand CI is green. -
Confirm the
nuget.orgGitHub environment is protected as desired and contains aNUGET_API_KEYsecret with permission to publish bothd2lang-csandD2Lang.EntityFrameworkCore. Include permission to create the EF Core package for its first release. -
Choose a semantic version unused by both packages, such as
1.2.3or1.2.3-rc.1. A release tag publishes both packages with the same version. -
Create an annotated
v-prefixed tag and push it:git tag -a v1.2.3 -m "d2lang-cs 1.2.3" git push origin v1.2.3 -
Review the
Publish NuGet packageworkflow and its package artifacts, then verify that both packages and their symbols are available on NuGet.org.
The workflow derives PackageVersion from the tag, repeats tests, enables SDK package validation, creates .nupkg and .snupkg artifacts, and publishes with dotnet nuget push. Publishing uses read-only repository permissions and exposes NUGET_API_KEY only to the final push step. Duplicate versions are skipped safely, but NuGet package versions are immutable; use a new version if published contents need to change.