Implement MLOps Studio with Advanced Collision Detection System #12
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: PR Checks | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| jobs: | |
| pre-checks: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check for package.json changes | |
| run: | | |
| if git diff --name-only HEAD~1 HEAD | grep -q "package.json"; then | |
| echo "package.json changed - verifying npm ci works" | |
| rm -rf node_modules package-lock.json | |
| npm install | |
| npm ci | |
| fi | |
| quality-checks: | |
| runs-on: ubuntu-latest | |
| needs: pre-checks | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type checking | |
| run: npx tsc --noEmit | |
| - name: Lint check | |
| run: npm run lint | |
| - name: Format check | |
| run: npx prettier --check . | |
| - name: Test with coverage | |
| run: npm test -- --coverage --watchAll=false --passWithNoTests | |
| - name: Build check | |
| run: npm run build | |
| - name: Bundle analysis | |
| run: | | |
| npm run build | |
| # Check if build is successful and doesn't exceed size limits | |
| if [ -d ".next" ]; then | |
| echo "✅ Build successful" | |
| # Optional: Add bundle size checks here | |
| else | |
| echo "❌ Build failed" | |
| exit 1 | |
| fi | |
| security-scan: | |
| runs-on: ubuntu-latest | |
| needs: pre-checks | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run security audit | |
| run: | | |
| # Show all vulnerabilities for visibility | |
| npm audit || true | |
| - name: Check for known vulnerabilities | |
| run: | | |
| # Check if any high/critical vulnerabilities exist | |
| if npm audit --audit-level=high; then | |
| echo "✅ No high/critical vulnerabilities found" | |
| else | |
| echo "❌ High or critical vulnerabilities detected" | |
| npm audit --audit-level=high | |
| exit 1 | |
| fi | |
| test-matrix: | |
| runs-on: ubuntu-latest | |
| needs: quality-checks | |
| if: github.event.pull_request.draft == false | |
| strategy: | |
| matrix: | |
| node-version: [23.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test -- --watchAll=false --passWithNoTests | |
| - name: Build project | |
| run: npm run build | |
| pr-status: | |
| runs-on: ubuntu-latest | |
| needs: [quality-checks, security-scan, test-matrix] | |
| if: always() && github.event.pull_request.draft == false | |
| steps: | |
| - name: Check PR status | |
| run: | | |
| if [[ "${{ needs.quality-checks.result }}" == "success" && | |
| "${{ needs.security-scan.result }}" == "success" && | |
| "${{ needs.test-matrix.result }}" == "success" ]]; then | |
| echo "✅ All checks passed! PR is ready for review." | |
| else | |
| echo "❌ Some checks failed. Please review and fix issues." | |
| exit 1 | |
| fi |