Repository navigation
Merge pull request #26 from zulfikar-ditya/main #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Run ESLint | |
| run: bun run lint | |
| - name: Check formatting | |
| run: bun run prettier --check . | |
| type-check: | |
| name: Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Run TypeScript compiler | |
| run: bun run typecheck | |
| database: | |
| name: Database Check | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:18-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: clean_fastify_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd="pg_isready -U postgres" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/clean_fastify_test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Check Drizzle migrations are up to date | |
| run: | | |
| bun run db:generate | |
| if [ -n "$(git status --porcelain src/libs/database/postgres/migrations)" ]; then | |
| echo "Error: Drizzle migrations are not up to date. Please run 'bun run db:generate' and commit the changes." | |
| git status src/libs/database/postgres/migrations | |
| exit 1 | |
| fi | |
| - name: Run Drizzle migrations | |
| run: bun run db:migrate | |
| - name: Run Drizzle check | |
| run: bunx --bun drizzle-kit check | |
| - name: Run Drizzle introspect | |
| run: bunx --bun drizzle-kit introspect | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [lint, type-check, database] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build server and worker | |
| run: bun run build | |
| - name: Verify build output | |
| run: | | |
| ls -lh dist/ | |
| test -f dist/serve.js || (echo "Missing dist/serve.js" && exit 1) | |
| test -f dist/worker.js || (echo "Missing dist/worker.js" && exit 1) | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| retention-days: 7 |