Skip to content

Commit

Permalink
Unblock existing CI github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Junqiu Lei <[email protected]>
  • Loading branch information
junqiu-lei committed Jan 7, 2023
1 parent 62bb380 commit 6c0e7be
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 61 deletions.
41 changes: 22 additions & 19 deletions .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ on:
branches:
- main
- 2.*
- feature/**
push:
branches:
- main
- 2.*
env:
OPENSEARCH_DASHBOARDS_VERSION: '2.4'
OPENSEARCH_VERSION: '2.4.0-SNAPSHOT'
OPENSEARCH_DASHBOARDS_BRANCH: 'main'
GEOSPATIAL_PLUGIN_BRANCH: 'main'
jobs:
tests:
env:
Expand All @@ -33,6 +34,7 @@ jobs:
cypress_cache_folder: ~/.cache/Cypress
- os: macos-latest
cypress_cache_folder: ~/Library/Caches/Cypress

name: Test and Build Dashboards Maps on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -48,11 +50,11 @@ jobs:
run: subst 'X:' .

- name: Checkout geospatial plugin
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: geospatial
repository: opensearch-project/geospatial
ref: '2.4'
ref: ${{ env.GEOSPATIAL_PLUGIN_BRANCH }}

- name: Run Opensearch with plugin
working-directory: ${{ env.WORKING_DIR }}
Expand All @@ -67,24 +69,25 @@ jobs:
shell: bash
env:
_JAVA_OPTIONS: ${{ matrix.os_java_options }}

- name: Checkout Plugin
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: dashboards-maps

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: opensearch-project/OpenSearch-Dashboards
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
ref: ${{ env.OPENSEARCH_DASHBOARDS_BRANCH }}
path: OpenSearch-Dashboards

- name: Get node and yarn versions
id: versions_step
run: |
echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
- name: Setup node
uses: actions/setup-node@v1
with:
Expand All @@ -103,15 +106,15 @@ jobs:
# Sets Windows to use bash for npm shell so the script commands work as intended
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
- name: Move custom_import_map to Plugins Dir
- name: Move plugin to OpenSearch-Dashboards Plugins Directory
run: |
mv dashboards-maps/custom_import_map OpenSearch-Dashboards/plugins/custom_import_map
- name: Bootstrap plugin/opensearch-dashboards
mv dashboards-maps OpenSearch-Dashboards/plugins/dashboards-maps
- name: Bootstrap plugin
run: |
cd OpenSearch-Dashboards/plugins/custom_import_map
cd OpenSearch-Dashboards/plugins/dashboards-maps
yarn osd bootstrap
- name: Run OpenSearch Dashboards server
run: |
cd OpenSearch-Dashboards
Expand All @@ -131,7 +134,7 @@ jobs:

- name: Install Cypress
run: |
cd OpenSearch-Dashboards/plugins/custom_import_map
cd OpenSearch-Dashboards/plugins/dashboards-maps
# This will install Cypress in case the binary is missing which can happen on Windows and Mac
# If the binary exists, this will exit quickly so it should not be an expensive operation
npx cypress install
Expand All @@ -140,7 +143,7 @@ jobs:
- name: Get Cypress version
id: cypress_version
run: |
cd OpenSearch-Dashboards/plugins/custom_import_map
cd OpenSearch-Dashboards/plugins/dashboards-maps
echo "::set-output name=cypress_version::$(cat ./package.json | jq '.dependencies.cypress' | tr -d '"')"
- name: Cache Cypress
Expand All @@ -159,7 +162,7 @@ jobs:
- name: Run Cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: OpenSearch-Dashboards/plugins/custom_import_map
working-directory: OpenSearch-Dashboards/plugins/dashboards-maps
command: yarn run cypress run --browser chrome
wait-on: 'http://localhost:5601'
env:
Expand All @@ -170,11 +173,11 @@ jobs:
if: failure()
with:
name: cypress-screenshots-${{ matrix.os }}
path: OpenSearch-Dashboards/plugins/custom_import_map/cypress/screenshots
path: OpenSearch-Dashboards/plugins/dashboards-maps/cypress/screenshots

# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos-${{ matrix.os }}
path: OpenSearch-Dashboards/plugins/custom_import_map/cypress/videos
path: OpenSearch-Dashboards/plugins/dashboards-maps/cypress/videos
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@ name: Unit tests workflow
on:
push:
branches:
- "*"
- "feature/**"
paths:
- src/plugins/custom_import_map/**
- .github/workflows/unit-tests-workflow-for-customImportMap.yml
- main
- 2.*
pull_request:
branches:
- "*"
- "feature/**"
paths:
- src/plugins/custom_import_map/**
- .github/workflows/unit-tests-workflow-for-customImportMap.yml
- main
- 2.*
- feature/**

env:
OPENSEARCH_DASHBOARDS_VERSION: '2.4'
OPENSEARCH_DASHBOARDS_BRANCH: 'main'
jobs:
tests:
strategy:
Expand All @@ -27,18 +22,20 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Plugin
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: dashboards-maps

# Enable longer filenames for windows
- name: Enable longer filenames
if: ${{ matrix.os == 'windows-latest' }}
run: git config --system core.longpaths true

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: opensearch-project/OpenSearch-Dashboards
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
ref: ${{ env.OPENSEARCH_DASHBOARDS_BRANCH }}
path: OpenSearch-Dashboards

- name: Get node and yarn versions
Expand All @@ -59,17 +56,17 @@ jobs:
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
- name: Move custom_import_map to Plugins Dir
run: mv custom_import_map OpenSearch-Dashboards/plugins/custom_import_map
- name: Move plugin to OpenSearch-Dashboard Plugins Directory
run: mv dashboards-maps OpenSearch-Dashboards/plugins/dashboards-maps

- name: Bootstrap plugin/opensearch-dashboards
- name: Bootstrap plugin
run: |
cd OpenSearch-Dashboards/plugins/custom_import_map
cd OpenSearch-Dashboards/plugins/dashboards-maps
yarn osd bootstrap
- name: Run tests with coverage
run: |
cd OpenSearch-Dashboards/plugins/custom_import_map
cd OpenSearch-Dashboards/plugins/dashboards-maps
yarn run test:jest --coverage
- name: Uploads coverage
Expand Down
23 changes: 11 additions & 12 deletions cypress/integration/geojson_file_upload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ import 'cypress-file-upload';
describe('Verify successful custom geojson file upload', () => {
before(() => {
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`);
// Click on "Sample data" tab
cy.contains('Sample data').click({ force: true });
// Load sample flights data
cy.get(`button[data-test-subj="addSampleDataSetflights"]`).click({
force: true,
});

// Verify that sample data is add by checking toast notification
cy.contains('Sample flight data installed', { timeout: 240000 });
cy.wait(30000);
cy.get('div[data-test-subj="sampleDataSetCardflights"]')
.contains(/(Add|View) data/)
.click();
cy.wait(30000);

cy.visit(`${BASE_PATH}/app/visualize#/`);

Expand All @@ -40,11 +36,14 @@ describe('Verify successful custom geojson file upload', () => {
cy.get('[data-testId="filePicker"]').attachFile('sample_geojson.json');
cy.get('[data-testId="customIndex"]').type('sample');
cy.contains('Import file').click({ force: true });
cy.contains('Successfully added 2 features to sample-map. Refresh to visualize the uploaded map.', { timeout: 240000 });
})
cy.contains(
'Successfully added 2 features to sample-map. Refresh to visualize the uploaded map.',
{ timeout: 240000 }
);
});

after(() => {
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory`);
cy.get('button[data-test-subj="removeSampleDataSetflights"]').should('be.visible').click();
})
});
});
18 changes: 7 additions & 11 deletions cypress/integration/import_vector_map_tab.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ import { BASE_PATH } from '../utils/constants';
describe('Verify the presence of import custom map tab in region map plugin', () => {
before(() => {
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`);
// Click on "Sample data" tab
cy.contains('Sample data').click({ force: true });
// Load sample flights data
cy.get(`button[data-test-subj="addSampleDataSetflights"]`).click({
force: true,
});

// Verify that sample data is add by checking toast notification
cy.contains('Sample flight data installed', { timeout: 240000 });
cy.wait(30000);
cy.get('div[data-test-subj="sampleDataSetCardflights"]')
.contains(/(Add|View) data/)
.click();
cy.wait(30000);

cy.visit(`${BASE_PATH}/app/visualize#/`);

Expand All @@ -35,10 +31,10 @@ describe('Verify the presence of import custom map tab in region map plugin', ()
it('checks import custom map tab is present', () => {
// Click on "Import Vector Map" tab, which is part of customImportMap plugin
cy.contains('Import Vector Map').click({ force: true });
})
});

after(() => {
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory`);
cy.get('button[data-test-subj="removeSampleDataSetflights"]').should('be.visible').click();
})
});
});

0 comments on commit 6c0e7be

Please sign in to comment.