-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (165 loc) · 5.51 KB
/
cross-platform-tests.yml
File metadata and controls
205 lines (165 loc) · 5.51 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
200
201
202
203
204
205
name: Cross-Platform Tests
on:
push:
branches: [main, develop]
pull_request:
jobs:
test:
timeout-minutes: 90
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['20.x', '22.x']
fail-fast: true
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} (Node ${{ matrix.node-version }})
env:
CI: true
CRF_NPM_INSTALL_TIMEOUT_MS: '600000'
CRF_NPM_BUILD_TIMEOUT_MS: '600000'
CRF_TEST_HOOK_TIMEOUT_MS: '300000'
CRF_CLI_TEST_TIMEOUT_MS: '30000'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Run unit tests
timeout-minutes: 20
run: npm test -- --bail=1 src/__tests__/ --exclude "src/__tests__/integration/**"
- name: Run integration tests
timeout-minutes: 45
run: npm test -- --bail=1 src/__tests__/integration/
- name: Run cross-platform tests
timeout-minutes: 15
run: npm test -- --bail=1 src/__tests__/integration/cross-platform-cli.test.ts
- name: Run E2E CLI tests
timeout-minutes: 15
run: npm test -- --bail=1 src/__tests__/integration/e2e-cli.test.ts
- name: Run E2E scenario tests
timeout-minutes: 20
run: npm test -- --bail=1 src/__tests__/integration/e2e-scenarios.test.ts
- name: Run config builder comprehensive tests
timeout-minutes: 15
run: npm test -- --bail=1 src/__tests__/config-builder.test.ts
- name: Run template system comprehensive tests
timeout-minutes: 15
run: npm test -- --bail=1 src/__tests__/integration/template-loading.test.ts
- name: Run generator comprehensive tests
timeout-minutes: 15
run: npm test -- --bail=1 src/__tests__/integration/generator.test.ts
- name: Test CLI command (Unix)
if: runner.os != 'Windows'
run: |
# Test that the CLI can be invoked
node dist/index.js --version || true
node dist/index.js --help || true
- name: Test CLI command (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
# Test that the CLI can be invoked
try { node dist/index.js --version } catch { $true | Out-Null }
try { node dist/index.js --help } catch { $true | Out-Null }
- name: Upload coverage
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
e2e-scaffold-test:
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: E2E Scaffold Test on ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Test scaffolding (Unix)
if: runner.os != 'Windows'
run: |
# Create a temporary directory for testing
TEST_DIR=$(mktemp -d)
echo "Testing in: $TEST_DIR"
# Note: Actual scaffolding test would be interactive
# For now, just verify the CLI can be invoked
node dist/index.js --help
echo "[OK] CLI is executable and responsive"
- name: Test scaffolding (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
# Create a temporary directory for testing
$TEST_DIR = New-TemporaryFile | ForEach-Object { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
Write-Output "Testing in: $TEST_DIR"
# Verify the CLI can be invoked
node dist/index.js --help
Write-Output "[OK] CLI is executable and responsive"
lint:
runs-on: ubuntu-latest
timeout-minutes: 15
name: Lint and Format Check
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
build-artifacts:
needs: [test, e2e-scaffold-test, lint]
runs-on: ubuntu-latest
timeout-minutes: 15
name: Verify Build Artifacts
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Check dist files exist
run: |
if [ ! -f "dist/index.js" ]; then
echo "dist/index.js not found"
exit 1
fi
echo "[OK] Build artifacts verified"
shell: bash
- name: Verify TypeScript definitions
run: |
if [ ! -f "dist/index.d.ts" ]; then
echo "dist/index.d.ts not found"
exit 1
fi
echo "[OK] TypeScript definitions verified"
shell: bash