Skip to content

Commit

Permalink
Add compile step before Cypress runs in CI (#2187)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
Swiddis authored Oct 1, 2024
1 parent 5ae1889 commit fb9027a
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 @@ -39,6 +39,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 @@ -118,6 +135,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 @@ -109,16 +109,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 @@ -128,12 +143,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 @@ -131,16 +131,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 @@ -150,12 +165,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 fb9027a

Please sign in to comment.