From f6f7a79f0c8ffe769da0aceb8dc9d9db28888ad9 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 1 Nov 2023 13:39:00 -0400 Subject: [PATCH 1/3] Onboard Jenkins prod docker images to github actions Signed-off-by: Peter Zhu --- .github/workflows/dco.yml | 18 ----- .../sql-workbench-test-build-workflow.yml | 66 ++++++++++++++++--- 2 files changed, 57 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/dco.yml diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml deleted file mode 100644 index cf30ea89..00000000 --- a/.github/workflows/dco.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Developer Certificate of Origin Check - -on: [pull_request] - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - name: Get PR Commits - id: 'get-pr-commits' - uses: tim-actions/get-pr-commits@v1.1.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: DCO Check - uses: tim-actions/dco@v1.1.0 - with: - commits: ${{ steps.get-pr-commits.outputs.commits }} diff --git a/.github/workflows/sql-workbench-test-build-workflow.yml b/.github/workflows/sql-workbench-test-build-workflow.yml index 738aa7c6..488b5075 100644 --- a/.github/workflows/sql-workbench-test-build-workflow.yml +++ b/.github/workflows/sql-workbench-test-build-workflow.yml @@ -7,11 +7,66 @@ on: - 'dependabot/**' jobs: - tests: + Get-CI-Image-Tag: + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch-dashboards + + tests-linux: + needs: Get-CI-Image-Tag + name: Run unit tests on linux host + strategy: + runs-on: ubuntu-latest + container: + # using the same image which is used by opensearch-build team to build the OpenSearch Distribution + # this image tag is subject to change as more dependencies and updates will arrive over time + image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} + # need to switch to root so that github actions can install runner binary on container without permission issues. + options: --user root + + steps: + - name: Checkout OpenSearch Dashboards + uses: actions/checkout@v3 + with: + repository: opensearch-project/OpenSearch-Dashboards + path: OpenSearch-Dashboards + - name: Checkout workbench OpenSearch Dashboards plugin + uses: actions/checkout@v3 + with: + path: OpenSearch-Dashboards/plugins/dashboards-query-workbench + - name: Bootstrap plugin/opensearch-dashboards and run tests + run: | + chown -R 1000:1000 `pwd` + cd ./OpenSearch-Dashboards/ + su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && + cd ./plugins/dashboards-query-workbench && + whoami && yarn osd bootstrap && yarn run test:jest --coverage" + + - name: Upload coverage + if: always() + uses: codecov/codecov-action@v3 + with: + flags: dashboards-query-workbench + directory: OpenSearch-Dashboards/plugins/dashboards-query-workbench + token: ${{ secrets.CODECOV_TOKEN }} + - name: Build Artifact + if: always() + run: | + cd OpenSearch-Dashboards/plugins/dashboards-query-workbench + yarn build + mv ./build/*.zip ./build/dashboards-query-workbench.zip + - name: Upload Artifact + if: always() + uses: actions/upload-artifact@v3 + with: + name: dashboards-query-workbench-ubuntu-latest + path: OpenSearch-Dashboards/plugins/dashboards-query-workbench/build + + tests-macos-windows: name: Run unit tests strategy: matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] + os: [ macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: # Enable longer filenames for windows @@ -49,13 +104,6 @@ jobs: run: | cd OpenSearch-Dashboards/plugins/dashboards-query-workbench yarn test:jest --coverage - - name: Upload coverage - if: ${{ always() && matrix.os == 'ubuntu-latest' }} - uses: codecov/codecov-action@v3 - with: - flags: dashboards-query-workbench - directory: OpenSearch-Dashboards/plugins/dashboards-query-workbench - token: ${{ secrets.CODECOV_TOKEN }} - name: Build Artifact if: always() run: | From 7f212b3408c2c363dc5a0a3eede8cb6e6db48632 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 1 Nov 2023 13:41:48 -0400 Subject: [PATCH 2/3] Add more Signed-off-by: Peter Zhu --- .github/workflows/sql-workbench-test-build-workflow.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sql-workbench-test-build-workflow.yml b/.github/workflows/sql-workbench-test-build-workflow.yml index 488b5075..4168e4da 100644 --- a/.github/workflows/sql-workbench-test-build-workflow.yml +++ b/.github/workflows/sql-workbench-test-build-workflow.yml @@ -15,7 +15,6 @@ jobs: tests-linux: needs: Get-CI-Image-Tag name: Run unit tests on linux host - strategy: runs-on: ubuntu-latest container: # using the same image which is used by opensearch-build team to build the OpenSearch Distribution From 8f696f83e7eae00905e74925404e13faa589a000 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 1 Nov 2023 14:13:12 -0400 Subject: [PATCH 3/3] Add more Signed-off-by: Peter Zhu --- .github/workflows/sql-workbench-test-build-workflow.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sql-workbench-test-build-workflow.yml b/.github/workflows/sql-workbench-test-build-workflow.yml index 4168e4da..d363ea55 100644 --- a/.github/workflows/sql-workbench-test-build-workflow.yml +++ b/.github/workflows/sql-workbench-test-build-workflow.yml @@ -51,9 +51,11 @@ jobs: - name: Build Artifact if: always() run: | - cd OpenSearch-Dashboards/plugins/dashboards-query-workbench - yarn build - mv ./build/*.zip ./build/dashboards-query-workbench.zip + chown -R 1000:1000 `pwd` + cd ./OpenSearch-Dashboards/ + su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && + cd ./plugins/dashboards-query-workbench && + whoami && yarn build && mv ./build/*.zip ./build/dashboards-query-workbench.zip" - name: Upload Artifact if: always() uses: actions/upload-artifact@v3