Skip to content

main · v3.2 (unreleased)

Build and test

Maintainers · How-to guide · CurrentMarkdownAgent index

Status: Current. How-to guide for maintainers.

The build is Nuke. Run a target with ./build.sh <target> on macOS and Linux, and with build.cmd <target> on Windows. The targets are defined in build/.

  • The .NET SDK that global.json names, version 10. Without an installed dotnet, build.sh downloads that SDK into .nuke/temp.
  • Node.js 24 and npm, for the TypeScript workspace.
  • A clone with its full history. Nerdbank.GitVersioning computes the version of a build from the history, which a shallow clone does not have.
  • No database server with the template config/snapshot: on that configuration root the suites run on the Snapshot adapter. SQL Server and PostgreSQL are needed only for their suites.

The build stops at once, whatever the target, when ALLORS_CONFIG_ROOT is not set or is not an absolute path. The variable names the configuration root: the folder below which the tests, the command-line tool and the server that the build starts read their settings. The repository holds a template for each adapter:

Terminal window
export ALLORS_CONFIG_ROOT="$PWD/config/snapshot" # Snapshot adapter, no database server
./build.sh DotnetCoreDatabaseTest
export ALLORS_CONFIG_ROOT="$PWD/config/sqlclient" # SQL Server
export ALLORS_SQLCLIENT='Server=localhost;User Id=sa;Password=…;TrustServerCertificate=true'
./build.sh DotnetCoreDatabaseTest

In PowerShell the first line is $env:ALLORS_CONFIG_ROOT = "$PWD\config\snapshot". The build stops before running a target if a command still passes --provider <name>. Remove the option and set ALLORS_CONFIG_ROOT to the absolute path of config/<name>.

With a SQL template the build needs the admin connection of that adapter as well: the Core and workspace suites start by dropping and creating the database of the connection string, with its login.

The variable stays set in its terminal, so every later target there runs on the same root. An environment variable also overrides the file of the root: an adapter and a ConnectionStrings__DefaultConnection that are still set from other work send the suites to that database, which they then drop and create.

A fresh clone does not compile until the generators have run:

Terminal window
./build.sh Generate

Generate produces the metadata and the typed classes of the test model of the adapters and of Core with its test domain, for .NET and for TypeScript. Generated files are not committed and are never edited by hand. Run Generate again after a change to a repository project or to a template.

./build.sh without a target runs Install, which installs the dependencies of the TypeScript workspace, and then Generate.

The suites that CI runs are the Ci* targets in build/Build.ci.cs. Each of them runs the target without the prefix, which you can run directly as well. The two TypeScript suites also run Install first; run ./build.sh Install once before you run TypescriptWorkspaceTest or TypescriptWorkspaceAdaptersJsonTest directly.

Every target needs the configuration root. The last column says what a suite reads below it and what it needs besides:

SuiteTestsNeeds
CiDotnetSystemAdaptersTestMemoryThe shared adapter tests on the Memory adapterNothing
CiDotnetSystemAdaptersTestSnapshotThe shared adapter tests on the Snapshot adapterNothing
CiDotnetSystemAdaptersTestSqlClientThe shared adapter tests on SQL ServerThe admin connection in ALLORS_SQLCLIENT
CiDotnetSystemAdaptersTestNpgsqlThe shared adapter tests on PostgreSQLThe admin connection in ALLORS_NPGSQL
CiDotnetCoreDatabaseTestThe merge, commands, generate, meta and domain tests of Core, and the API tests against a database and against the Core test serverThe folder core of the root
CiDotnetCoreWorkspaceLocalTestThe .NET workspace on the Local adapterThe folder core of the root
CiDotnetCoreWorkspaceRemoteJsonSystemTextTest, CiDotnetCoreWorkspaceRemoteJsonNewtonsoftTestThe .NET workspace on the Remote adapter against the Core test server, with System.Text.Json and with Newtonsoft.JsonThe folder core of the root
CiTypescriptWorkspaceTestThe TypeScript workspace libraries that need no serverNothing
CiTypescriptWorkspaceAdaptersJsonTestThe TypeScript workspace against the Core test serverThe folder core of the root
CiSampleTestThe sample domain tests on Memory, the command-line and HTTP server tests on Snapshot, and the workspace tests on the Local and the Remote adapter, with the database on SnapshotThe folder custom of the root, which the template config/snapshot holds

