feat: v2 rewrite — hexagonal arch, ActivityPub federation, NATS, deployment-ready (#1)
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,41 +1,19 @@
|
||||
name: Build and Deploy Thoughts
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy-local:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Create .env file
|
||||
run: |
|
||||
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env
|
||||
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env
|
||||
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> .env
|
||||
echo "AUTH_SECRET=${{ secrets.AUTH_SECRET }}" >> .env
|
||||
echo "NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}" >> .env
|
||||
|
||||
- name: Build Docker Images Manually
|
||||
run: |
|
||||
docker build --target runtime -t thoughts-backend:latest ./thoughts-backend
|
||||
docker build --target release -t thoughts-frontend:latest --build-arg NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }} ./thoughts-frontend
|
||||
docker build -t custom-proxy:latest ./nginx
|
||||
|
||||
- name: Deploy with Docker Compose
|
||||
run: |
|
||||
docker compose -f compose.prod.yml down
|
||||
|
||||
POSTGRES_USER=${{ secrets.POSTGRES_USER }} \
|
||||
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} \
|
||||
POSTGRES_DB=${{ secrets.POSTGRES_DB }} \
|
||||
AUTH_SECRET=${{ secrets.AUTH_SECRET }} \
|
||||
docker compose -f compose.prod.yml up -d
|
||||
|
||||
docker image prune -f
|
||||
- name: Deploy via SSH
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_KEY }}
|
||||
script: |
|
||||
docker pull registry.gabrielkaszewski.dev/thoughts:latest
|
||||
docker pull registry.gabrielkaszewski.dev/thoughts-frontend:latest
|
||||
docker compose -f /opt/thoughts/docker-compose.yml up -d
|
||||
|
||||
24
.gitea/workflows/lint.yml
Normal file
24
.gitea/workflows/lint.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: fmt
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: clippy
|
||||
run: cargo clippy --workspace --all-targets -- -D warnings
|
||||
52
.gitea/workflows/test.yml
Normal file
52
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
# Unit tests — no database required.
|
||||
# All business logic is tested via TestStore (in-memory port implementations).
|
||||
unit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: unit tests
|
||||
run: |
|
||||
cargo test --workspace \
|
||||
--exclude postgres \
|
||||
--exclude postgres-federation \
|
||||
--exclude postgres-search
|
||||
|
||||
# Integration tests — require a real PostgreSQL instance.
|
||||
# These test that the SQL queries in the adapter crates are correct.
|
||||
integration:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: thoughts_test
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/thoughts_test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: integration tests
|
||||
run: |
|
||||
cargo test \
|
||||
-p postgres \
|
||||
-p postgres-federation \
|
||||
-p postgres-search
|
||||
Reference in New Issue
Block a user