-
-
Notifications
You must be signed in to change notification settings - Fork 1
184 lines (159 loc) · 5.41 KB
/
ci.yml
File metadata and controls
184 lines (159 loc) · 5.41 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
# =============================================================================
# markupr CI Pipeline
# =============================================================================
# Runs on every push to main and pull request
# Matrix build for macOS and Windows with comprehensive validation
# =============================================================================
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel in-progress runs for the same branch
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '20'
jobs:
# ===========================================================================
# Lint & Type Check (fast feedback)
# ===========================================================================
validate:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Run TypeScript type check
run: npm run typecheck
- name: Audit production dependencies
run: npm audit --omit=dev --audit-level=high
# ===========================================================================
# Test Suite
# ===========================================================================
test:
name: Test Suite
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm run test:ci
- name: Upload coverage reports
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: false
verbose: true
# ===========================================================================
# Build Matrix (macOS & Windows)
# ===========================================================================
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: validate
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
artifact-name: markupr-macos
build-path: release/*.dmg
- os: windows-latest
artifact-name: markupr-windows
build-path: release/*.exe
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
# Cache node_modules for faster builds
- name: Cache node_modules
uses: actions/cache@v5
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
# Cache Electron binaries
- name: Cache Electron
uses: actions/cache@v5
with:
path: |
~/Library/Caches/electron
~/AppData/Local/electron/Cache
~/.cache/electron
key: ${{ runner.os }}-electron-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-electron-
- name: Build application
run: npm run build
# Build unsigned packages for CI validation (--publish never to skip GH_TOKEN requirement)
- name: Package application (unsigned)
shell: bash
continue-on-error: ${{ matrix.os == 'windows-latest' }}
run: |
if [ "${{ matrix.os }}" = "macos-latest" ]; then
CSC_IDENTITY_AUTO_DISCOVERY=false npx electron-builder --mac --publish never --config electron-builder.yml
else
npx electron-builder --win --publish never --config electron-builder.yml
fi
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact-name }}
path: |
release/*.dmg
release/*.zip
release/*.exe
release/*.msi
if-no-files-found: warn
retention-days: 7
# ===========================================================================
# Build Status Summary
# ===========================================================================
ci-success:
name: CI Success
runs-on: ubuntu-latest
needs: [validate, test, build]
if: always()
steps:
- name: Check all jobs passed
run: |
if [ "${{ needs.validate.result }}" != "success" ] || \
[ "${{ needs.test.result }}" != "success" ] || \
[ "${{ needs.build.result }}" != "success" ]; then
echo "One or more jobs failed"
exit 1
fi
echo "All CI jobs passed successfully!"