-
-
Notifications
You must be signed in to change notification settings - Fork 224
147 lines (134 loc) · 3.93 KB
/
check.yml
File metadata and controls
147 lines (134 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: 🪢 Checks
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: 🔨 Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build-check
lint:
name: 🧼 Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run lint
format:
name: 💅 Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npx prettier --check src || (echo "⚠️ Formatting issues found" && exit 1)
types:
name: 🧩 Types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run types
svelte_check:
name: 🛟 Svelte Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run check
test:
name: 🧪 Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm test
deps:
name: 🔒 Dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm audit --audit-level=high
- run: npm ls --all
summarize:
name: 📊 Summary
runs-on: ubuntu-latest
if: always()
needs:
- build
- lint
- format
- types
- svelte_check
- test
- deps
steps:
- name: Create summary
env:
BUILD: ${{ needs.build.result }}
LINT: ${{ needs.lint.result }}
FORMAT: ${{ needs.format.result }}
TYPES: ${{ needs.types.result }}
SVCHK: ${{ needs.svelte_check.result }}
TEST: ${{ needs.test.result }}
DEPS: ${{ needs.deps.result }}
run: |
em() { case "$1" in success) echo "✅";; failure) echo "❌";; cancelled|skipped) echo "⏭️";; *) echo "❔";; esac; }
line() { r="$1"; n="$2"; cmd="$3"; s="Passing"; [ "$r" != "success" ] && s="**Failing** - run \`$cmd\`"; echo "- $(em "$r") $n: $s"; }
{
echo "## Check Summary"
line "$BUILD" "Build" "npm run build"
line "$LINT" "Lint" "npm run lint"
line "$FORMAT" "Format" "npm run format"
line "$TYPES" "Types" "npm run types"
line "$SVCHK" "Svelte Check" "npm run check"
line "$TEST" "Tests" "npm test"
line "$DEPS" "Dependencies" "npm audit --audit-level=high"
# Count failures properly
failures=0
[ "$BUILD" = "failure" ] && failures=$((failures + 1))
[ "$LINT" = "failure" ] && failures=$((failures + 1))
[ "$FORMAT" = "failure" ] && failures=$((failures + 1))
[ "$TYPES" = "failure" ] && failures=$((failures + 1))
[ "$SVCHK" = "failure" ] && failures=$((failures + 1))
[ "$TEST" = "failure" ] && failures=$((failures + 1))
[ "$DEPS" = "failure" ] && failures=$((failures + 1))
if [ "$failures" -eq 0 ]; then
echo -e "\n🎉 **All checks passed!**"
else
echo -e "\n⚠️ **$failures check(s) failed** - please fix the issues above before merging."
fi
} >> "$GITHUB_STEP_SUMMARY"