-
Notifications
You must be signed in to change notification settings - Fork 55
133 lines (111 loc) · 3.93 KB
/
e2e-code-quality.yaml
File metadata and controls
133 lines (111 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: E2E Code Quality
on:
pull_request:
branches:
- main
- 'release-*'
paths:
- 'workspaces/*/e2e-tests/**'
concurrency:
group: e2e-code-quality-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
e2e-code-quality:
name: E2E Code Quality
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22
- name: Enable Corepack
run: corepack enable
- name: Discover and validate e2e-tests workspaces
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR "$BASE_SHA"...HEAD -- 'workspaces/*/e2e-tests/**')
WORKSPACES=$(echo "$CHANGED_FILES" | sed -n 's|^workspaces/\([^/]*\)/e2e-tests/.*|\1|p' | sort -u)
if [ -z "$WORKSPACES" ]; then
echo "No e2e-tests workspaces changed. Nothing to validate."
exit 0
fi
echo "Discovered workspaces with e2e-tests changes:"
echo "$WORKSPACES"
echo ""
FAILED=0
RESULTS=""
for WORKSPACE in $WORKSPACES; do
E2E_DIR="workspaces/${WORKSPACE}/e2e-tests"
echo ""
echo "========================================"
echo "Validating: ${WORKSPACE}"
echo "========================================"
echo "Installing dependencies..."
if ! (cd "$E2E_DIR" && yarn install --immutable); then
echo "::error::yarn install failed for ${WORKSPACE}"
RESULTS="${RESULTS}| ${WORKSPACE} | FAIL (install) | FAIL (install) | FAIL (install) |\n"
FAILED=1
continue
fi
LINT_RESULT="pass"
PRETTIER_RESULT="pass"
TSC_RESULT="pass"
echo ""
echo "--- ESLint ---"
if (cd "$E2E_DIR" && yarn lint:check); then
echo "ESLint: passed"
else
echo "::error::ESLint failed for ${WORKSPACE}"
LINT_RESULT="FAIL"
FAILED=1
fi
echo ""
echo "--- Prettier ---"
if (cd "$E2E_DIR" && yarn prettier:check); then
echo "Prettier: passed"
else
echo "::error::Prettier failed for ${WORKSPACE}"
PRETTIER_RESULT="FAIL"
FAILED=1
fi
echo ""
echo "--- TypeScript ---"
if (cd "$E2E_DIR" && yarn tsc:check); then
echo "TypeScript: passed"
else
echo "::error::TypeScript failed for ${WORKSPACE}"
TSC_RESULT="FAIL"
FAILED=1
fi
RESULTS="${RESULTS}| ${WORKSPACE} | ${LINT_RESULT} | ${PRETTIER_RESULT} | ${TSC_RESULT} |\n"
done
echo ""
echo "========================================"
echo "Summary"
echo "========================================"
{
echo "### E2E Code Quality Results"
echo ""
echo "| Workspace | ESLint | Prettier | TypeScript |"
echo "|-----------|--------|----------|------------|"
printf '%b' "$RESULTS"
} >> "$GITHUB_STEP_SUMMARY"
echo ""
printf '%s\n' "| Workspace | ESLint | Prettier | TypeScript |"
printf '%s\n' "|-----------|--------|----------|------------|"
printf '%b' "$RESULTS"
if [ "$FAILED" -ne 0 ]; then
echo ""
echo "One or more checks failed."
exit 1
fi
echo ""
echo "All checks passed."