mirror of
https://github.com/ghndrx/shellmate.git
synced 2026-02-10 06:45:02 +00:00
Add CI/CD pipeline and SDLC docs
This commit is contained in:
18
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
18
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
## Description
|
||||||
|
<!-- What does this PR do? -->
|
||||||
|
|
||||||
|
## Type of Change
|
||||||
|
- [ ] 🐛 Bug fix
|
||||||
|
- [ ] ✨ New feature
|
||||||
|
- [ ] 🔧 Refactor
|
||||||
|
- [ ] 📚 Documentation
|
||||||
|
- [ ] 🧪 Tests
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
<!-- How was this tested? -->
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
- [ ] Code follows project style guidelines
|
||||||
|
- [ ] Tests pass locally
|
||||||
|
- [ ] Documentation updated (if needed)
|
||||||
|
- [ ] No sensitive data exposed
|
||||||
67
.github/workflows/ci.yml
vendored
Normal file
67
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [develop, master]
|
||||||
|
pull_request:
|
||||||
|
branches: [develop]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install ruff mypy
|
||||||
|
pip install -e ".[dev]"
|
||||||
|
|
||||||
|
- name: Lint with ruff
|
||||||
|
run: ruff check src/
|
||||||
|
|
||||||
|
- name: Type check with mypy
|
||||||
|
run: mypy src/ --ignore-missing-imports
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: lint
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
|
||||||
|
- name: Install Stockfish
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y stockfish
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install -e ".[dev]"
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: pytest tests/ -v --tb=short
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: test
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: false
|
||||||
|
tags: shellmate:${{ github.sha }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
66
.github/workflows/deploy.yml
vendored
Normal file
66
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
name: Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=sha,prefix=
|
||||||
|
type=raw,value=latest
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build-and-push
|
||||||
|
environment: production
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy to Hetzner
|
||||||
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.HETZNER_HOST }}
|
||||||
|
username: ${{ secrets.HETZNER_USER }}
|
||||||
|
key: ${{ secrets.HETZNER_SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
cd /opt/shellmate
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d --remove-orphans
|
||||||
|
docker system prune -f
|
||||||
52
CONTRIBUTING.md
Normal file
52
CONTRIBUTING.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# Contributing to ShellMate
|
||||||
|
|
||||||
|
Thanks for your interest in contributing! 🎉
|
||||||
|
|
||||||
|
## Branch Strategy
|
||||||
|
|
||||||
|
```
|
||||||
|
feature/* ──→ develop ──→ master
|
||||||
|
│ │
|
||||||
|
staging production
|
||||||
|
```
|
||||||
|
|
||||||
|
- **`develop`** — Default branch, all PRs target here
|
||||||
|
- **`master`** — Production releases only
|
||||||
|
- **`feature/*`** — Feature branches off develop
|
||||||
|
|
||||||
|
## Development Flow
|
||||||
|
|
||||||
|
1. Fork the repo
|
||||||
|
2. Create a feature branch from `develop`:
|
||||||
|
```bash
|
||||||
|
git checkout develop
|
||||||
|
git pull origin develop
|
||||||
|
git checkout -b feature/my-feature
|
||||||
|
```
|
||||||
|
3. Make your changes
|
||||||
|
4. Run tests: `pytest tests/ -v`
|
||||||
|
5. Run linting: `ruff check src/`
|
||||||
|
6. Push and create a PR to `develop`
|
||||||
|
|
||||||
|
## Code Style
|
||||||
|
|
||||||
|
- Python 3.11+
|
||||||
|
- Type hints required
|
||||||
|
- Ruff for linting
|
||||||
|
- 100 char line limit
|
||||||
|
|
||||||
|
## Commit Messages
|
||||||
|
|
||||||
|
Use conventional commits:
|
||||||
|
- `feat:` New feature
|
||||||
|
- `fix:` Bug fix
|
||||||
|
- `docs:` Documentation
|
||||||
|
- `refactor:` Code refactor
|
||||||
|
- `test:` Tests
|
||||||
|
- `chore:` Maintenance
|
||||||
|
|
||||||
|
## Release Process
|
||||||
|
|
||||||
|
1. PRs merged to `develop` deploy to staging
|
||||||
|
2. When ready, merge `develop` → `master`
|
||||||
|
3. Master deploys to production automatically
|
||||||
Reference in New Issue
Block a user