@@ -19,58 +19,82 @@ to manage both schema and data migrations across multiple backends, ensuring con
1919- Docker and Docker Compose plugin (` docker compose ` CLI)
2020- ` make `
2121- [ CodeRabbit CLI] ( https://www.coderabbit.ai/cli ) (optional. Used for running review check locally)
22- - Copy .env.sample to .env
22+
2323
2424### Make targets overview
2525
26- Common development workflows are wrapped in the ` makefile ` :
26+ Common development workflows are wrapped in the ` Makefile ` . Run ` make help ` to see the list of available commands.
27+
28+ ### How the Makefile works
29+
30+ The project uses a modular Makefile structure that organizes commands into logical groups:
31+
32+ - ** Main Makefile** (` Makefile ` ): Entry point that automatically includes all ` .mk ` files from the ` make/ ` directory
33+ - ** Modular includes** (` make/*.mk ` ): Commands are organized by category:
34+ - ` common.mk ` - Core development commands (build, test, format, etc.)
35+ - ` repo.mk ` - Repository management and dependency commands
36+ - ` migrations.mk ` - Database migration commands (Only available in extension repositories)
37+ - ` external_tools.mk ` - Integration with external tools
38+
39+
40+ You can extend the Makefile with your own custom commands creating a ` local.mk ` file inside make folder. This file is
41+ automatically ignored by git, so your personal commands won't affect other developers or appear in version control.
42+
2743
28- - ` make help ` – list available commands
29- - ` make bash ` – start the app container and open a bash shell
30- - ` make build ` – build the application image for development
31- - ` make check ` – run code quality checks (ruff, flake8, lockfile check)
32- - ` make check-all ` – run checks and tests
33- - ` make format ` – apply formatting and import fixes
34- - ` make down ` – stop and remove containers
35- - ` make review ` – check the code in the cli by running CodeRabbit
36- - ` make run ` – run the CLI tool
37- - ` make test ` – run the test suite with pytest
44+ ### Setup
3845
39- ## Running CLI commands
46+ Follow these steps to set up the development environment:
47+
48+ #### 1. Clone the repository
4049
41- Run the CLI tool:
4250``` bash
43- make run
51+ git clone < repository-url>
52+ ```
53+ ``` bash
54+ cd mpt-tool
4455```
4556
46- ## Running tests
57+ #### 2. Create environment configuration
4758
48- Tests run inside Docker using the dev configuration.
59+ Copy the sample environment file and update it with your values:
4960
50- Run the full test suite:
61+ ``` bash
62+ cp .env.sample .env
63+ ```
64+
65+ Edit the ` .env ` file with your actual configuration values. See the [ Configuration] ( #configuration ) section for details on available variables.
66+
67+ In the project root, create and configure the following files.
68+
69+ #### 3. Build the Docker images
70+
71+ Build the development environment:
5172
5273``` bash
53- make test
74+ make build
5475```
5576
56- Pass additional arguments to pytest using the ` args ` variable:
77+ This will create the Docker images with all required dependencies and the virtualenv.
78+
79+ #### 4. Verify the setup
80+
81+ Run the test suite to ensure everything is configured correctly:
5782
5883``` bash
59- make test args=" -k test_cli -vv"
60- make test args=" tests/test_cli.py"
84+ make test
6185```
6286
63- ## Pre-commit
87+ You're now ready to start developing! See [ Running the cli] ( #running-the-cli ) for next steps.
88+
6489
65- Checking migrations with pre-commit:
90+ ## Running the cli
6691
67- Add this to your .pre-commit-config.yaml
92+ Before running, ensure your ` .env ` file is populated.
6893
69- ``` yaml
70- - repo : https://github.com/softwareone-platform/mpt-tool
71- rev : ' ' # Use the sha / tag you want to point at
72- hooks :
73- - id : check-migrations
94+ Start the cli:
95+
96+ ``` bash
97+ make run
7498```
7599
76100## Developer utilities
0 commit comments