Thank you for your interest in contributing! This guide covers how to build the project, run tests, submit pull requests, and cut a new release.
Prerequisites
| Tool | Minimum Version |
|---|---|
| .NET SDK | 8.0 |
| Git | 2.x |
Clone the repository:
git clone https://github.com/TheEightBot/SamsaraDotnet.git
cd SamsaraDotnetRestore dependencies:
dotnet restore# Debug build (default)
dotnet build
# Release build
dotnet build --configuration ReleaseThe TreatWarningsAsErrors property is enabled globally — zero warnings is the bar.
Run all unit tests:
dotnet test tests/Samsara.Sdk.Tests --configuration ReleaseRun with code coverage:
dotnet test tests/Samsara.Sdk.Tests \
--configuration Release \
--collect:"XPlat Code Coverage" \
--results-directory ./coverageIntegration tests (Samsara.Sdk.IntegrationTests) require a valid Samsara API token. Set the environment variable before running:
export SAMSARA_API_TOKEN="samsara_api_..."
dotnet test tests/Samsara.Sdk.IntegrationTests --configuration Release- Follow existing patterns: immutable
recordmodels,IAsyncEnumerable<T>pagination, typed exceptions. - Keep implementations
internal sealed— only interfaces are public. - Add XML doc comments to any new public interface members.
- Run
dotnet buildbefore opening a PR to catch warnings.
.editorconfig enforces formatting rules. Most IDEs (Visual Studio, Rider, VS Code + C# extension) will apply them automatically.
- Fork the repo and create a feature branch from
main. - Make your changes, add tests, ensure
dotnet testpasses. - Open a PR using the provided template.
- At least one maintainer approval is required before merging.
For significant changes, open an issue first to discuss the approach.
Releases are fully automated via GitHub Actions. To publish a new version to NuGet.org:
-
Ensure all changes are merged to
main. -
Update
CHANGELOG.md— move items from[Unreleased]to a new version section. -
Push a version tag:
git tag v1.0.0 git push origin v1.0.0
The release.yml workflow will automatically:
- Build and test the solution
- Pack
Samsara.Sdk(version is derived from the git tag via MinVer) - Push
.nupkgand.snupkgto NuGet.org - Create a GitHub Release with auto-generated release notes
Required secret:
NUGET_API_KEYmust be set in the repository secrets with a valid NuGet.org API key scoped toSamsara.Sdk.
Use a tag suffix for pre-release packages:
git tag v1.1.0-beta.1
git push origin v1.1.0-beta.1This produces a 1.1.0-beta.1 NuGet package.