Skip to content

Commit

Permalink
Move gantt-chart out from subdirectory (#321)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 authored Jan 26, 2024
1 parent 09ef7f9 commit 12ad9b7
Show file tree
Hide file tree
Showing 51 changed files with 70 additions and 88 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 17 additions & 19 deletions .github/workflows/cypress-e2e-gantt-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,34 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}

- name: Checkout Plugin
uses: actions/checkout@v2

- name: Download OpenSearch
uses: peternied/download-file@v2
with:
url: https://artifacts.opensearch.org/snapshots/core/opensearch/${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/opensearch-min-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64-latest.tar.gz

- name: Extract OpenSearch
run: |
tar -xzf opensearch-*.tar.gz
rm -f opensearch-*.tar.gz
shell: bash

- name: Run OpenSearch
run: |
/bin/bash -c "./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/bin/opensearch &"
sleep 30
shell: bash

- name: Check OpenSearch Running on Linux
if: ${{ runner.os != 'Windows'}}
run: curl http://localhost:9200/
shell: bash

- name: Show OpenSearch Logs
if: always()
run: cat ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/logs/opensearch.log
shell: bash

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
with:
Expand All @@ -67,9 +64,10 @@ jobs:
cypress
test
- name: Install Gantt Chart to Opensearch Dashboards Plugins Dir
run: |
mv gantt-chart ./OpenSearch-Dashboards/plugins
- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-visualizations

- id: tool-versions
run: |
Expand Down Expand Up @@ -97,7 +95,7 @@ jobs:
run: |
yarn osd bootstrap
working-directory: OpenSearch-Dashboards

- name: Run Opensearch Dashboards with Gantt Chart Installed
run: |
nohup yarn start --no-base-path --no-watch | tee dashboard.log &
Expand All @@ -118,29 +116,29 @@ jobs:
run: |
npx cypress install
shell: bash
working-directory: OpenSearch-Dashboards/plugins/gantt-chart
working-directory: OpenSearch-Dashboards/plugins/dashboards-visualizations

- name: Get Cypress version
id: cypress_version
run: |
echo "::set-output name=cypress_version::$(cat ./package.json | jq '.dependencies.cypress' | tr -d '"')"
working-directory: OpenSearch-Dashboards/plugins/gantt-chart
working-directory: OpenSearch-Dashboards/plugins/dashboards-visualizations

- name: Run Cypress tests
run: |
yarn cypress:run --browser chrome --headless --spec '.cypress/integration/${{ matrix.testgroups }}/*'
working-directory: OpenSearch-Dashboards/plugins/gantt-chart
working-directory: OpenSearch-Dashboards/plugins/dashboards-visualizations

- name: Capture failure screenshots
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots-${{ matrix.os }}
path: OpenSearch-Dashboards/plugins/gantt-chart/.cypress/screenshots
path: OpenSearch-Dashboards/plugins/dashboards-visualizations/.cypress/screenshots

- name: Capture test video
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-videos-${{ matrix.os }}
path: OpenSearch-Dashboards/plugins/gantt-chart/.cypress/videos
path: OpenSearch-Dashboards/plugins/dashboards-visualizations/.cypress/videos
7 changes: 4 additions & 3 deletions .github/workflows/ftr-e2e-gantt-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ jobs:
cypress
test
- name: Install Gantt Chart to Opensearch Dashboards Plugins Dir
run: |
mv gantt-chart ./OpenSearch-Dashboards/plugins
- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-visualizations

- id: tool-versions
run: |
Expand Down
28 changes: 10 additions & 18 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout Plugin
uses: actions/checkout@v2

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

- name: Install Gantt Chart to Opensearch Dashboards Plugins Dir
run: |
mv gantt-chart ./OpenSearch-Dashboards/plugins
- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-visualizations

- name: Get node and yarn versions
working-directory: ${{ env.WORKING_DIR }}
Expand All @@ -46,7 +44,7 @@ jobs:
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
- name: Bootstrap the plugin
working-directory: OpenSearch-Dashboards/plugins/gantt-chart
working-directory: OpenSearch-Dashboards/plugins/dashboards-visualizations
run: yarn osd bootstrap

