[CI/CD] Add FTR workflow for dashboards observability #26
Workflow file for this run
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: Lint | |
on: [push, pull_request] | |
env: | |
PLUGIN_NAME: dashboards-observability | |
OPENSEARCH_DASHBOARDS_VERSION: 'main' | |
jobs: | |
build: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout OpenSearch Dashboards | |
uses: actions/checkout@v2 | |
with: | |
repository: opensearch-project/Opensearch-Dashboards | |
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} | |
path: OpenSearch-Dashboards | |
- name: Checkout dashboards observability | |
uses: actions/checkout@v2 | |
with: | |
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} | |
- name: Get node and yarn versions | |
working-directory: ${{ env.WORKING_DIR }} | |
id: versions_step | |
run: | | |
echo "::set-output name=node_version::$(cat ./OpenSearch-Dashboards/.nvmrc | cut -d"." -f1)" | |
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: | |
node-version: ${{ steps.versions_step.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_step.outputs.yarn_version }} | |
- name: Bootstrap the plugin | |
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} | |
run: | |
yarn osd bootstrap | |
# Step to get changed files | |
- name: Get changed files | |
id: changed-files | |
uses: jitterbit/get-changed-files@v1 | |
with: | |
format: 'json' | |
# Step to lint changed JavaScript/TypeScript files | |
- name: Lint changed files | |
run: | | |
# Extract changed files as JSON | |
CHANGED_FILES_JSON='${{ steps.changed-files.outputs.all }}' | |
# Convert JSON to array of file paths | |
CHANGED_FILES=$(echo $CHANGED_FILES_JSON | jq -r '.[]' | grep -E "\.(js|ts|tsx)$") | |
echo "Changed JavaScript/TypeScript files:" | |
echo $CHANGED_FILES | |
if [ -n "$CHANGED_FILES" ]; then | |
echo "Linting changed files..." | |
yarn lint $CHANGED_FILES | |
else | |
echo "No JavaScript/TypeScript files changed." |