-
Notifications
You must be signed in to change notification settings - Fork 55
220 lines (204 loc) · 7.83 KB
/
ci.yml
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
# This workflow will do a clean install of node dependencies, build the source code and run tests
name: Continuous Integration
on: push
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
version: [14, 16, 18, 20]
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
- run: yarn install --immutable
- run: yarn build
- name: Run yarn lint:ci
run: |
if ! yarn lint:ci ; then
echo "ESLint failed with the following errors:"
jq '.runs[].results' sarif-datadog-ci.sarif
echo ""
echo "Find the full SARIF report in the Artifacts section here: https://github.com/DataDog/datadog-ci/actions/runs/${{ github.run_id }}"
echo "You can fix this by running ==> yarn format <=="
echo ""
exit 1
fi
- run: yarn no-only-in-tests
- run: yarn test
env:
CI: true
DD_SERVICE: datadog-ci-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
DD_API_KEY: ${{ secrets.DATADOG_API_KEY_MAIN_ACCOUNT }}
DD_APP_KEY: ${{ secrets.DATADOG_APP_KEY_MAIN_ACCOUNT }}
DD_ENV: ci
NODE_OPTIONS: -r dd-trace/ci/init
- run: mkdir artifacts
- run: yarn pack --filename artifacts/datadog-ci-${{ matrix.version }}.tgz
- run: cp -r .github/workflows/e2e artifacts/
- uses: actions/upload-artifact@v1
with:
name: artifacts
path: artifacts/
- uses: actions/upload-artifact@v3
if: always()
with:
name: sarif-datadog-ci.sarif
path: sarif-datadog-ci.sarif
if-no-files-found: error
e2e-test:
strategy:
matrix:
version: [14, 16, 18, 20]
name: End-to-end test the package
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
- uses: actions/download-artifact@v1
with:
name: artifacts
- run: yarn add ./artifacts/datadog-ci-${{ matrix.version }}.tgz
- name: Run synthetics test
run: yarn datadog-ci synthetics run-tests --config artifacts/e2e/global.config.json
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
- name: Run sourcemaps upload test
run: yarn datadog-ci sourcemaps upload artifacts/e2e/sourcemaps/ --release-version=e2e --service=e2e-tests --minified-path-prefix=https://e2e-tests.datadoghq.com/static/
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
- name: Run junit upload test (measures)
run: yarn datadog-ci junit upload --service=datadog-ci-e2e-tests-junit artifacts/e2e/junit-reports --measures testmeasure1:20 --report-measures sessionmeasure1:40
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
- name: Check that test data can be queried (measures)
run: |
yarn add @datadog/datadog-api-client
yarn check-junit-upload
env:
EXTRA_TEST_QUERY_FILTER: '@testmeasure1:20'
EXTRA_SESSION_QUERY_FILTER: '@sessionmeasure1:40'
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
DD_SERVICE: datadog-ci-e2e-tests-junit
- name: Run junit upload test (metrics)
run: yarn datadog-ci junit upload --service=datadog-ci-e2e-tests-junit artifacts/e2e/junit-reports --metrics testmeasure2:60 --report-metrics sessionmeasure2:80
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
- name: Check that test data can be queried (metrics)
run: |
yarn add @datadog/datadog-api-client
yarn check-junit-upload
env:
EXTRA_TEST_QUERY_FILTER: '@testmeasure2:60'
EXTRA_SESSION_QUERY_FILTER: '@sessionmeasure2:80'
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
DD_SERVICE: datadog-ci-e2e-tests-junit
- name: Run sarif upload test
run: yarn datadog-ci sarif upload --service=datadog-ci-e2e-tests-sarif artifacts/e2e/sarif-reports
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
- name: Run sbom upload test
run: yarn datadog-ci sbom upload --service=datadog-ci-e2e-tests-sbom --env test artifacts/e2e/sbom-reports/sbom.json
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
standalone-binary-test-ubuntu:
name: Test standalone binary in ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '14.18.3'
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node14-linux-x64 -o datadog-ci_linux-x64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm -rf dist
rm -rf src
- name: Test generated standalone binary
run: yarn dist-standalone:test
standalone-binary-test-windows:
name: Test standalone binary in windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '14.18.3'
- run: yarn install --immutable
- run: yarn build:win
- name: Create standalone binary
run: yarn dist-standalone -t node14-win-x64 -o datadog-ci_win-x64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm dist -r
rm src -r
- name: Test generated standalone binary
run: yarn dist-standalone:test
standalone-binary-test-macos:
name: Test standalone binary in macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '14.18.3'
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node14-macos-x64 -o datadog-ci_darwin-x64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm -rf dist
rm -rf src
- name: Test generated standalone binary
run: yarn dist-standalone:test
datadog-static-analyzer:
runs-on: ubuntu-latest
name: Datadog Static Analyzer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Datadog static analyzer
id: datadog-static-analysis
uses: DataDog/datadog-static-analyzer-github-action@main
with:
dd_app_key: ${{ secrets.DATADOG_APP_KEY_MAIN_ACCOUNT }}
dd_api_key: ${{ secrets.DATADOG_API_KEY_MAIN_ACCOUNT }}
dd_service: 'datadog-ci'
dd_env: 'ci'
cpu_count: 2
enable_performance_statistics: true
sca_enabled: true
check-licenses:
name: Check licenses
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '14'
# The install step has been added here such that the `.yarn/install-state.gz` file is generated. This file is used
# by the script `check-licenses` below.
- run: yarn install --immutable
- run: yarn check-licenses