.github/workflows/web-checks.yml

96 lines · 2528 bytes

 1name: Web Checks
 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@v4
20      - uses: actions/setup-node@v4
21        with:
22          node-version-file: web/.nvmrc
23          cache: yarn
24          cache-dependency-path: web/yarn.lock
25      - run: yarn install --frozen-lockfile
26      - run: yarn lint
27
28  format:
29    name: 💅 Format
30    runs-on: ubuntu-latest
31    defaults:
32      run:
33        working-directory: web
34    steps:
35      - uses: actions/checkout@v4
36      - uses: actions/setup-node@v4
37        with:
38          node-version-file: web/.nvmrc
39          cache: yarn
40          cache-dependency-path: web/yarn.lock
41      - run: yarn install --frozen-lockfile
42      - run: yarn format:check
43
44  typecheck:
45    name: 🧩 Typecheck
46    runs-on: ubuntu-latest
47    defaults:
48      run:
49        working-directory: web
50    steps:
51      - uses: actions/checkout@v4
52      - uses: actions/setup-node@v4
53        with:
54          node-version-file: web/.nvmrc
55          cache: yarn
56          cache-dependency-path: web/yarn.lock
57      - run: yarn install --frozen-lockfile
58      - run: yarn typecheck
59
60  test:
61    name: 🧪 Test
62    runs-on: ubuntu-latest
63    defaults:
64      run:
65        working-directory: web
66    steps:
67      - uses: actions/checkout@v4
68      - uses: actions/setup-node@v4
69        with:
70          node-version-file: web/.nvmrc
71          cache: yarn
72          cache-dependency-path: web/yarn.lock
73      - run: yarn install --frozen-lockfile
74      - run: yarn test
75
76  summary:
77    name: 💬 Summary
78    if: always()
79    needs: [lint, format, typecheck, test]
80    runs-on: ubuntu-latest
81    steps:
82      - name: Build results table
83        run: |
84          em() { if [ "$1" = "success" ]; then echo "pass ✅"; else echo "FAIL ❌"; fi; }
85          line() { echo "| $1 | \`$2\` | $(em "$3") |"; }
86
87          {
88            echo "## Web Checks Summary"
89            echo ""
90            echo "| Check | Command | Result |"
91            echo "|-------|---------|--------|"
92            line "Lint"      "yarn lint"         "${{ needs.lint.result }}"
93            line "Format"    "yarn format:check" "${{ needs.format.result }}"
94            line "Typecheck" "yarn typecheck"    "${{ needs.typecheck.result }}"
95            line "Test"      "yarn test"         "${{ needs.test.result }}"
96          } >> "$GITHUB_STEP_SUMMARY"