-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (162 loc) · 5.5 KB
/
Copy pathtest-action.yml
File metadata and controls
197 lines (162 loc) · 5.5 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
name: Test Action
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
actions: read
jobs:
test-basic:
name: Test Basic Usage
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Start Workflow Telemetry
uses: ./
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: "24"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install
- name: Run Tests
run: pnpm test
- name: Build Project
run: pnpm run build
- name: Verify Build Artifacts
run: |
test -f dist/main/index.js
test -f dist/main/server.js
test -f dist/post/index.js
echo "All build artifacts present"
test-automatic-step-tracking:
name: Test Automatic Step Tracking
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Start Workflow Telemetry with GitHub Token
uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: "24"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install
- name: Type Check
run: pnpm run tsc
- name: Run Tests
run: pnpm test
- name: Build Project
run: pnpm run build
test-manual-step-markers:
name: Test Manual Step Markers
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Start Workflow Telemetry
uses: ./
with:
interval_seconds: "3"
- name: Wait for Server
run: |
echo "Waiting for metrics server to be ready on port 7777..."
timeout=30
elapsed=0
while ! curl -s -f http://localhost:7777/metrics > /dev/null 2>&1; do
if [ $elapsed -ge $timeout ]; then
echo "Timeout waiting for server to start"
exit 1
fi
echo "Server not ready yet, waiting... ($elapsed/$timeout seconds)"
sleep 1
elapsed=$((elapsed + 1))
done
echo "Server is ready!"
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: "24"
cache: "pnpm"
- name: Install Dependencies with Manual Markers
run: |
curl -X POST http://localhost:7777/mark-step \
-H "Content-Type: application/json" \
-d '{"stepName":"Install Dependencies","status":"start"}'
pnpm install
curl -X POST http://localhost:7777/mark-step \
-H "Content-Type: application/json" \
-d '{"stepName":"Install Dependencies","status":"end"}'
- name: Build with Manual Markers
run: |
curl -X POST http://localhost:7777/mark-step \
-H "Content-Type: application/json" \
-d '{"stepName":"Build Project","status":"start"}'
pnpm run build
curl -X POST http://localhost:7777/mark-step \
-H "Content-Type: application/json" \
-d '{"stepName":"Build Project","status":"end"}'
- name: Test with Manual Markers
run: |
curl -X POST http://localhost:7777/mark-step \
-H "Content-Type: application/json" \
-d '{"stepName":"Run Tests","status":"start"}'
pnpm test
curl -X POST http://localhost:7777/mark-step \
-H "Content-Type: application/json" \
-d '{"stepName":"Run Tests","status":"end"}'
test-custom-interval:
name: Test Custom Interval
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Start Workflow Telemetry with Custom Interval
uses: ./
with:
interval_seconds: "2"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: "24"
cache: "pnpm"
- name: Simulate Workload
run: |
echo "Simulating CPU and memory intensive workload"
sleep 10
echo "Workload simulation complete"
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true