Skip to content

Commit

Permalink
[Backport 2.x] Add compile step before Cypress runs in CI (#2189)
Browse files Browse the repository at this point in the history
* Add compile step before run step



* Remove wait-for-startup step



* Fix detection of server startup



* Fix cache finding no lock files



* Add caches for different package targets



* Fix caches



* Add yarn cache to regular unit tests



* Remove target cache in ftr



---------



(cherry picked from commit fb9027a)

Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jialiang Liang <[email protected]>
  • Loading branch information
3 people authored Oct 9, 2024
1 parent b2ea536 commit 3336233
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ jobs:
with:
path: OpenSearch-Dashboards/plugins/dashboards-observability

- name: Get yarn cache dir
id: setup-yarn
shell: bash
run: |
cd ./OpenSearch-Dashboards
source $NVM_DIR/nvm.sh
nvm use
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Yarn Cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Plugin Bootstrap
uses: nick-fields/retry@v2
with:
Expand Down Expand Up @@ -112,6 +129,20 @@ jobs:
- run: node -v
- run: yarn -v

- name: Get yarn cache dir
id: setup-yarn
shell: bash
run: |
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Yarn Cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Checkout Dashboards Observability
uses: actions/checkout@v2
with:
Expand Down
27 changes: 21 additions & 6 deletions .github/workflows/ftr-e2e-dashboards-observability-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,31 @@ jobs:
registry-url: "https://registry.npmjs.org"

- name: Install correct yarn version for OpenSearch Dashboards
id: setup-yarn
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Bootstrap the plugin
- name: Yarn Cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Bootstrap OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards/plugins/dashboards-observability
cd OpenSearch-Dashboards
yarn osd bootstrap --single-version=loose
- name: Compile OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10 --verbose
- name: Run OpenSearch Dashboards server
run: |
cd OpenSearch-Dashboards
Expand All @@ -141,12 +156,12 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
cd ./OpenSearch-Dashboards
if timeout 600 grep -q "bundles compiled successfully after" <(tail -n0 -f dashboard.log); then
echo "OpenSearch Dashboards compiled successfully."
if timeout 60 grep -q "http server running" <(tail -n +1 -f dashboard.log); then
echo "OpenSearch Dashboards started successfully."
else
echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling."
echo "Timeout of 60 seconds reached. OpenSearch Dashboards did not start successfully."
exit 1
fi
fi&
- name: Checkout Dashboards Functioanl Test Repo
uses: actions/checkout@v2
Expand Down
27 changes: 21 additions & 6 deletions .github/workflows/integration-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,31 @@ jobs:
working-directory: OpenSearch-Dashboards

- name: Install correct yarn version for OpenSearch Dashboards
id: setup-yarn
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Bootstrap the plugin
- name: Yarn Cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Bootstrap OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards/plugins/dashboards-observability
cd OpenSearch-Dashboards
yarn osd bootstrap --single-version=loose
- name: Compile OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10 --verbose
- name: Run OpenSearch Dashboards server
run: |
cd OpenSearch-Dashboards
Expand All @@ -159,12 +174,12 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
cd ./OpenSearch-Dashboards
if timeout 600 grep -q "bundles compiled successfully after" <(tail -n0 -f dashboard.log); then
echo "OpenSearch Dashboards compiled successfully."
if timeout 60 grep -q "http server running" <(tail -n +1 -f dashboard.log); then
echo "OpenSearch Dashboards started successfully."
else
echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling."
echo "Timeout of 60 seconds reached. OpenSearch Dashboards did not start successfully."
exit 1
fi
fi&
- name: Install Cypress
run: |
Expand Down

0 comments on commit 3336233

Please sign in to comment.