-
Notifications
You must be signed in to change notification settings - Fork 40
Add scripts and documentation for tests and common development flows #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e081392
9607136
f74bc73
7807ee5
045f4df
fa63e88
15f6ccc
e7e19f1
16177c1
9255f29
cda9ed4
1b87897
e549cc5
d7108de
f305e4d
1f89460
089f2c1
6bb5175
a402936
e8fbf39
c86ebec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Developer Documentation | ||
|
|
||
| This directory contains documentation for CatColab developers working on testing, deployment, and local development workflows. | ||
|
|
||
| ## Guides | ||
|
|
||
| ### [Testing Guide](docs/testing-guide.md) | ||
| Learn how to run integration tests, test deployments, and debug test failures with a progressive isolation strategy. | ||
|
|
||
| ### [Development Workflows](docs/workflows.md) | ||
| Example workflows demonstrating how to use `cc-utils` script for common development tasks. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small thing but running just but exits with 0 i.e. success status while doing nothing. |
||
|
|
||
| ## Reference | ||
|
|
||
| ### [cc-utils vm](docs/references/cc-utils-vm.md) | ||
| Reference for `cc-utils vm` commands used to manage local NixOS VMs. | ||
|
|
||
| ### [cc-utils db](docs/references/cc-utils-db.md) | ||
| Reference for `cc-utils db` commands used to manage databases across environments. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| **Preview remote branch:** | ||
| ```bash | ||
| cc-utils vm start my-feature-branch --db cached | ||
| ``` | ||
|
Comment on lines
+23
to
+26
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might just be me but I was confused by the combination of the words "remote branch" and the lack of an The other thing this has without any explanation is the |
||
|
|
||
| **Test a deployment:** | ||
| ```bash | ||
| cc-utils vm test-deploy | ||
| ``` | ||
|
|
||
| **Work with databases:** | ||
| ```bash | ||
| # Dump staging database | ||
| cc-utils db dump --from staging | ||
|
|
||
| # Load most recent staging dump into local db | ||
| cc-utils db load --from staging | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # cc-utils DB Commands Reference | ||
|
|
||
| The `cc-utils db` commands provide tools for managing databases across environments (local, staging, production, vm). | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned at dev meeting we need to document how to get |
||
|
|
||
| ## Available Commands | ||
|
|
||
| ### connect | ||
|
|
||
| ```bash | ||
| cc-utils db connect <target> | ||
| ``` | ||
|
|
||
| Opens a `psql` connection to the specified database. | ||
|
|
||
| **Targets:** `local`, `staging`, `production`, `vm` | ||
|
|
||
| ### dump | ||
|
|
||
| ```bash | ||
| cc-utils db dump [--from <target>] [--to <filename>] [--quiet] | ||
| ``` | ||
|
|
||
| Creates a SQL dump file. Defaults to `local` and generates a timestamped filename. | ||
|
|
||
| **Options:** | ||
| - `--from`: Source database (local, staging, production, vm) | ||
| - `--to`: Output filename (stored in `./dumps/`) | ||
| - `--quiet`: Only output the dump file path | ||
|
|
||
| ### load | ||
|
|
||
| ```bash | ||
| cc-utils db load --from <file|source> [--to <target>] [--skip-migrations] | ||
| ``` | ||
|
|
||
| Loads a SQL dump into a database and runs migrations by default. | ||
|
|
||
| **Options:** | ||
| - `--from`: Dump file path or source name (local, staging, production) for most recent dump | ||
| - `--to`: Target database (local or vm) | ||
| - `--skip-migrations`: Skip running migrations after loading | ||
|
|
||
| ### reset | ||
|
|
||
| ```bash | ||
| cc-utils db reset [--skip-migrations] | ||
| ``` | ||
|
|
||
| Drops and recreates the local database. Only supports `local` target. | ||
|
|
||
| **Options:** | ||
| - `--skip-migrations`: Skip running migrations after reset | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # cc-utils VM Commands Reference | ||
|
|
||
| The `cc-utils vm` commands provide tools for managing local NixOS VMs for testing and development. | ||
|
|
||
| ## Available Commands | ||
|
|
||
| ### start | ||
|
|
||
| ```bash | ||
| cc-utils vm start [branch] [--db skip|cached|<file>] | ||
| ``` | ||
|
|
||
| Starts a VM, optionally from a specific GitHub branch. | ||
|
|
||
| **Arguments:** | ||
| - `branch` (optional) - GitHub branch name to build VM from. If omitted, uses local nix configuration. | ||
|
|
||
| **Database options:** | ||
| - No `--db` flag (default) - Load fresh staging database dump | ||
| - `--db skip` - Don't load any database | ||
| - `--db cached` - Use most recent staging dump in dumps/, or create new if missing | ||
| - `--db <file>` - Load from specific dump file path | ||
|
|
||
| **Examples:** | ||
| ```bash | ||
| # Start local VM with fresh staging DB | ||
| cc-utils vm start | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My experience running this so far is it building a lot of things and timing out. In the background it's still building and I can tail that log
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I run it today it seems to use the built VM and completes instantly and I can do |
||
|
|
||
| # Start VM from branch with cached DB | ||
| cc-utils vm start my-feature-branch --db cached | ||
|
|
||
| # Start without loading database | ||
| cc-utils vm start --db skip | ||
|
|
||
| # Start with specific dump file | ||
| cc-utils vm start --db ./dumps/my_dump.sql | ||
| ``` | ||
|
|
||
| ### stop | ||
|
|
||
| ```bash | ||
| cc-utils vm stop | ||
| ``` | ||
|
|
||
| Gracefully shuts down the running VM. | ||
|
|
||
| ### status | ||
|
|
||
| ```bash | ||
| cc-utils vm status | ||
| ``` | ||
|
|
||
| Shows whether the VM is running and displays the log file location. | ||
|
|
||
| ### logs | ||
|
|
||
| ```bash | ||
| cc-utils vm logs [--follow] | ||
| ``` | ||
|
|
||
| Displays VM logs. Use `--follow` (or `-f`) to tail the logs in real-time. | ||
|
|
||
| ### connect | ||
|
|
||
| ```bash | ||
| cc-utils vm connect | ||
| ``` | ||
|
|
||
| Opens an SSH connection to the running VM. Useful for inspecting the VM state or running commands manually. | ||
|
|
||
| ### test-deploy | ||
|
|
||
| ```bash | ||
| cc-utils vm test-deploy | ||
| ``` | ||
|
|
||
| Comprehensive test workflow that: | ||
| 1. Builds a VM from the current staging branch on GitHub | ||
| 2. Starts the VM | ||
| 3. Copies the staging database to the VM | ||
| 4. Deploys your current local branch to the running VM | ||
| 5. Runs the frontend tests | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this is a separate document from CONTRIBUTING.md? It should at least be linked from it.