Guidelines for developing, testing, and releasing dbmate-deployer - a tool that deploys database migrations from S3 to PostgreSQL using dbmate
This skill provides comprehensive guidelines for developing, testing, and releasing dbmate-deployer - a tool that deploys database migrations from S3 to PostgreSQL using dbmate.
Guides AI agents through the complete development workflow for the dbmate-deployer project, including:
**CRITICAL**: All project artifacts MUST be written in English:
Build the binary using one of these methods:
```bash
make build
go build -o dbmate-deployer ./cmd/dbmate-deployer
```
Test the application with these commands:
```bash
./dbmate-deployer --help
./dbmate-deployer watch \
--database-url="postgres://user:pass@localhost:5432/db" \
--s3-bucket=test-bucket \
--s3-path-prefix=migrations/ \
--s3-endpoint-url=http://localhost:4566
```
#### Test Types
**Unit Tests**: Fast tests using mocks, no external dependencies
**Integration Tests**: End-to-end tests using testcontainers-go
#### Running Tests
```bash
make test
make test-unit
make test-integration
```
#### Special Setup for Colima Users (macOS)
If using Colima as Docker runtime:
```bash
export DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock"
export TESTCONTAINERS_RYUK_DISABLED=true
make test-integration
DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock" TESTCONTAINERS_RYUK_DISABLED=true make test-integration
```
#### Adding New Tests
When creating tests:
1. Place unit tests alongside the code they test
2. Use `TestEnvironment` from `internal/shared/testhelpers/containers.go` for integration tests
3. Use mock S3 client from `internal/shared/testhelpers` for unit tests
4. Follow naming convention: integration tests end with `Integration` suffix
#### Linting
```bash
make lint
```
#### Code Style Requirements
This project uses dbmate for migrations. Files follow this convention:
**Naming**: `YYYYMMDDHHMMSS_description.sql`
**Example**:
```sql
-- migrate:up
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- migrate:down
DROP TABLE users;
```
See [dbmate documentation](https://github.com/amacneil/dbmate) for details.
#### Branch Protection
#### Automated Release with tagpr
1. On each merge to `main`, tagpr creates/updates a release PR
2. When release PR is merged, git tag is automatically created
3. Docker images and binaries are automatically built and published
#### GitHub Actions Workflows
**`.github/workflows/docker.yml`** - CI builds:
**`.github/workflows/tagpr.yml`** - Version management:
**`.github/workflows/release.yml`** - Release builds (triggered by version tags):
#### Docker Image Tags
#### Binary Release Platforms
#### Release Artifacts
#### Making Container Images Public (First Release Only)
1. Go to **Packages** in GitHub repository
2. Click on `dbmate-deployer` package
3. Go to **Package settings**
4. Scroll to **Danger Zone**
5. Click **Change visibility** → **Public**
```bash
make help # Show all available targets
make build # Build the binary
make test # Run all tests (unit + integration)
make test-unit # Run unit tests only (fast, no Docker)
make test-integration # Run integration tests (requires Docker)
make lint # Run golangci-lint
make clean # Clean build artifacts
```
```bash
make test
```
```bash
git checkout -b feat/add-retry-logic
make test
make lint
git commit -m "feat: add exponential backoff retry logic for S3 operations"
git push origin feat/add-retry-logic
```
```bash
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/dbmate-deployer-development-guide/raw