-
Notifications
You must be signed in to change notification settings - Fork 1
/
ci
executable file
·161 lines (136 loc) · 6.87 KB
/
ci
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env bash
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
White='\033[0;37m' # White
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ @kullna/editor │
│ Continuous Integration │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
set -o nounset
set -o pipefail
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ 🌥️ Preparing... │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
if [ -z "$(npm install --ignore-scripts -s)" ]; then
echo -e $Green
echo " ✅ Dependencies installed"
echo -e $Color_Off
else
echo -e $Red
echo " ❌ An error occurred while installing dependencies"
echo -e $Color_Off
exit 1
fi
git_status_result=0
if [ -z "$(git status --porcelain)" ]; then
echo -e $Green
echo " ✅ Clean working copy"
echo -e $Color_Off
else
echo -e $Yellow
echo " ⚠️ DANGER: Working copy is not clean"
echo -e $Color_Off
git_status_result=1
fi
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ 🔧 Building... │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
build_result=0
npm run build:release -s || build_result=$?
if [ $build_result -eq 0 ]; then
echo -e $Green
echo " ✅ Building passed!"
echo -e $Color_Off
else
echo -e $Red
echo " 💩 Building failed!"
echo -e $Color_Off
fi
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ ✨ Linting... │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
lint_result=0
npm run lint -s || lint_result=$?
if [ $lint_result -eq 0 ]; then
echo -e $Green
echo " ✅ Linting passed!"
echo -e $Color_Off
else
echo -e $Red
echo " 💩 Linting failed!"
echo -e $Color_Off
echo " 📝 Try running: npm run lint:fix - are your husky scripts broken?"
fi
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ 🌐 Website... │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
size_result=0
./website gen || size_result=$?
if [ $size_result -eq 0 ]; then
echo -e $Green
echo " ✅ Website built!"
echo -e $Color_Off
else
echo -e $Red
echo " ❌ An error occurred while building the website."
echo -e $Color_Off
fi
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ 🐰 Checking Size... │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
size_result=0
npm run size -s || size_result=$?
if [ $size_result -eq 0 ]; then
echo -e $Green
echo " ✅ Size check passed!"
echo -e $Color_Off
else
echo -e $Red
echo " 💩 Size check failed!"
echo -e $Color_Off
fi
if [ $lint_result -eq 0 ] && [ $build_result -eq 0 ] && [ $size_result -eq 0 ]; then
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ 🚀 Success! │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
echo -e $Green
echo " ✅ All checks passed! #ship-it"
echo -e $Color_Off
npx motivation | fold -w 80
echo
exit 0
else
cat << "EOF"
┌─────────────────────────────────────────────────────────────────────────────┐
│ 💩 Problems Found │
└─────────────────────────────────────────────────────────────────────────────┘
EOF
echo -e $Red
echo " ❌ One or more steps failed!"
echo -e $Color_Off
npx motivation | fold -w 80
echo
exit 1
fi