<!-- https://docs.dseams.info/contributing/developer/index.md -->

# Developing seams-core {#developing-seams-core}

How to build, test and change the engine. The release cut is
[release.org](release.md). Questions that come up while cutting a
version are in [faq.org](faq.md).

The book sources are Org. Edit the files under `docs/orgmode/`. The
`docs/source/` copies are generated.

## Build {#build}

From a checkout, with Eigen 3.4 available:

```default
meson setup bbdir --prefix=$PWD/bbdir/prefix -Dwith_tests=true
meson compile -C bbdir
pixi run test
```

`pixi run setup` and `pixi run build` use the locked toolchain and write
`bbdir/`. `pixi run test` runs the meson suite.

## The version environment {#the-version-environment}

Meson rewrites the source version and cogapp regenerates the copies. These
tools have their own pixi environment, because the cogapp wheel installs a
`cog` script that would shadow cocogitto.

| Task | Environment | What it does |
| --- | --- | --- |
| release-cog | version | Rewrite every path in ci/version/files.txt from meson.build |
| version-drift | version | Fail if one of those copies differs |
| fragment check | version | Require a valid fragment for the branch |
| notes draft | version | Print the unreleased notes without writing them |

```default
pixi run --frozen -e version release-cog
pixi run --frozen -e version version-drift
```

## prek {#prek}

`prek.toml` runs the `version-drift` hook on every commit. Install the
shims with `prek install` after `pixi install -e version`.

```default
prek run version-drift --config prek.toml
```

## Changelog fragments {#changelog-fragments}

A user-visible change adds a fragment named `+slug.<type>.md` in the same
commit. The type is `added`, `changed`, `deprecated`, `removed`, `fixed`
or `security`. The release cut renders that directory with the notes builder.
The fragment directory README has the file name.

## Commits {#commits}

Conventional Commits: `feat:` bumps minor, `fix:` bumps patch,
and a breaking change marked with `!` bumps major. `perf:`, `docs:`, `test:`,
`build:`, `ci:`, `chore:`, `style:` and `refactor:` do not bump.
`cog.toml` sets `tag_prefix` to `v` and leaves the changelog to
the notes builder.

## CI, run locally {#ci-run-locally}

| Workflow | Local command |
| --- | --- |
| .github/workflows/ci_test.yml | pixi run test |
| .github/workflows/ci_docs.yml | pixi run -e docs docbld |
| .github/workflows/release-prepare.yml | version-drift, release metadata, fragment check and notes draft, then cog bump --auto --dry-run |
| .github/workflows/release.yml | scripts/check_release_version.py and cogapp --check |
| .github/workflows/ci_packages.yml | the package meson setup in that workflow |

`release.yml` publishes the GitHub release for a `v*` tag and uses
`GITHUB_TOKEN` only. `ci_docs.yml` publishes `gh-pages` from `main` and
uses `GITHUB_TOKEN` only. docs.dseams.info reads that branch.
