Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions MyFans/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
STELLAR_NETWORK=testnet
CONTRACT_ADDRESS=
BACKEND_URL=http://localhost:3001
JWT_SECRET=your_jwt_secret_key
180 changes: 180 additions & 0 deletions MyFans/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: CI

on:
push:
branches: [main, master, feat/dependency-audit-ci, "ci/**"]
pull_request:
branches: [main, master, feat/dependency-audit-ci]

jobs:
frontend:
name: Frontend
runs-on: ubuntu-latest
steps:
- 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: npm ci
working-directory: frontend

- name: Security audit (dependencies)
run: npm audit --omit=dev --audit-level=high
working-directory: frontend

- name: Build
run: npm run build
working-directory: frontend

backend:
name: Backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install --no-audit --no-fund
fi
working-directory: backend

- name: Security audit (dependencies)
run: npm audit --omit=dev --audit-level=high
working-directory: backend

- name: Build
run: npm run build
working-directory: backend

- name: Run unit tests
run: npm test
working-directory: backend
env:
JWT_SECRET: ci-test-secret
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: myfans

- name: Run E2E tests
run: npm run test:e2e
working-directory: backend
env:
JWT_SECRET: ci-test-secret
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: myfans

# Single audit job (not duplicated across the toolchain matrix) to save CI time.
contracts-audit:
name: Contracts (RustSec audit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown,wasm32v1-none

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: contract
prefix-key: contracts-audit

- name: Install cargo-audit
run: cargo install cargo-audit --locked

- name: Security audit (contracts)
# Fail on high/critical RustSec advisories as configured in contract/audit.toml.
run: cargo audit
working-directory: contract

contracts:
name: Contracts (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Rust stable × two supported stellar-cli releases
- name: rust-stable-cli-23
rust: stable
stellar_cli: "23.4.1"
- name: rust-stable-cli-25
rust: stable
stellar_cli: "25.2.0"
# Minimum supported toolchain in CI (keep aligned with Soroban SDK / MSRV)
- name: rust-1.82-cli-23
rust: "1.82"
stellar_cli: "23.4.1"
- name: rust-1.82-cli-25
rust: "1.82"
stellar_cli: "25.2.0"
steps:
- uses: actions/checkout@v4

- name: Install system dependencies (for stellar-cli)
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev libudev-dev pkg-config

- name: Install Rust (${{ matrix.rust }})
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: wasm32-unknown-unknown,wasm32v1-none

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: contract
prefix-key: contracts-${{ matrix.name }}

- name: Build (wasm release, workspace)
run: cargo build --workspace --target wasm32-unknown-unknown --release
working-directory: contract

- name: Run tests (workspace)
run: cargo test --workspace
working-directory: contract

- name: Cache stellar CLI binary
id: stellar-cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/stellar
key: stellar-cli-${{ matrix.stellar_cli }}-${{ runner.os }}-v1

- name: Install Stellar CLI ${{ matrix.stellar_cli }}
if: steps.stellar-cache.outputs.cache-hit != 'true'
run: cargo install stellar-cli --locked --version ${{ matrix.stellar_cli }}

- name: Deploy and verify on Futurenet (smoke)
run: |
./scripts/deploy.sh \
--network futurenet \
--source "ci-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.name }}" \
--out "./deployed-ci-${{ matrix.name }}.json" \
--env-out "./.env.deployed-ci-${{ matrix.name }}"
working-directory: contract
53 changes: 53 additions & 0 deletions MyFans/.github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: E2E Tests

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

jobs:
test:
timeout-minutes: 60
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 frontend dependencies
working-directory: ./frontend
run: npm ci

- name: Install Playwright Browsers
working-directory: ./frontend
run: npx playwright install --with-deps chromium

- name: Run E2E tests
working-directory: ./frontend
run: npm run test:e2e
env:
CI: true

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 30

- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: frontend/test-results/
retention-days: 7
81 changes: 81 additions & 0 deletions MyFans/.github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: E2E Tests

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

jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 15

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

steps:
- 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
backend/package-lock.json

- name: Install backend dependencies
working-directory: backend
run: npm ci

- name: Install frontend dependencies
working-directory: frontend
run: npm ci

- name: Install Playwright browsers
working-directory: frontend
run: npx playwright install --with-deps chromium

- name: Start backend
working-directory: backend
run: |
npm run start:dev &
npx wait-on http://localhost:3001/v1/health -t 60000
env:
PORT: 3001
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
# DB_PASSWORD comes from the postgres service container (ephemeral, test-only)
DB_PASSWORD: ${{ secrets.E2E_DB_PASSWORD || 'postgres' }}
DB_NAME: myfans
# JWT_SECRET for E2E is a test-only value stored as a GitHub Secret.
# It is never shared with production and rotated independently.
JWT_SECRET: ${{ secrets.E2E_JWT_SECRET || 'test-secret-value-for-ci-only' }}

- name: Run E2E tests
working-directory: frontend
run: npm run test:e2e
env:
CI: true

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 7
43 changes: 43 additions & 0 deletions MyFans/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Dependencies
node_modules/

# Contract (Rust / Soroban)
contract/target/
contract/deployed.json
contract/.env.deployed
contract/deployed-ci.json
contract/.env.deployed-ci
contract/.stellar/

# Environment
.env
.env.*
!.env.example

# OS
.DS_Store
Thumbs.db

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build / cache
dist/
build/
.next/
out/
*.tsbuildinfo

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

# Misc
*.pem
.vercel
coverage/
1 change: 1 addition & 0 deletions MyFans/.kiro/specs/retry-banner/.config.kiro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"specId": "0c1d1f63-92c5-498c-8971-480acf3c66b4", "workflowType": "requirements-first", "specType": "feature"}
Empty file.
Loading