Skip to content

[Backport 1.x] Backport #1586 to 1.3 branch #3044

[Backport 1.x] Backport #1586 to 1.3 branch

[Backport 1.x] Backport #1586 to 1.3 branch #3044

name: SQL Workbench Test and Build
on:
pull_request:
push:
branches-ignore:
- 'dependabot/**'
paths:
- 'workbench/**'
- '.github/workflows/sql-workbench-test-and-build-workflow.yml'
env:
PLUGIN_NAME: query-workbench-dashboards
OPENSEARCH_VERSION: '1.3'
OPENSEARCH_PLUGIN_VERSION: 1.3.4.0
jobs:
build:
strategy:
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 Plugin
uses: actions/checkout@v3
- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v1 # can't update to v3 because `setup-node` fails
with:
repository: opensearch-project/Opensearch-Dashboards
ref: ${{ env.OPENSEARCH_VERSION }}
path: OpenSearch-Dashboards
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: "../OpenSearch-Dashboards/.nvmrc"
registry-url: 'https://registry.npmjs.org'
- name: Move Workbench to Plugins Dir
run: |
mv workbench ../OpenSearch-Dashboards/plugins
- name: OpenSearch Dashboards Plugin Bootstrap
uses: nick-fields/retry@v2
with:
timeout_minutes: 60
max_attempts: 3
command: cd ../OpenSearch-Dashboards/plugins/workbench; yarn osd bootstrap
- name: Test
run: |
cd ../OpenSearch-Dashboards/plugins/workbench
yarn test:jest --coverage
- name: Upload coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v3
with:
flags: query-workbench
directory: ./../OpenSearch-Dashboards/plugins/workbench
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build Artifact
run: |
cd ../OpenSearch-Dashboards/plugins/workbench
yarn build
mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact
if: always()
uses: actions/upload-artifact@v1 # can't update to v3 because upload fails
with:
name: workbench-${{ matrix.os }}
path: ../OpenSearch-Dashboards/plugins/workbench/build