Skip to content

Commit fb9027a

Browse files
authored
Add compile step before Cypress runs in CI (#2187)
* Add compile step before run step Signed-off-by: Simeon Widdis <[email protected]> * Remove wait-for-startup step Signed-off-by: Simeon Widdis <[email protected]> * Fix detection of server startup Signed-off-by: Simeon Widdis <[email protected]> * Fix cache finding no lock files Signed-off-by: Simeon Widdis <[email protected]> * Add caches for different package targets Signed-off-by: Simeon Widdis <[email protected]> * Fix caches Signed-off-by: Simeon Widdis <[email protected]> * Add yarn cache to regular unit tests Signed-off-by: Simeon Widdis <[email protected]> * Remove target cache in ftr Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]> Signed-off-by: Simeon Widdis <[email protected]>
1 parent 5ae1889 commit fb9027a

3 files changed

+73
-12
lines changed

.github/workflows/dashboards-observability-test-and-build-workflow.yml

+31
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ jobs:
3939
with:
4040
path: OpenSearch-Dashboards/plugins/dashboards-observability
4141

42+
- name: Get yarn cache dir
43+
id: setup-yarn
44+
shell: bash
45+
run: |
46+
cd ./OpenSearch-Dashboards
47+
source $NVM_DIR/nvm.sh
48+
nvm use
49+
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
50+
51+
- name: Yarn Cache
52+
uses: actions/cache@v4
53+
with:
54+
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
55+
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
56+
restore-keys: |
57+
${{ runner.OS }}-yarn-
58+
4259
- name: Plugin Bootstrap
4360
uses: nick-fields/retry@v2
4461
with:
@@ -118,6 +135,20 @@ jobs:
118135
- run: node -v
119136
- run: yarn -v
120137

138+
- name: Get yarn cache dir
139+
id: setup-yarn
140+
shell: bash
141+
run: |
142+
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
143+
144+
- name: Yarn Cache
145+
uses: actions/cache@v4
146+
with:
147+
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
148+
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
149+
restore-keys: |
150+
${{ runner.OS }}-yarn-
151+
121152
- name: Checkout Dashboards Observability
122153
uses: actions/checkout@v2
123154
with:

.github/workflows/ftr-e2e-dashboards-observability-test.yml

+21-6
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,31 @@ jobs:
109109
registry-url: "https://registry.npmjs.org"
110110

111111
- name: Install correct yarn version for OpenSearch Dashboards
112+
id: setup-yarn
112113
run: |
113114
npm uninstall -g yarn
114115
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
115116
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
117+
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
116118
117-
- name: Bootstrap the plugin
119+
- name: Yarn Cache
120+
uses: actions/cache@v4
121+
with:
122+
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
123+
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
124+
restore-keys: |
125+
${{ runner.OS }}-yarn-
126+
127+
- name: Bootstrap OpenSearch Dashboards
118128
run: |
119-
cd OpenSearch-Dashboards/plugins/dashboards-observability
129+
cd OpenSearch-Dashboards
120130
yarn osd bootstrap --single-version=loose
121131
132+
- name: Compile OpenSearch Dashboards
133+
run: |
134+
cd OpenSearch-Dashboards
135+
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10 --verbose
136+
122137
- name: Run OpenSearch Dashboards server
123138
run: |
124139
cd OpenSearch-Dashboards
@@ -128,12 +143,12 @@ jobs:
128143
if: ${{ runner.os == 'Linux' }}
129144
run: |
130145
cd ./OpenSearch-Dashboards
131-
if timeout 600 grep -q "bundles compiled successfully after" <(tail -n0 -f dashboard.log); then
132-
echo "OpenSearch Dashboards compiled successfully."
146+
if timeout 60 grep -q "http server running" <(tail -n +1 -f dashboard.log); then
147+
echo "OpenSearch Dashboards started successfully."
133148
else
134-
echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling."
149+
echo "Timeout of 60 seconds reached. OpenSearch Dashboards did not start successfully."
135150
exit 1
136-
fi
151+
fi&
137152
138153
- name: Checkout Dashboards Functioanl Test Repo
139154
uses: actions/checkout@v2

.github/workflows/integration-tests-workflow.yml

+21-6
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,31 @@ jobs:
131131
working-directory: OpenSearch-Dashboards
132132

133133
- name: Install correct yarn version for OpenSearch Dashboards
134+
id: setup-yarn
134135
run: |
135136
npm uninstall -g yarn
136137
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
137138
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
139+
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
138140
139-
- name: Bootstrap the plugin
141+
- name: Yarn Cache
142+
uses: actions/cache@v4
143+
with:
144+
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
145+
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
146+
restore-keys: |
147+
${{ runner.OS }}-yarn-
148+
149+
- name: Bootstrap OpenSearch Dashboards
140150
run: |
141-
cd OpenSearch-Dashboards/plugins/dashboards-observability
151+
cd OpenSearch-Dashboards
142152
yarn osd bootstrap --single-version=loose
143153
154+
- name: Compile OpenSearch Dashboards
155+
run: |
156+
cd OpenSearch-Dashboards
157+
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10 --verbose
158+
144159
- name: Run OpenSearch Dashboards server
145160
run: |
146161
cd OpenSearch-Dashboards
@@ -150,12 +165,12 @@ jobs:
150165
if: ${{ runner.os == 'Linux' }}
151166
run: |
152167
cd ./OpenSearch-Dashboards
153-
if timeout 600 grep -q "bundles compiled successfully after" <(tail -n0 -f dashboard.log); then
154-
echo "OpenSearch Dashboards compiled successfully."
168+
if timeout 60 grep -q "http server running" <(tail -n +1 -f dashboard.log); then
169+
echo "OpenSearch Dashboards started successfully."
155170
else
156-
echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling."
171+
echo "Timeout of 60 seconds reached. OpenSearch Dashboards did not start successfully."
157172
exit 1
158-
fi
173+
fi&
159174
160175
- name: Install Cypress
161176
run: |

0 commit comments

Comments
 (0)