Metadata-Version: 2.4
Name: odoo-runbot
Version: 1.9.0
Summary: Main CLI to run test in GitLab CI
Author-email: Alexis PASQUIER <alexis.pasquier@mangono.fr>
Requires-Python: >=3.8
Requires-Dist: addons-installer>=3.9.0
Requires-Dist: coverage[toml]
Requires-Dist: environ-odoo-config>=0.6.5
Requires-Dist: python-gitlab>=4.13.0
Requires-Dist: tomli; python_version < '3.11'
Requires-Dist: typer
Requires-Dist: typing-extensions
Requires-Dist: unittest-xml-reporting
Provides-Extra: psycopg
Requires-Dist: psycopg2>=2.8.3; extra == 'psycopg'
Description-Content-Type: text/markdown

# Mangono runbot (Odoo tester)

This project all the source code relative to the process to test Odoo in the mangono way.

This project support Odoo version `12.0` to `18.0`.

The complete documentation is available [on atlas](https://atlas.docs.mangono.io/)

## Use it as a GitLab CI Components

```yaml
include:
  - component: $CI_SERVER_FQDN/gitlab-ci/odoo-quality/runbot@1
    inputs:
      odoo-version: "18.0"
```

See this component page [for more information](https://gitlab.mangono.io/explore/catalog/gitlab-ci/mangono-runbot)

## Run tests

You can simply run test with
```shell
hatch -e test test
```

If you want to run the runbot on a particular version you can

```shell
docker compose run --rm -it runbot18
```

# Build lib

```shell
hatch build
```


## Use it with mise (without Docker Odoo image)

Use the `runbot-mise` component if your runner already has `mise` available and you prefer
not to depend on a pre-built Odoo Docker image:

```yaml
include:
  - component: $CI_SERVER_FQDN/gitlab-ci/odoo-quality/runbot-mise@1
    inputs:
      odoo-version: "18.0"
      tag: "my-runner"
```

The component uses `registry.mangono.io/dockers/clevertools-batteries` as the base image.
It calls `mise run build` to set up the Odoo venv, then delegates to `mise run odoo:runbot`.

### Required mise tasks (in the consuming project)

The consuming project must expose two tasks in its `mise.toml` / `tasks/` directory:

- **`build`** — downloads Odoo and sets up the Python venv
- **`odoo:runbot`** — runs the full runbot sequence (diag → init → run → report)

To create `odoo:runbot` as a file-based task (recommended), add
`tasks/odoo/runbot` to the consuming project (see
[odoo-mise-linux](https://gitlab.mangono.io/odoo-cloud/odoo-mise-linux)):

```sh
#!/usr/bin/env bash
# mise description="Lance le runbot Odoo (diag → init → run → report)"
set -e
odoo-runbot --verbose --workdir="${RUNBOT_WORKDIR:-.}" --config="${RUNBOT_CONFIG:-}" diag
export DB_HOST="${DB_HOST:-database}"
odoo-runbot --verbose --workdir="${RUNBOT_WORKDIR:-.}" --config="${RUNBOT_CONFIG:-}" init
odoo-runbot --workdir="${RUNBOT_WORKDIR:-.}" --config="${RUNBOT_CONFIG:-}" run ${RUNBOT_ARGS:-} || EXIT=$?
echo "Execute coverage report in ${RUNBOT_WORKDIR:-.}/runbot_result"
odoo-runbot --workdir="${RUNBOT_WORKDIR:-.}" --config="${RUNBOT_CONFIG:-}" report
exit ${EXIT:-0}
```

Configuration is done via `[env]` in `mise.toml`:

```toml
[env]
RUNBOT_WORKDIR = "odoo_project"
RUNBOT_CONFIG  = "odoo_project/pyproject.toml"
```

## Build Doc

You can build python code as doc with mkdoc, you only need to run
```shell
hatch -e doc run mkdocs build # or server
```
