Update README.md #104
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
| # Lavern CI/CD — Lint, type-check, test, build on every push to main. | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Type-check & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type-check API | |
| run: npx tsc --noEmit | |
| - name: Type-check Frontend | |
| working-directory: viz | |
| run: | | |
| npm ci | |
| npx tsc --noEmit | |
| - name: Run tests | |
| run: npx vitest run | |
| secrets-scan: | |
| name: Secret Scan (gitleaks) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Need full history for PR-diff scan against base. | |
| - name: Run gitleaks | |
| uses: gitleaks/gitleaks-action@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITLEAKS_CONFIG: .gitleaks.toml | |
| GITLEAKS_ENABLE_UPLOAD_ARTIFACT: true | |
| GITLEAKS_ENABLE_SUMMARY: true | |
| build: | |
| name: Build Frontend | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install API deps | |
| run: npm ci | |
| - name: Install & build frontend | |
| working-directory: viz | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-build | |
| path: viz/dist/ | |
| retention-days: 7 | |
| docker: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| needs: [test, secrets-scan] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: docker build -t lavern:${{ github.sha }} . | |
| - name: Test Docker health | |
| run: | | |
| docker run -d --name lavern-test \ | |
| -p 3001:3000 \ | |
| -e ANTHROPIC_API_KEY=test \ | |
| lavern:${{ github.sha }} | |
| sleep 10 | |
| curl -sf http://localhost:3001/health || (docker logs lavern-test && exit 1) | |
| docker stop lavern-test |