-
Notifications
You must be signed in to change notification settings - Fork 8
177 lines (144 loc) · 5.25 KB
/
ci.yaml
File metadata and controls
177 lines (144 loc) · 5.25 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
name: Continuous Integration
on: pull_request
jobs:
unit-test:
name: Unit tests
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Cache build:all
id: cache-build
uses: actions/cache@v4
with:
path: packages/published/**/dist
key: ${{ matrix.node }}-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**', 'packages/plugins/**', 'packages/published/**', 'packages/tools/src/rollupConfig.mjs', 'yarn.lock') }}
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: js
service: build-plugins
api_key: ${{secrets.DATADOG_API_KEY}}
site: datadoghq.com
- run: yarn install
- 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: 10
name: End to End
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Cache build:all
id: cache-build
uses: actions/cache@v4
with:
path: packages/published/**/dist
key: node18-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**', 'packages/plugins/**', 'packages/published/**', 'packages/tools/src/rollupConfig.mjs', 'yarn.lock') }}
- name: Cache playwright binaries
id: cache-playwright-binaries
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
~/Library/Caches/ms-playwright
%USERPROFILE%\AppData\Local\ms-playwright
key: cache-playwright-binaries-${{ hashFiles('yarn.lock') }}
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: js
service: build-plugins
api_key: ${{secrets.DATADOG_API_KEY}}
site: datadoghq.com
- run: yarn install
- name: Install playwright
run: yarn workspace @dd/tests playwright install --with-deps
- name: Build all plugins
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build:all-no-types
- run: yarn test:e2e
env:
NODE_OPTIONS: -r ${{env.DD_TRACE_PACKAGE}}
DD_TAGS: type:e2e
DD_ENV: ci
- name: Save playwright cache
if: always() && steps.cache-playwright-binaries.outputs.cache-hit != 'true'
id: save-playwright-cache
uses: actions/cache/save@v4
with:
path: |
~/.cache/ms-playwright
~/Library/Caches/ms-playwright
%USERPROFILE%\AppData\Local\ms-playwright
key: cache-playwright-binaries-${{ hashFiles('yarn.lock') }}
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: playwright
path: |
packages/tests/playwright-report
packages/tests/test-results
retention-days: 3
lint:
name: Linting
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Cache build:rollup
id: cache-build-rollup
uses: actions/cache@v4
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/rollupConfig.mjs', 'yarn.lock') }}
- name: Cache build:all
id: cache-build
uses: actions/cache@v4
with:
path: packages/published/**/dist
key: node18-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**', 'packages/plugins/**', 'packages/published/**', 'packages/tools/src/rollupConfig.mjs', 'yarn.lock') }}
- run: yarn install
# 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@v4
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)