.github/workflows/ci-web.yml

100 lines · 2621 bytes

  1name: 🚦 Web CI
  2
  3on:
  4  pull_request:
  5    paths: ['web/**']
  6  workflow_dispatch:
  7
  8permissions:
  9  contents: read
 10
 11jobs:
 12  lint:
 13    name: 🧼 Lint
 14    runs-on: ubuntu-latest
 15    defaults:
 16      run:
 17        working-directory: web
 18    steps:
 19      - uses: actions/checkout@v5
 20      - run: corepack enable
 21      - uses: actions/setup-node@v5
 22        with:
 23          node-version-file: web/.nvmrc
 24          cache: yarn
 25          cache-dependency-path: web/yarn.lock
 26      - run: yarn install --immutable
 27      - run: yarn lint
 28
 29  format:
 30    name: 💅 Format
 31    runs-on: ubuntu-latest
 32    defaults:
 33      run:
 34        working-directory: web
 35    steps:
 36      - uses: actions/checkout@v5
 37      - run: corepack enable
 38      - uses: actions/setup-node@v5
 39        with:
 40          node-version-file: web/.nvmrc
 41          cache: yarn
 42          cache-dependency-path: web/yarn.lock
 43      - run: yarn install --immutable
 44      - run: yarn format:check
 45
 46  typecheck:
 47    name: 🧩 Typecheck
 48    runs-on: ubuntu-latest
 49    defaults:
 50      run:
 51        working-directory: web
 52    steps:
 53      - uses: actions/checkout@v5
 54      - run: corepack enable
 55      - uses: actions/setup-node@v5
 56        with:
 57          node-version-file: web/.nvmrc
 58          cache: yarn
 59          cache-dependency-path: web/yarn.lock
 60      - run: yarn install --immutable
 61      - run: yarn typecheck
 62
 63  test:
 64    name: 🧪 Test
 65    runs-on: ubuntu-latest
 66    defaults:
 67      run:
 68        working-directory: web
 69    steps:
 70      - uses: actions/checkout@v5
 71      - run: corepack enable
 72      - uses: actions/setup-node@v5
 73        with:
 74          node-version-file: web/.nvmrc
 75          cache: yarn
 76          cache-dependency-path: web/yarn.lock
 77      - run: yarn install --immutable
 78      - run: yarn test
 79
 80  summary:
 81    name: 💬 Summary
 82    if: always()
 83    needs: [lint, format, typecheck, test]
 84    runs-on: ubuntu-latest
 85    steps:
 86      - name: Build results table
 87        run: |
 88          em() { if [ "$1" = "success" ]; then echo "pass ✅"; else echo "FAIL ❌"; fi; }
 89          line() { echo "| $1 | \`$2\` | $(em "$3") |"; }
 90
 91          {
 92            echo "## Web Checks Summary"
 93            echo ""
 94            echo "| Check | Command | Result |"
 95            echo "|-------|---------|--------|"
 96            line "Lint"      "yarn lint"         "${{ needs.lint.result }}"
 97            line "Format"    "yarn format:check" "${{ needs.format.result }}"
 98            line "Typecheck" "yarn typecheck"    "${{ needs.typecheck.result }}"
 99            line "Test"      "yarn test"         "${{ needs.test.result }}"
100          } >> "$GITHUB_STEP_SUMMARY"