|
| 1 | +name: Quality Checks |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [workflows] |
| 7 | + # branches: [main, develop] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +env: |
| 14 | + NODE_ENV: development |
| 15 | + HUSKY: 0 |
| 16 | + |
| 17 | +jobs: |
| 18 | + install: |
| 19 | + name: Install Dependencies |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup Node.js |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version: 22 |
| 29 | + cache: 'npm' |
| 30 | + |
| 31 | + - name: Install Dependencies |
| 32 | + run: npm ci |
| 33 | + |
| 34 | + quality: |
| 35 | + needs: install |
| 36 | + name: Code Quality |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Setup Node.js |
| 43 | + uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: 22 |
| 46 | + cache: 'npm' |
| 47 | + |
| 48 | + - name: Install Dependencies |
| 49 | + run: npm ci |
| 50 | + |
| 51 | + - name: Run Type Check |
| 52 | + run: npm run typecheck |
| 53 | + |
| 54 | + - name: Run ESLint |
| 55 | + run: npm run lint |
| 56 | + |
| 57 | + - name: Run Prettier Check |
| 58 | + run: npm run format:check |
| 59 | + |
| 60 | + - name: Run Markdown Lint Check |
| 61 | + run: npm run lint:md |
| 62 | + |
| 63 | + build: |
| 64 | + needs: quality |
| 65 | + name: Build |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: Checkout |
| 69 | + uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Setup Node.js |
| 72 | + uses: actions/setup-node@v4 |
| 73 | + with: |
| 74 | + node-version: 22 |
| 75 | + cache: 'npm' |
| 76 | + |
| 77 | + - name: Install Dependencies |
| 78 | + run: npm ci |
| 79 | + |
| 80 | + - name: Build |
| 81 | + run: npm run build |
| 82 | + |
| 83 | + status-check: |
| 84 | + needs: [install, quality, build] |
| 85 | + name: Final Status Check |
| 86 | + runs-on: ubuntu-latest |
| 87 | + if: always() |
| 88 | + steps: |
| 89 | + - name: Check Workflow Status |
| 90 | + run: | |
| 91 | + if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then |
| 92 | + echo "❌ Workflow failed because one or more jobs failed" |
| 93 | + exit 1 |
| 94 | + elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then |
| 95 | + echo "⚠️ Workflow cancelled because one or more jobs were cancelled" |
| 96 | + exit 1 |
| 97 | + else |
| 98 | + echo "✅ All jobs completed successfully" |
| 99 | + fi |
0 commit comments