Build and test
This page builds Tilde from the source, runs tcli and tt without installing them, and runs the tests. Do these before you send a change.
What you need
Section titled “What you need”- The .NET 10 SDK and Git.
- Docker, for the integration tests only. Without it they are skipped.
gpg, for the OpenPGP integration tests only. Without it they are skipped.
git clone https://codeberg.org/squidd/Tilde.gitcd Tildedotnet build Tilde.slnxThe analyzers are on and the style rules of .editorconfig are part of the build. The CI builds in Release with warnings as errors, so build the same way before a pull request:
dotnet build Tilde.slnx -c Release -warnaserrorRun from the source
Section titled “Run from the source”dotnet run --project src/Tilde.Cli -- --helpdotnet run --project src/Tilde.Ui.Tui -- --demo--demo shows made-up accounts and messages instead of the accounts of the configuration. It still needs a config.toml, and an empty one is enough. Both programs take --config <path>: the folder that holds config.toml, the scripts, the themes, the cache and the logs. Use a folder of your own and example domains, never a real server, while you try something:
dotnet run --project src/Tilde.Cli -- --config ~/tilde-try checkThere are two test projects.
| Project | What it runs | Needs |
|---|---|---|
tests/Tilde.Tests |
The unit tests, with fakes for the servers | Nothing |
tests/Tilde.Tests.Integration |
The plugins and tcli against real servers: GreenMail (IMAP and SMTP), ejabberd (XMPP) and Ergo (IRC), and the real gpg |
Docker, gpg |
dotnet test tests/Tilde.Testsdotnet test tests/Tilde.Tests.IntegrationThe integration tests start the servers with Testcontainers and pull their images the first time. A test whose server cannot start is skipped, not failed, and the reason is in the output.
Run a part of a suite with a filter on the full name:
dotnet test tests/Tilde.Tests --filter "FullyQualifiedName~Tilde.Tests.Cli"The CI runs the integration tests in four parts, by namespace: Tilde.Tests.Integration.Plugin.Mail, Tilde.Tests.Integration.Plugin.Chat.Xmpp, Tilde.Tests.Integration.Plugin.Chat.Irc and Tilde.Tests.Integration.Plugin.Pgp. Use the same filters to run one part.
Before a pull request into develop I run the unit tests once and the integration tests once. The CI does not run for develop (see Releases and CI), so these runs are the check.
Write a test
Section titled “Write a test”- A test lives under
tests/Tilde.Tests/<Domain>/<Subdomain>/<Subject>Tests.cs, in a namespace that follows the folder. - The test is named
Method_Scenario_ExpectedResult, has one behavior, and its body has the comments// Arrange,// Actand// Assert. - Fakes, builders and helpers go in
Support/, never next to the tests. - A test that needs a real server goes in
tests/Tilde.Tests.Integrationand is skipped when Docker is missing.
CODE_CONVENTION.md has the full rules. To test a plugin, read Test a plugin.
Where the code is
Section titled “Where the code is”| Folder | What it holds |
|---|---|
src/Tilde.Abstraction |
Contracts and models only |
src/Tilde.Core |
Configuration, accounts, event bus, jobs, plugin loading |
src/Tilde.Scripting, Tilde.Cache, Tilde.Pgp, Tilde.Rules |
The Lua engine, the mail cache, OpenPGP and the rules, each a plugin |
plugins/Tilde.Plugin.<Domain>.<Protocol> |
One project for each protocol |
src/Tilde.Ui |
The widgets, the markup of a screen and the drawing for a terminal |
src/Tilde.Ui.ViewModels |
The view models of the screens of tt |
src/Tilde.Ui.Tui |
tt, the terminal interface |
src/Tilde.Cli |
tcli, the command line tool |
src/Tilde.Host |
The list of plugins that both programs start |
The core never depends on a plugin. A plugin references Tilde.Abstraction and Tilde.Core and nothing else in plugins/.
Third-party notices
Section titled “Third-party notices”After you add, remove or update a NuGet package, regenerate THIRD-PARTY-NOTICES.md. The script needs jq and nuget-license, and the CI of main runs it with --check.
dotnet tool install -g nuget-license --version 4.0.18scripts/generate-third-party-notices.sh