Testing changes #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit tests workflow | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "*" | |
env: | |
OPENSEARCH_DASHBOARDS_VERSION: '1.3' | |
jobs: | |
tests: | |
name: Run unit tests | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest , windows-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Enable longer filenames | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: git config --system core.longpaths true | |
- name: Checkout Index Management Dashboards plugin | |
uses: actions/checkout@v2 | |
with: | |
path: index-management-dashboards-plugin | |
- name: Checkout OpenSearch-Dashboards | |
uses: actions/checkout@v2 | |
with: | |
repository: opensearch-project/OpenSearch-Dashboards | |
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} | |
path: OpenSearch-Dashboards | |
- name: Get node and yarn versions | |
id: versions | |
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]")" | |
shell: bash | |
- name: Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ steps.versions.outputs.node_version }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install correct yarn version for OpenSearch-Dashboards | |
run: | | |
npm uninstall -g yarn | |
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" | |
npm i -g yarn@${{ steps.versions.outputs.yarn_version }} | |
shell: bash | |
- name: Bootstrap plugin/OpenSearch-Dashboards | |
run: | | |
mkdir -p OpenSearch-Dashboards/plugins | |
mv index-management-dashboards-plugin OpenSearch-Dashboards/plugins | |
cd OpenSearch-Dashboards/plugins/index-management-dashboards-plugin | |
yarn osd bootstrap | |
shell: bash | |
- name: Run tests | |
run: | | |
cd OpenSearch-Dashboards/plugins/index-management-dashboards-plugin | |
yarn run test:jest --coverage | |
- name: Uploads coverage | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |