|
| 1 | +# Continuous Integration workflow for FlowFi |
| 2 | +# Covers frontend linting/build, backend build/test, and Soroban contract build/test. |
| 3 | +name: CI |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [ main, develop ] |
| 8 | + pull_request: |
| 9 | + branches: [ main, develop ] |
| 10 | + |
| 11 | +jobs: |
| 12 | + frontend: |
| 13 | + name: Frontend CI |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Setup Node.js |
| 20 | + uses: actions/setup-node@v4 |
| 21 | + with: |
| 22 | + node-version: '20' |
| 23 | + cache: 'npm' |
| 24 | + cache-dependency-path: frontend/package-lock.json |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: npm ci |
| 28 | + working-directory: frontend |
| 29 | + |
| 30 | + - name: Lint |
| 31 | + run: npm run lint |
| 32 | + working-directory: frontend |
| 33 | + |
| 34 | + - name: Build |
| 35 | + run: npm run build |
| 36 | + working-directory: frontend |
| 37 | + |
| 38 | + backend: |
| 39 | + name: Backend CI |
| 40 | + runs-on: ubuntu-latest |
| 41 | + services: |
| 42 | + postgres: |
| 43 | + image: postgres:15 |
| 44 | + env: |
| 45 | + POSTGRES_USER: user |
| 46 | + POSTGRES_PASSWORD: password |
| 47 | + POSTGRES_DB: flowfi_test |
| 48 | + ports: |
| 49 | + - 5432:5432 |
| 50 | + options: >- |
| 51 | + --health-cmd pg_isready |
| 52 | + --health-interval 10s |
| 53 | + --health-timeout 5s |
| 54 | + --health-retries 5 |
| 55 | +
|
| 56 | + steps: |
| 57 | + - name: Checkout code |
| 58 | + uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Setup Node.js |
| 61 | + uses: actions/setup-node@v4 |
| 62 | + with: |
| 63 | + node-version: '20' |
| 64 | + cache: 'npm' |
| 65 | + cache-dependency-path: backend/package-lock.json |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: npm ci |
| 69 | + working-directory: backend |
| 70 | + |
| 71 | + - name: Generate Prisma Client |
| 72 | + run: npx prisma generate |
| 73 | + working-directory: backend |
| 74 | + |
| 75 | + - name: Build |
| 76 | + run: npm run build |
| 77 | + working-directory: backend |
| 78 | + |
| 79 | + - name: Run Backend Tests |
| 80 | + run: npm test |
| 81 | + working-directory: backend |
| 82 | + env: |
| 83 | + DATABASE_URL: postgresql://user:password@localhost:5432/flowfi_test |
| 84 | + |
| 85 | + contracts: |
| 86 | + name: Soroban Contracts CI |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - name: Checkout code |
| 90 | + uses: actions/checkout@v4 |
| 91 | + |
| 92 | + - name: Setup Rust toolchain |
| 93 | + uses: dtolnay/rust-toolchain@stable |
| 94 | + with: |
| 95 | + toolchain: stable |
| 96 | + targets: wasm32-unknown-unknown |
| 97 | + |
| 98 | + - name: Rust Cache |
| 99 | + uses: Swatinem/rust-cache@v2 |
| 100 | + with: |
| 101 | + workspaces: "contracts -> target" |
| 102 | + |
| 103 | + - name: Build Contracts |
| 104 | + run: cargo build --target wasm32-unknown-unknown --release |
| 105 | + working-directory: contracts |
| 106 | + |
| 107 | + - name: Run Contract Tests |
| 108 | + run: cargo test |
| 109 | + working-directory: contracts |
0 commit comments