|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +env: |
| 10 | + NODE_VERSION: '22' |
| 11 | + |
| 12 | +jobs: |
| 13 | + lint: |
| 14 | + name: Lint |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Setup pnpm |
| 21 | + uses: pnpm/action-setup@v4 |
| 22 | + |
| 23 | + - name: Setup Node.js |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: ${{ env.NODE_VERSION }} |
| 27 | + cache: 'pnpm' |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: pnpm install --frozen-lockfile |
| 31 | + |
| 32 | + - name: Run ESLint |
| 33 | + run: pnpm run lint |
| 34 | + |
| 35 | + type-check: |
| 36 | + name: Type Check |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Setup pnpm |
| 43 | + uses: pnpm/action-setup@v4 |
| 44 | + |
| 45 | + - name: Setup Node.js |
| 46 | + uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version: ${{ env.NODE_VERSION }} |
| 49 | + cache: 'pnpm' |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: pnpm install --frozen-lockfile |
| 53 | + |
| 54 | + - name: Type check |
| 55 | + run: pnpm exec tsc --noEmit |
| 56 | + |
| 57 | + test: |
| 58 | + name: Test |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - name: Checkout |
| 62 | + uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - name: Setup pnpm |
| 65 | + uses: pnpm/action-setup@v4 |
| 66 | + |
| 67 | + - name: Setup Node.js |
| 68 | + uses: actions/setup-node@v4 |
| 69 | + with: |
| 70 | + node-version: ${{ env.NODE_VERSION }} |
| 71 | + cache: 'pnpm' |
| 72 | + |
| 73 | + - name: Install dependencies |
| 74 | + run: pnpm install --frozen-lockfile |
| 75 | + |
| 76 | + - name: Run tests |
| 77 | + run: pnpm test:coverage |
| 78 | + |
| 79 | + - name: Upload coverage |
| 80 | + uses: codecov/codecov-action@v4 |
| 81 | + with: |
| 82 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 83 | + fail_ci_if_error: false |
| 84 | + |
| 85 | + build: |
| 86 | + name: Build |
| 87 | + runs-on: ubuntu-latest |
| 88 | + needs: [lint, type-check, test] |
| 89 | + steps: |
| 90 | + - name: Checkout |
| 91 | + uses: actions/checkout@v4 |
| 92 | + |
| 93 | + - name: Setup pnpm |
| 94 | + uses: pnpm/action-setup@v4 |
| 95 | + |
| 96 | + - name: Setup Node.js |
| 97 | + uses: actions/setup-node@v4 |
| 98 | + with: |
| 99 | + node-version: ${{ env.NODE_VERSION }} |
| 100 | + cache: 'pnpm' |
| 101 | + |
| 102 | + - name: Install dependencies |
| 103 | + run: pnpm install --frozen-lockfile |
| 104 | + |
| 105 | + - name: Build |
| 106 | + run: pnpm run build |
| 107 | + |
| 108 | + - name: Upload build artifacts |
| 109 | + uses: actions/upload-artifact@v4 |
| 110 | + with: |
| 111 | + name: dist |
| 112 | + path: dist/ |
| 113 | + retention-days: 7 |
| 114 | + |
| 115 | + # Security audit |
| 116 | + security: |
| 117 | + name: Security Audit |
| 118 | + runs-on: ubuntu-latest |
| 119 | + steps: |
| 120 | + - name: Checkout |
| 121 | + uses: actions/checkout@v4 |
| 122 | + |
| 123 | + - name: Setup pnpm |
| 124 | + uses: pnpm/action-setup@v4 |
| 125 | + |
| 126 | + - name: Setup Node.js |
| 127 | + uses: actions/setup-node@v4 |
| 128 | + with: |
| 129 | + node-version: ${{ env.NODE_VERSION }} |
| 130 | + cache: 'pnpm' |
| 131 | + |
| 132 | + - name: Install dependencies |
| 133 | + run: pnpm install --frozen-lockfile |
| 134 | + |
| 135 | + - name: Run security audit |
| 136 | + run: pnpm audit --audit-level=high |
| 137 | + continue-on-error: true |
0 commit comments