|
| 1 | +name: BMAD Web UI CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop, BMAD-CYBEROPS-RP, WEB-UI] |
| 6 | + paths: |
| 7 | + - 'apps/web-ui/**' |
| 8 | + - '.github/workflows/web-ui-ci.yml' |
| 9 | + pull_request: |
| 10 | + branches: [main, develop, BMAD-CYBEROPS-RP] |
| 11 | + paths: |
| 12 | + - 'apps/web-ui/**' |
| 13 | + - '.github/workflows/web-ui-ci.yml' |
| 14 | + workflow_dispatch: |
| 15 | + inputs: |
| 16 | + run-e2e: |
| 17 | + description: 'Run E2E tests (slower)' |
| 18 | + required: false |
| 19 | + default: 'false' |
| 20 | + type: choice |
| 21 | + options: |
| 22 | + - 'true' |
| 23 | + - 'false' |
| 24 | + run-performance: |
| 25 | + description: 'Run performance tests' |
| 26 | + required: false |
| 27 | + default: 'false' |
| 28 | + type: choice |
| 29 | + options: |
| 30 | + - 'true' |
| 31 | + - 'false' |
| 32 | + |
| 33 | +env: |
| 34 | + NODE_VERSION: '20' |
| 35 | + WORKING_DIR: './apps/web-ui' |
| 36 | + |
| 37 | +defaults: |
| 38 | + run: |
| 39 | + working-directory: ${{ env.WORKING_DIR }} |
| 40 | + |
| 41 | +jobs: |
| 42 | + security: |
| 43 | + name: Security Tests |
| 44 | + runs-on: ubuntu-latest |
| 45 | + timeout-minutes: 10 |
| 46 | + |
| 47 | + steps: |
| 48 | + - name: Checkout code |
| 49 | + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1 |
| 50 | + |
| 51 | + - name: Setup Node.js |
| 52 | + uses: actions/setup-node@d02c89dce7e1ba9ef629ce0680989b3a1cc72edb # v4.4.0 |
| 53 | + with: |
| 54 | + node-version: ${{ env.NODE_VERSION }} |
| 55 | + cache: 'npm' |
| 56 | + cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json |
| 57 | + |
| 58 | + - name: Install dependencies |
| 59 | + run: npm ci |
| 60 | + |
| 61 | + - name: Run security audit |
| 62 | + run: npm run security:audit |
| 63 | + |
| 64 | + - name: Run OWASP Top 10 tests |
| 65 | + run: npm run test:owasp |
| 66 | + |
| 67 | + - name: Run security tests |
| 68 | + run: npm run test:security |
| 69 | + |
| 70 | + test: |
| 71 | + name: Unit & Integration Tests |
| 72 | + runs-on: ubuntu-latest |
| 73 | + timeout-minutes: 15 |
| 74 | + |
| 75 | + steps: |
| 76 | + - name: Checkout code |
| 77 | + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1 |
| 78 | + |
| 79 | + - name: Setup Node.js |
| 80 | + uses: actions/setup-node@d02c89dce7e1ba9ef629ce0680989b3a1cc72edb # v4.4.0 |
| 81 | + with: |
| 82 | + node-version: ${{ env.NODE_VERSION }} |
| 83 | + cache: 'npm' |
| 84 | + cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json |
| 85 | + |
| 86 | + - name: Install dependencies |
| 87 | + run: npm ci |
| 88 | + |
| 89 | + - name: Run unit tests |
| 90 | + run: npm run test:unit |
| 91 | + |
| 92 | + - name: Run integration tests |
| 93 | + run: npm run test:integration |
| 94 | + |
| 95 | + - name: Run tests with coverage |
| 96 | + run: npm run test:ci |
| 97 | + |
| 98 | + - name: Upload coverage report |
| 99 | + uses: actions/upload-artifact@47309c993abb98030a35d55ef7ff34b7fa1074b5 # v4.6.2 |
| 100 | + with: |
| 101 | + name: coverage-report |
| 102 | + path: ${{ env.WORKING_DIR }}/coverage/ |
| 103 | + retention-days: 7 |
| 104 | + |
| 105 | + lint: |
| 106 | + name: Lint & Build |
| 107 | + runs-on: ubuntu-latest |
| 108 | + timeout-minutes: 10 |
| 109 | + |
| 110 | + steps: |
| 111 | + - name: Checkout code |
| 112 | + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1 |
| 113 | + |
| 114 | + - name: Setup Node.js |
| 115 | + uses: actions/setup-node@d02c89dce7e1ba9ef629ce0680989b3a1cc72edb # v4.4.0 |
| 116 | + with: |
| 117 | + node-version: ${{ env.NODE_VERSION }} |
| 118 | + cache: 'npm' |
| 119 | + cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json |
| 120 | + |
| 121 | + - name: Install dependencies |
| 122 | + run: npm ci |
| 123 | + |
| 124 | + - name: Run ESLint |
| 125 | + run: npm run lint |
| 126 | + |
| 127 | + - name: Build project |
| 128 | + run: npm run build |
| 129 | + env: |
| 130 | + NEXT_TELEMETRY_DISABLED: 1 |
| 131 | + |
| 132 | + # E2E tests (optional - manual trigger or push) |
| 133 | + e2e: |
| 134 | + name: E2E Tests |
| 135 | + runs-on: ubuntu-latest |
| 136 | + timeout-minutes: 20 |
| 137 | + if: github.event.inputs.run-e2e == 'true' || github.event_name == 'push' |
| 138 | + |
| 139 | + steps: |
| 140 | + - name: Checkout code |
| 141 | + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1 |
| 142 | + |
| 143 | + - name: Setup Node.js |
| 144 | + uses: actions/setup-node@d02c89dce7e1ba9ef629ce0680989b3a1cc72edb # v4.4.0 |
| 145 | + with: |
| 146 | + node-version: ${{ env.NODE_VERSION }} |
| 147 | + cache: 'npm' |
| 148 | + cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json |
| 149 | + |
| 150 | + - name: Install dependencies |
| 151 | + run: npm ci |
| 152 | + |
| 153 | + - name: Install Playwright browsers |
| 154 | + run: npx playwright install --with-deps chromium firefox webkit |
| 155 | + |
| 156 | + - name: Run E2E tests |
| 157 | + run: npm run test:e2e |
| 158 | + env: |
| 159 | + CI: true |
| 160 | + |
| 161 | + - name: Upload Playwright report |
| 162 | + uses: actions/upload-artifact@47309c993abb98030a35d55ef7ff34b7fa1074b5 # v4.6.2 |
| 163 | + if: always() |
| 164 | + with: |
| 165 | + name: playwright-report |
| 166 | + path: ${{ env.WORKING_DIR }}/playwright-report/ |
| 167 | + retention-days: 7 |
| 168 | + |
| 169 | + # Performance tests (optional) |
| 170 | + performance: |
| 171 | + name: Performance Tests |
| 172 | + runs-on: ubuntu-latest |
| 173 | + timeout-minutes: 15 |
| 174 | + if: github.event.inputs.run-performance == 'true' || github.event_name == 'push' |
| 175 | + |
| 176 | + steps: |
| 177 | + - name: Checkout code |
| 178 | + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1 |
| 179 | + |
| 180 | + - name: Setup Node.js |
| 181 | + uses: actions/setup-node@d02c89dce7e1ba9ef629ce0680989b3a1cc72edb # v4.4.0 |
| 182 | + with: |
| 183 | + node-version: ${{ env.NODE_VERSION }} |
| 184 | + cache: 'npm' |
| 185 | + cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json |
| 186 | + |
| 187 | + - name: Install dependencies |
| 188 | + run: npm ci |
| 189 | + |
| 190 | + - name: Install K6 |
| 191 | + run: | |
| 192 | + curl https://github.com/grafana/k6/releases/download/v1.6.1/k6-v1.6.1-linux-amd64.tar.gz -L | tar xvz |
| 193 | + sudo mv k6-v1.6.1-linux-amd64/k6 /usr/local/bin/ |
| 194 | +
|
| 195 | + - name: Run smoke test |
| 196 | + run: npm run test:perf:smoke |
| 197 | + |
| 198 | + quality-gate: |
| 199 | + name: Quality Gate |
| 200 | + runs-on: ubuntu-latest |
| 201 | + needs: [security, test, lint] |
| 202 | + timeout-minutes: 5 |
| 203 | + |
| 204 | + steps: |
| 205 | + - name: Quality Gate Passed |
| 206 | + run: | |
| 207 | + echo "## BMAD Web UI Quality Gate" >> $GITHUB_STEP_SUMMARY |
| 208 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 209 | + echo "### Status: PASSED ✅" >> $GITHUB_STEP_SUMMARY |
| 210 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 211 | + echo "All required checks passed:" >> $GITHUB_STEP_SUMMARY |
| 212 | + echo "- ✅ Security Tests" >> $GITHUB_STEP_SUMMARY |
| 213 | + echo "- ✅ Unit & Integration Tests" >> $GITHUB_STEP_SUMMARY |
| 214 | + echo "- ✅ Lint & Build" >> $GITHUB_STEP_SUMMARY |
0 commit comments