Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Database
DATABASE_URL=postgres://guild_user:guild_password@localhost:5432/guild_genesis

# Frontend
PUBLIC_WALLET_CONNECT_PROJECT_ID=your_project_id_here
PUBLIC_API_URL=http://localhost:3001
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake

181 changes: 181 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
frontend:
name: Frontend Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: |
cd frontend
npm ci

- name: Run linter
run: |
cd frontend
npm run lint

- name: Run tests
run: |
cd frontend
npm run test:run

- name: Build frontend
run: |
cd frontend
npm run build

backend:
name: Backend Tests
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: guild_genesis_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true

- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install dependencies
run: |
cd backend
cargo build --verbose

- name: Run clippy
run: |
cd backend
cargo clippy --all-targets --all-features -- -D warnings

- name: Run rustfmt
run: |
cd backend
cargo fmt --all -- --check

- name: Run tests
run: |
cd backend
cargo test --verbose
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test

integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: [frontend, backend]

services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: guild_genesis_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install dependencies
run: |
cd frontend && npm ci
cd ../backend && cargo build

- name: Run integration tests
run: |
cd backend
cargo test --test integration_tests --verbose
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test

docker:
name: Docker Build Test
runs-on: ubuntu-latest
needs: [frontend, backend]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and test Docker images
run: |
docker-compose build
docker-compose up -d postgres
sleep 10
docker-compose up --build --abort-on-container-exit backend frontend

89 changes: 89 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Nix
result
.direnv

# PostgreSQL data directory
.postgres/

# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build outputs
dist/
target/

# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Logs
*.log
logs/

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage/

# nyc test coverage
.nyc_output

# Dependency directories
jspm_packages/

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
Loading
Loading