A suite that reads the folder core runs on the adapter that the root names there, as Set the configuration root describes, and with a SQL template it needs the admin connection of that adapter. The adapter suites read no settings; they create and open their own test databases with the admin connection.

The targets write their results as TRX files to artifacts/Tests.

sample/ holds an application as a user of the platform builds one: its projects include the folders named Core by path and never the folders named Custom, which hold the test domain. Generate does not touch it, and the platform builds without it. SampleTest first runs SampleGenerate, which merges the messages of Core into the sample, runs the repository generator on the sample’s model and runs the sample’s own generator; then it runs the sample’s tests. The domain tests run on the Memory adapter unless ALLORS_TEST_ADAPTER names another, which CI does not set; Test on PostgreSQL or SQL Server describes the variable. The other tests of the sample run its command-line tool and its server, which read custom/appsettings.json below the configuration root.

The suite is the repository’s check on what a change to Core asks of an application. A hook that an application has to define, or a class that it has to provide, fails the build of the sample. A rule of Core that an application has to add to its list of rules does not: the suite notices only when a test of the sample needs that rule. The suite counts for CI result, so a change to Core that breaks the sample merges together with the change that the sample needs. Create an application tells users how to start from the sample, so a change to the sample’s projects, or to the files that it copies from Core’s folders Custom and Virtual, can change that guide as well.

typescript/modules is an nx workspace. After npm install in that folder, these scripts run without a server:

Terminal window
npm run system-workspace-meta:test
npm run system-workspace-meta-json:test
npm run system-workspace-adapters:test
npm run system-workspace-domain:test

npm run system-workspace-adapters-json:test needs the Core test server. The target TypescriptWorkspaceAdaptersJsonTest publishes and starts it before it runs the script.

Three workflows run the suites. Every suite is a job of its own. A leg, which is the suites of one adapter on one operating system, is one call of .github/workflows/tests.yml; the sample application is a leg of its own. tests.yml sets ALLORS_CONFIG_ROOT to the template of the leg and gives it its admin connection: a service container on Linux, and on Windows LocalDB and the PostgreSQL of the runner image.

EventWorkflowRuns
A pull request, whatever its base branchci.ymlOn Linux: the four adapter suites, with SQL Server and PostgreSQL as service containers, the Core and TypeScript suites with config/snapshot, and the suite of the sample application. The domain tests of Core then run on the Memory adapter.
A push to mainci.ymlThe same, and the Core and TypeScript suites with config/sqlclient and config/npgsql as well, the domain tests included.
Every night on main, and on demandnightly.ymlOn Windows: the adapter suites, and the Core and TypeScript suites on the Snapshot adapter, on SQL Server LocalDB and on PostgreSQL. The suite of the sample application is not among them.

A branch runs through its pull request. Start a run on demand for a branch that has none, or for the Windows legs:

Terminal window
gh workflow run ci.yml --ref <branch>
gh workflow run nightly.yml -f os=both -f provider=npgsql

-f os= takes windows-latest, ubuntu-latest or both, and -f provider= takes all, snapshot, sqlclient or npgsql.

The check CI result stands for the suites of a pull request and of a push, and it is the one check that the ruleset of main requires. A change that touches only documentation skips the suites, and CI result passes without them: the files under docs/, the documentation workflow, and AGENTS.md, CHANGELOG.md and README.md at the root of the repository.

The documentation has its own workflow and its own checks; the website instructions describe them.