forked from cluesmith/codev
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (97 loc) · 3.23 KB
/
test.yml
File metadata and controls
120 lines (97 loc) · 3.23 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
name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: packages/codev
run: npm install
- name: Copy skeleton for unit tests
working-directory: packages/codev
run: npm run copy-skeleton
- name: Run unit tests with coverage
working-directory: packages/codev
run: |
# Vitest forks pool has a known issue where the worker process crashes
# during cleanup after all tests pass (native module teardown).
# Capture the output and check if all test files passed.
npx vitest run --coverage 2>&1 | tee /tmp/vitest-output.txt; VITEST_EXIT=$?
if [ $VITEST_EXIT -ne 0 ]; then
# Check if all test files actually passed despite the exit code
if grep -q "Test Files.*passed" /tmp/vitest-output.txt && ! grep -q "failed" /tmp/vitest-output.txt; then
echo "::warning::Vitest worker crashed during cleanup but all tests passed"
else
exit $VITEST_EXIT
fi
fi
integration:
name: Tower Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: packages/codev
run: npm install
- name: Build package
working-directory: packages/codev
run: npm run build
- name: Run tower integration tests
working-directory: packages/codev
run: npx vitest run --config vitest.e2e.config.ts --exclude 'src/commands/porch/__tests__/e2e/**'
cli:
name: CLI Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: packages/codev
run: npm install
- name: Build package
working-directory: packages/codev
run: npm run build
- name: Run CLI integration tests
working-directory: packages/codev
run: npx vitest run --config vitest.cli.config.ts
package:
name: Package Install Verification
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: packages/codev
run: npm install
- name: Build package
working-directory: packages/codev
run: npm run build
- name: Pack tarball
working-directory: packages/codev
run: npm pack
- name: Verify install from tarball
working-directory: packages/codev
run: node scripts/verify-install.mjs cluesmith-codev-*.tgz