forked from opensearch-project/oui
-
Notifications
You must be signed in to change notification settings - Fork 0
277 lines (229 loc) · 7.29 KB
/
build_and_test.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
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
name: Build and test
on:
push:
branches: ['**', '!backport/**', '!whitesource-remediate/**']
paths-ignore:
- '**/*.md'
pull_request:
branches: ['**']
paths-ignore:
- '**/*.md'
env:
CI: 1
GCS_UPLOAD_PREFIX: fake
NODE_OPTIONS: "--max-old-space-size=6144 --dns-result-order=ipv4first"
jobs:
lint-test:
name: Lint and Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
yarn install --frozen-lockfile
- name: Run linter
run: yarn lint
- name: Run unit tests
run: yarn test-unit
build:
name: Build on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Package artifacts
run: yarn pack --filename oui.tgz
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: oui.tgz
build-docs:
name: Build Docs on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
yarn install --frozen-lockfile
- name: Build Docs
run: yarn build-docs
- name: Upload doc artifacts
uses: actions/upload-artifact@v3
with:
name: docs
path: docs/
osd-unit:
name: OSD Jest test (ciGroup${{ matrix.group }})
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: opensearch-project/OpenSearch-Dashboards
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
- name: Download build
id: download
uses: actions/download-artifact@v3
with:
name: build
- name: Extract build archive
run: tar -xf ${{ steps.download.outputs.download-path }}/oui.tgz
- name: Get Escaped Download Path
run: |
RAW_OUI_PATH="${{ steps.download.outputs.download-path }}/package"
OUI_PATH=$(echo $RAW_OUI_PATH | sed 's/\//\\\//g')
echo "OUI_PATH=$OUI_PATH" >> "$GITHUB_ENV"
- name: Update OUI version in OSD
run: |
find . -type f -name package.json -exec sed -i 's/"@elastic\/eui": ".*"/"@elastic\/eui": "file:${{ env.OUI_PATH }}"/g' {} \;
- name: Bootstrap OSD
run: yarn osd bootstrap
- name: Run Jest Tests
run: yarn test:jest:ci --ci-group=${{ matrix.group }}
osd-integration:
name: OSD Integration test
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: opensearch-project/OpenSearch-Dashboards
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
- name: Download build
id: download
uses: actions/download-artifact@v3
with:
name: build
- name: Extract build archive
run: tar -xf ${{ steps.download.outputs.download-path }}/oui.tgz
- name: Get Escaped Download Path
run: |
RAW_OUI_PATH="${{ steps.download.outputs.download-path }}/package"
OUI_PATH=$(echo $RAW_OUI_PATH | sed 's/\//\\\//g')
echo "OUI_PATH=$OUI_PATH" >> "$GITHUB_ENV"
- name: Update OUI version in OSD
run: |
find . -type f -name package.json -exec sed -i 's/"@elastic\/eui": ".*"/"@elastic\/eui": "file:${{ env.OUI_PATH }}"/g' {} \;
- name: Bootstrap OSD
run: yarn osd bootstrap
- name: Run Integration Tests
run: yarn test:jest_integration:ci
osd-build:
name: OSD Build on ${{ matrix.name }}
strategy:
matrix:
include:
- os: ubuntu-latest
name: Linux x64
ext: tar.gz
suffix: linux-x64
script: build-platform --linux --skip-os-packages
- os: ubuntu-latest
name: Linux ARM64
ext: tar.gz
suffix: linux-arm64
script: build-platform --linux-arm --skip-os-packages
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: opensearch-project/OpenSearch-Dashboards
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
- name: Download build
id: download
uses: actions/download-artifact@v3
with:
name: build
- name: Extract build archive
run: tar -xf ${{ steps.download.outputs.download-path }}/oui.tgz
- name: Get Escaped Download Path
run: |
RAW_OUI_PATH="${{ steps.download.outputs.download-path }}/package"
OUI_PATH=$(echo $RAW_OUI_PATH | sed 's/\//\\\//g')
echo "OUI_PATH=$OUI_PATH" >> "$GITHUB_ENV"
- name: Update OUI version in OSD
run: |
find . -type f -name package.json -exec sed -i 's/"@elastic\/eui": ".*"/"@elastic\/eui": "file:${{ env.OUI_PATH }}"/g' {} \;
- name: Get package version
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Get artifact build name
run: |
echo "ARTIFACT_BUILD_NAME=opensearch-dashboards-${{ env.VERSION }}-${{ matrix.suffix }}.${{ matrix.ext }}" >> $GITHUB_ENV
- name: Run bootstrap
run: yarn osd bootstrap
- name: Build `${{ matrix.name }}`
run: yarn ${{ matrix.script }} --release
- uses: actions/upload-artifact@v3
if: success()
with:
name: ${{ matrix.suffix }}-${{ env.VERSION }}
path: ./target/${{ env.ARTIFACT_BUILD_NAME }}
retention-days: 7