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/.
Prerequisites
Section titled “Prerequisites”- The .NET SDK that
global.jsonnames, version 10. Without an installeddotnet,build.shdownloads 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.
Set the configuration root
Section titled “Set the configuration root”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:
export ALLORS_CONFIG_ROOT="$PWD/config/snapshot" # Snapshot adapter, no database server./build.sh DotnetCoreDatabaseTest
export ALLORS_CONFIG_ROOT="$PWD/config/sqlclient" # SQL Serverexport ALLORS_SQLCLIENT='Server=localhost;User Id=sa;Password=…;TrustServerCertificate=true'./build.sh DotnetCoreDatabaseTestIn 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.
Generate first
Section titled “Generate first”A fresh clone does not compile until the generators have run:
./build.sh GenerateGenerate 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.
Run a suite
Section titled “Run a suite”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:
| Suite | Tests | Needs |
|---|---|---|
CiDotnetSystemAdaptersTestMemory | The shared adapter tests on the Memory adapter | Nothing |
CiDotnetSystemAdaptersTestSnapshot | The shared adapter tests on the Snapshot adapter | Nothing |
CiDotnetSystemAdaptersTestSqlClient | The shared adapter tests on SQL Server | The admin connection in ALLORS_SQLCLIENT |
CiDotnetSystemAdaptersTestNpgsql | The shared adapter tests on PostgreSQL | The admin connection in ALLORS_NPGSQL |
CiDotnetCoreDatabaseTest | The merge, commands, generate, meta and domain tests of Core, and the API tests against a database and against the Core test server | The folder core of the root |
CiDotnetCoreWorkspaceLocalTest | The .NET workspace on the Local adapter | The folder core of the root |
CiDotnetCoreWorkspaceRemoteJsonSystemTextTest, CiDotnetCoreWorkspaceRemoteJsonNewtonsoftTest | The .NET workspace on the Remote adapter against the Core test server, with System.Text.Json and with Newtonsoft.Json | The folder core of the root |
CiTypescriptWorkspaceTest | The TypeScript workspace libraries that need no server | Nothing |
CiTypescriptWorkspaceAdaptersJsonTest | The TypeScript workspace against the Core test server | The folder core of the root |
CiSampleTest | The 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 Snapshot | The 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.
The sample application
Section titled “The sample application”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.
The TypeScript workspace
Section titled “The TypeScript workspace”typescript/modules is an nx workspace. After npm install in that folder, these scripts run
without a server:
npm run system-workspace-meta:testnpm run system-workspace-meta-json:testnpm run system-workspace-adapters:testnpm run system-workspace-domain:testnpm run system-workspace-adapters-json:test needs the Core test server. The target
TypescriptWorkspaceAdaptersJsonTest publishes and starts it before it runs the script.
Continuous integration
Section titled “Continuous integration”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.
| Event | Workflow | Runs |
|---|---|---|
| A pull request, whatever its base branch | ci.yml | On 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 main | ci.yml | The 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 demand | nightly.yml | On 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:
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.