- name: Get list of changed files using GitHub Action
Expand All @@ -63,18 +61,12 @@ jobs:
- name: Lint Changed Files
run: |
jq -r '.[]' ${HOME}/files_modified.json ${HOME}/files_added.json | sort | uniq > /tmp/changed_files.txt
CHANGED_FILES=$(cat /tmp/changed_files.txt)
echo "These are the changed files: $CHANGED_FILES"
CHANGED_FILES=($(jq -r '.[]' ${HOME}/files_modified.json ${HOME}/files_added.json | grep '.\+.\(js\|ts\|tsx\)$' | sort -u))
if [[ -n "$CHANGED_FILES" ]]; then
echo "Linting changed files..."
while IFS= read -r file; do
if [[ $file =~ ^gantt-chart/.+\.(js|ts|tsx)$ ]]; then
echo "linting file $file"
yarn lint "../$file"
fi
done < /tmp/changed_files.txt
echo 'These are the changed files:'
printf '%s\n' "${CHANGED_FILES[@]}"
yarn lint "${CHANGED_FILES[@]}"
else
echo "No matched files to lint."
fi
working-directory: OpenSearch-Dashboards/plugins/gantt-chart
working-directory: OpenSearch-Dashboards/plugins/dashboards-visualizations
77 changes: 36 additions & 41 deletions .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,49 @@ jobs:
options: --user root

steps:
- name: Checkout Plugin
uses: actions/checkout@v2

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
with:
repository: opensearch-project/Opensearch-Dashboards
ref: ${{ env.OPENSEARCH_VERSION }}
path: dashboards-visualizations/OpenSearch-Dashboards
path: OpenSearch-Dashboards

- name: Move Gantt Chart to Plugins Dir
run: |
mv gantt-chart ./dashboards-visualizations/OpenSearch-Dashboards/plugins
- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-visualizations

- name: Plugin Bootstrap / stylelint / test
run: |
chown -R 1000:1000 `pwd`
cd dashboards-visualizations/OpenSearch-Dashboards/
cd OpenSearch-Dashboards/
su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v &&
cd ./plugins/gantt-chart &&
cd ./plugins/dashboards-visualizations &&
whoami && yarn osd bootstrap && yarn lint:style && yarn test --coverage"
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
directory: ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
directory: ./OpenSearch-Dashboards/plugins/dashboards-visualizations
token: ${{ secrets.CODECOV_TOKEN }}

- name: Build Artifact
run: |
chown -R 1000:1000 `pwd`
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && yarn build"
mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: gantt-chart-ubuntu
path: ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart/build
path: ./OpenSearch-Dashboards/plugins/dashboards-visualizations/build

windows-build:

runs-on: windows-latest
steps:
- name: Checkout Plugin
uses: actions/checkout@v2
# Enable longer filenames for windows
- name: Enable longer filenames
run: git config --system core.longpaths true
Expand All @@ -81,117 +77,116 @@ jobs:
with:
repository: opensearch-project/Opensearch-Dashboards
ref: ${{ env.OPENSEARCH_VERSION }}
path: dashboards-visualizations/OpenSearch-Dashboards
path: OpenSearch-Dashboards

- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-visualizations

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './dashboards-visualizations/OpenSearch-Dashboards/.nvmrc'
node-version-file: './OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
YARN_VERSION=$(node -p "require('./dashboards-visualizations/OpenSearch-Dashboards/package.json').engines.yarn")
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
echo "Installing yarn@$YARN_VERSION"
npm i -g yarn@$YARN_VERSION
- run: node -v
- run: yarn -v

- name: Move Gantt Chart to Plugins Dir
run: |
mv gantt-chart ./dashboards-visualizations/OpenSearch-Dashboards/plugins
- name: Plugin Bootstrap
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn osd bootstrap
- name: Run Stylelint
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn lint:style
- name: Test
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn test
- name: Build Artifact
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn build
mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: gantt-chart-windows
path: ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart/build
path: ./OpenSearch-Dashboards/plugins/dashboards-visualizations/build

macos-build:

runs-on: macos-latest

steps:
- name: Checkout Plugin
uses: actions/checkout@v2

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
with:
repository: opensearch-project/Opensearch-Dashboards
ref: ${{ env.OPENSEARCH_VERSION }}
path: dashboards-visualizations/OpenSearch-Dashboards
path: OpenSearch-Dashboards

- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-visualizations

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './dashboards-visualizations/OpenSearch-Dashboards/.nvmrc'
node-version-file: './OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
YARN_VERSION=$(node -p "require('./dashboards-visualizations/OpenSearch-Dashboards/package.json').engines.yarn")
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
echo "Installing yarn@$YARN_VERSION"
npm i -g yarn@$YARN_VERSION
- run: node -v
- run: yarn -v

- name: Move Gantt Chart to Plugins Dir
run: |
mv gantt-chart ./dashboards-visualizations/OpenSearch-Dashboards/plugins
- name: Plugin Bootstrap
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn osd bootstrap
- name: Run Stylelint
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn lint:style
- name: Test
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn test
- name: Build Artifact
run: |
cd ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart
cd ./OpenSearch-Dashboards/plugins/dashboards-visualizations
yarn build
mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: gantt-chart-macos
path: ./dashboards-visualizations/OpenSearch-Dashboards/plugins/gantt-chart/build
path: ./OpenSearch-Dashboards/plugins/dashboards-visualizations/build


File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 12ad9b7

Please sign in to comment.