forked from cellajs/cella
-
Notifications
You must be signed in to change notification settings - Fork 0
199 lines (166 loc) · 5.37 KB
/
Copy pathci.yml
File metadata and controls
199 lines (166 loc) · 5.37 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: CI
permissions:
contents: read
# Controls which events and branches will trigger the workflow
on:
push:
branches: [ main ]
pull_request:
branches: [ main, development ]
# Cancel older runs of the same PR when a new push arrives
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Install deps once and reuse for other jobs (optional optimization)
install:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'pnpm'
- name: Create .env files
run: |
cp ./backend/.env.example ./backend/.env
cp ./frontend/.env.example ./frontend/.env
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Save node_modules so other jobs can reuse
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }}
# Runs linting
lint:
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v5
with:
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Run Biome
run: pnpm biome check .
# Runs all tests
test:
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v5
with:
cache: 'pnpm'
- name: Create .env files
run: |
cp ./backend/.env.example ./backend/.env
cp ./frontend/.env.example ./frontend/.env
- name: Restore node_modules
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }}
- run: pnpm test
# Will run a quick startup check to ensure the app starts without issues
quick:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v5
- name: Create .env files
run: |
cp ./backend/.env.example ./backend/.env
cp ./frontend/.env.example ./frontend/.env
- name: Restore node_modules
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Start quick and wait for Vite ready
run: |
timeout 120s stdbuf -oL pnpm quick 2>&1 | while IFS= read -r line; do
# Show all output for debugging
echo "$line"
# Remove ANSI escape codes
clean_line=$(echo "$line" | sed -r "s/\x1B\[[0-9;]*[mK]//g")
# Match "VITE <version> ready in <ms>" anywhere in the line
if echo "$clean_line" | grep -E ".*VITE [^ ]+ +ready in [0-9]+ ms"; then
echo ">>> Vite server is ready! <<<"
pkill -P $$ pnpm || true
break
fi
done || true
# Generates draft release notes (for testing only)
draft-release-notes:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0 # needed so changelog sees full commit history
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v5
- name: Install changelog deps
run: pnpm add -Dw conventional-changelog-cli conventional-changelog-conventionalcommits
- name: Generate draft release notes
run: |
# Check latest and previous tags
LATEST_TAG=$(if [ "$(git tag | wc -l)" -ge 1 ]; then git describe --tags --abbrev=0; fi)
PREV_TAG=$(if [ "$(git tag | wc -l)" -ge 2 ]; then git tag --sort=creatordate | tail -2 | head -1; fi)
echo "Latest tag: $LATEST_TAG"
echo "Previous tag: $PREV_TAG"
if [ -z "$PREV_TAG" ]; then
echo "First release — include all commits"
npx conventional-changelog -p conventionalcommits -r 0 -o RELEASE_NOTES.md
else
echo "Generating changelog since previous tag $PREV_TAG"
# Use -r 2 and output commits since PREV_TAG
npx conventional-changelog -p conventionalcommits -r 2 -o RELEASE_NOTES.md
fi
- name: Upload draft release notes
uses: actions/upload-artifact@v4
with:
name: draft-release-notes
path: RELEASE_NOTES.md