forked from Gnathonic/mokuro-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (135 loc) · 4.34 KB
/
Copy pathci.yml
File metadata and controls
162 lines (135 loc) · 4.34 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run Prettier
run: npx prettier --check .
- name: Run ESLint
run: npx eslint .
typecheck:
name: Type Check
runs-on: ubuntu-latest
# Non-blocking: svelte-check has incomplete Svelte 5 runes support
# causing false positives. Re-enable when svelte-check improves.
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run svelte-check
run: npm run check
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test -- --run
- name: Run tests with coverage
run: npm run test:coverage
- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
continue-on-error: true
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
release-check:
name: Release Check
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for version and changelog updates
run: |
# Check for skip label
if gh pr view ${{ github.event.pull_request.number }} --json labels -q '.labels[].name' | grep -q "skip-release-check"; then
echo "⏭️ Skipping release check (skip-release-check label)"
exit 0
fi
# Get changed files
CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
# Check for version change
MAIN_VERSION=$(git show origin/main:package.json | grep '"version"' | sed 's/.*: *"\([^"]*\)".*/\1/')
PR_VERSION=$(grep '"version"' package.json | sed 's/.*: *"\([^"]*\)".*/\1/')
VERSION_CHANGED=false
if [ "$MAIN_VERSION" != "$PR_VERSION" ]; then
VERSION_CHANGED=true
echo "✅ Version changed: $MAIN_VERSION → $PR_VERSION"
fi
# Check for changelog update
CHANGELOG_CHANGED=false
if echo "$CHANGED_FILES" | grep -q "^CHANGELOG.md$"; then
CHANGELOG_CHANGED=true
echo "✅ CHANGELOG.md updated"
fi
# Both must be present, or neither (for non-release PRs)
if [ "$VERSION_CHANGED" = true ] && [ "$CHANGELOG_CHANGED" = true ]; then
echo ""
echo "✅ Release PR: version bumped and changelog updated"
exit 0
elif [ "$VERSION_CHANGED" = false ] && [ "$CHANGELOG_CHANGED" = false ]; then
echo ""
echo "✅ Non-release PR: no version or changelog changes"
exit 0
else
echo ""
echo "❌ Incomplete release changes!"
echo ""
if [ "$VERSION_CHANGED" = true ]; then
echo " - Version was changed but CHANGELOG.md was not updated"
else
echo " - CHANGELOG.md was updated but version was not bumped"
fi
echo ""
echo "For a release, you must update BOTH:"
echo " 1. version in package.json"
echo " 2. CHANGELOG.md with release notes"
echo ""
echo "Or add the 'skip-release-check' label to bypass this check."
exit 1
fi
env:
GH_TOKEN: ${{ github.token }}