-
Notifications
You must be signed in to change notification settings - Fork 12
282 lines (238 loc) · 9.9 KB
/
Copy pathci.yaml
File metadata and controls
282 lines (238 loc) · 9.9 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
name: Continuous Integration
on:
pull_request:
push:
branches:
- "mq-working-branch-*"
jobs:
unit-test:
name: Unit tests
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref_name, 'mq-working-branch-') }}
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: "package.json"
- name: Cache build:all
id: cache-build
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: packages/published/**/dist
key: ${{ matrix.node }}-cache-build-${{ hashFiles('packages/core/**',
'packages/factory/**', 'packages/plugins/**',
'packages/published/**', 'packages/tools/src/**',
'yarn.lock') }}
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@f76512a963e7375dab9ad7f1abc0cacd41806c5c # v2.6.0
with:
languages: js
service: build-plugins
api_key: ${{secrets.DATADOG_API_KEY}}
site: datadoghq.com
- run: yarn install --immutable --immutable-cache
- name: Build all plugins
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build:all # We need the full build because one of the test verifies that we do produce the *.d.ts files.
- run: yarn test:unit --silent
env:
NODE_OPTIONS: -r ${{env.DD_TRACE_PACKAGE}}
DD_TAGS: type:unit
DD_ENV: ci
e2e:
timeout-minutes: 30
name: End to End
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref_name, 'mq-working-branch-') }}
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-playwright-build
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@f76512a963e7375dab9ad7f1abc0cacd41806c5c # v2.6.0
with:
languages: js
service: build-plugins
api_key: ${{secrets.DATADOG_API_KEY}}
site: datadoghq.com
- run: yarn test:e2e
env:
NODE_OPTIONS: -r ${{env.DD_TRACE_PACKAGE}}
DD_TAGS: type:e2e
DD_ENV: ci
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ failure() }}
with:
name: playwright
path: |
packages/tests/playwright-report
packages/tests/test-results
retention-days: 3
runtime-bench-preflight:
timeout-minutes: 20
name: Live Debugger runtime benchmark preflight
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && !startsWith(github.ref_name, 'mq-working-branch-') }}
outputs:
should-run: ${{ steps.output-check.outputs.should-run || steps.changed-files.outputs.should-run }}
reason: ${{ steps.output-check.outputs.reason || steps.changed-files.outputs.reason }}
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: "package.json"
- run: yarn install --immutable --immutable-cache
- name: Check benchmark and CI changes
id: changed-files
run: node packages/tests/src/bench/liveDebuggerRuntime/preflight.js --changed-files --base-ref=origin/${{ github.base_ref }}
- name: Check benchmark output changes
if: steps.changed-files.outputs.should-run != 'true'
id: output-check
run: node packages/tests/src/bench/liveDebuggerRuntime/preflight.js --compare-output --base-ref=origin/${{ github.base_ref }}
runtime-bench:
timeout-minutes: 30
name: Live Debugger runtime benchmark
runs-on: ubuntu-latest
needs: runtime-bench-preflight
if: ${{ needs.runtime-bench-preflight.outputs.should-run == 'true' }}
continue-on-error: true
permissions:
contents: read
pull-requests: write
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-playwright-build
- name: Run runtime benchmark
run: yarn workspace @dd/tests bench:live-debugger:runtime
- name: Render benchmark comment
if: always()
run: |
BENCH_TMP_DIR="$(node -e "process.stdout.write(require('os').tmpdir())")"
COMMENT_PATH="$BENCH_TMP_DIR/live-debugger-runtime-bench-comment.md"
RESULTS_PATH="$(ls -t "$BENCH_TMP_DIR"/live-debugger-runtime-bench-results-*.json 2>/dev/null | head -n 1)"
if [ -f "$COMMENT_PATH" ]; then
cp "$COMMENT_PATH" runtime-bench-comment.md
else
{
echo '<!-- ld-runtime-bench -->'
echo '## Live Debugger Runtime Benchmark'
echo
echo 'Benchmark results were not produced. Check the workflow logs for details.'
} > runtime-bench-comment.md
fi
if [ -n "$RESULTS_PATH" ] && [ -f "$RESULTS_PATH" ]; then
cp "$RESULTS_PATH" runtime-bench-results.json
fi
- name: Find benchmark comment
if: always()
id: benchmark-comment
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const marker = '<!-- ld-runtime-bench -->';
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const comment = comments.find((candidate) => candidate.body?.includes(marker));
core.setOutput('comment-id', comment?.id || '');
- name: Create benchmark comment
if: always() && steps.benchmark-comment.outputs.comment-id == ''
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('runtime-bench-comment.md', 'utf8');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
- name: Update benchmark comment
if: always() && steps.benchmark-comment.outputs.comment-id != ''
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('runtime-bench-comment.md', 'utf8');
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: Number('${{ steps.benchmark-comment.outputs.comment-id }}'),
body,
});
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: live-debugger-runtime-bench-results
path: |
runtime-bench-comment.md
runtime-bench-results.json
packages/tests/playwright-report
packages/tests/test-results
retention-days: 3
lint:
name: Linting
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref_name, 'mq-working-branch-') }}
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: "package.json"
- name: Cache build:rollup
id: cache-build-rollup
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: packages/published/rollup-plugin/dist-basic
key: node18-cache-build-rollup-${{ hashFiles('packages/core/**',
'packages/factory/**', 'packages/plugins/**',
'packages/published/**', 'packages/tools/src/**',
'yarn.lock') }}
- name: Cache build:all
id: cache-build
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: packages/published/**/dist
key: node18-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**',
'packages/plugins/**', 'packages/published/**',
'packages/tools/src/**', 'yarn.lock') }}
- run: yarn install --immutable --immutable-cache
# Pre build the rollup plugin so it can be used in the following step.
- name: Build rollup's plugin
if: steps.cache-build-rollup.outputs.cache-hit != 'true'
run: yarn workspace @datadog/rollup-plugin run buildBasic
- name: Build all plugins
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build:all-no-types
env:
ADD_BUILD_PLUGINS: 1
BUILD_PLUGINS_REPORTS: 1
DD_GITHUB_JOB_NAME: Linting # Needs to be the same as the job to have CI Vis link the spans.
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: steps.cache-build.outputs.cache-hit != 'true'
with:
name: build-reports
path: |
packages/published/*/dist/reports
retention-days: 1
- run: yarn cli integrity
- run: git diff --exit-code && git diff --cached --exit-code || (echo "Please run
'yarn cli integrity' and commit the result." && exit 1)