From c93b30be2451e085ebf4a0ff17fc7bdcec135356 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 17 Oct 2023 17:02:41 -0400 Subject: [PATCH] Test more Signed-off-by: Peter Zhu --- .github/workflows/add-untriaged.yml | 19 -- .github/workflows/backport.yml | 28 -- .github/workflows/build-and-test-workflow.yml | 168 +++++------ .github/workflows/dco.yml | 18 -- .github/workflows/delete_backport_branch.yml | 15 - .../draft-release-notes-workflow.yml | 20 -- .github/workflows/labeler.yml | 26 -- .github/workflows/link-check-workflow.yml | 22 -- .../workflows/remote-integ-tests-workflow.yml | 265 ------------------ 9 files changed, 65 insertions(+), 516 deletions(-) delete mode 100644 .github/workflows/add-untriaged.yml delete mode 100644 .github/workflows/backport.yml delete mode 100644 .github/workflows/dco.yml delete mode 100644 .github/workflows/delete_backport_branch.yml delete mode 100644 .github/workflows/draft-release-notes-workflow.yml delete mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/link-check-workflow.yml delete mode 100644 .github/workflows/remote-integ-tests-workflow.yml diff --git a/.github/workflows/add-untriaged.yml b/.github/workflows/add-untriaged.yml deleted file mode 100644 index 9dcc7020d..000000000 --- a/.github/workflows/add-untriaged.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Apply 'untriaged' label during issue lifecycle - -on: - issues: - types: [opened, reopened, transferred] - -jobs: - apply-label: - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v6 - with: - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['untriaged'] - }) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml deleted file mode 100644 index e47d8d88c..000000000 --- a/.github/workflows/backport.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Backport -on: - pull_request_target: - types: - - closed - - labeled - -jobs: - backport: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - name: Backport - steps: - - name: GitHub App token - id: github_app_token - uses: tibdex/github-app-token@v1.5.0 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - installation_id: 22958780 - - - name: Backport - uses: VachaShah/backport@v1.1.4 - with: - github_token: ${{ steps.github_app_token.outputs.token }} - branch_name: backport/backport-${{ github.event.number }} diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index e47e027ca..0b5f75390 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -8,99 +8,25 @@ on: - "*" env: OPENSEARCH_DASHBOARDS_VERSION: 'main' + jobs: Get-CI-Image-Tag: - runs-on: ubuntu-latest - outputs: - ci-image-version-linux: ${{ steps.step-ci-image-version-linux.outputs.ci-image-version-linux }} - steps: - - name: Install crane - uses: iarekylew00t/crane-installer@v1 - with: - crane-release: v0.15.2 - - name: Checkout opensearch-build repository - uses: actions/checkout@v2 - with: - repository: "opensearch-project/opensearch-build" - ref: "main" - path: "opensearch-build" - - name: Get ci image version from opensearch-build repository scripts - id: step-ci-image-version-linux - run: | - crane version - CI_IMAGE_VERSION=`opensearch-build/docker/ci/get-ci-images.sh -p rockylinux8 -u opensearch-dashboards -t build | head -1` echo $CI_IMAGE_VERSION - echo $CI_IMAGE_VERSION - echo "ci-image-version-linux=$CI_IMAGE_VERSION" >> $GITHUB_OUTPUT + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch build-and-test-linux: - name: Build the plugin and run unit tests - strategy: - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} needs: Get-CI-Image-Tag + name: Build the plugin and run unit tests + 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: - # Enable longer filenames for windows - - name: Enable longer filenames - if: ${{ matrix.os == 'windows-latest' }} - run: git config --system core.longpaths true - - name: Checkout OpenSearch Dashboards - uses: actions/checkout@v2 - with: - repository: opensearch-project/OpenSearch-Dashboards - ref: ${{ env.OPENSEARCH_DASHBOARDS_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: Install Yarn - # Need to use bash to avoid having a windows/linux specific step - shell: bash - run: | - 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: Checkout Anomaly Detection OpenSearch Dashboards plugin - uses: actions/checkout@v2 - with: - path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - - name: Bootstrap the plugin - run: | - cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn osd bootstrap - - name: Build the plugin - run: | - cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn build - - name: Run unit tests - run: | - cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn run test:jest --coverage - - name: Uploads coverage - uses: codecov/codecov-action@v1 - # TODO: once github actions supports windows and macos docker containers, we can - # merge these in to the above step's matrix. - build-and-test-windows-macos: - name: Build the plugin and run unit tests - strategy: - matrix: - os: [macos-latest, windows-latest] - runs-on: ${{ matrix.os }} steps: - # Enable longer filenames for windows - - name: Enable longer filenames - if: ${{ matrix.os == 'windows-latest' }} - run: git config --system core.longpaths true - name: Checkout OpenSearch Dashboards uses: actions/checkout@v2 with: @@ -108,35 +34,71 @@ jobs: ref: ${{ env.OPENSEARCH_DASHBOARDS_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: Install Yarn - # Need to use bash to avoid having a windows/linux specific step - shell: bash run: | - 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 + nvm use `cat ./OpenSearch-Dashboards/.nvmrc` + node -v + yarn -v - name: Checkout Anomaly Detection OpenSearch Dashboards plugin uses: actions/checkout@v2 with: path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - - name: Bootstrap the plugin - run: | - cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn osd bootstrap - - name: Build the plugin - run: | - cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn build - - name: Run unit tests + - name: Bootstrap / build / unit test the plugin run: | + chown -R 1000:1000 `pwd` cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn run test:jest --coverage + su `id -un 1000` -c "whoami && yarn osd bootstrap && yarn build && yarn run test:jest --coverage" - name: Uploads coverage uses: codecov/codecov-action@v1 +# # TODO: once github actions supports windows and macos docker containers, we can +# # merge these in to the above step's matrix. +# build-and-test-windows-macos: +# name: Build the plugin and run unit tests +# strategy: +# matrix: +# os: [macos-latest, windows-latest] +# runs-on: ${{ matrix.os }} +# steps: +# # Enable longer filenames for windows +# - name: Enable longer filenames +# if: ${{ matrix.os == 'windows-latest' }} +# run: git config --system core.longpaths true +# - name: Checkout OpenSearch Dashboards +# uses: actions/checkout@v2 +# with: +# repository: opensearch-project/OpenSearch-Dashboards +# ref: ${{ env.OPENSEARCH_DASHBOARDS_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: Install Yarn +# # Need to use bash to avoid having a windows/linux specific step +# shell: bash +# run: | +# 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: Checkout Anomaly Detection OpenSearch Dashboards plugin +# uses: actions/checkout@v2 +# with: +# path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin +# - name: Bootstrap the plugin +# run: | +# cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin +# yarn osd bootstrap +# - name: Build the plugin +# run: | +# cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin +# yarn build +# - name: Run unit tests +# run: | +# cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin +# yarn run test:jest --coverage +# - name: Uploads coverage +# uses: codecov/codecov-action@v1 +# diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml deleted file mode 100644 index d4c9ff2c4..000000000 --- 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 }} \ No newline at end of file diff --git a/.github/workflows/delete_backport_branch.yml b/.github/workflows/delete_backport_branch.yml deleted file mode 100644 index d654df6b4..000000000 --- a/.github/workflows/delete_backport_branch.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Delete merged branch of the backport PRs -on: - pull_request: - types: - - closed - -jobs: - delete-branch: - runs-on: ubuntu-latest - if: startsWith(github.event.pull_request.head.ref,'backport/') - steps: - - name: Delete merged branch - uses: SvanBoxel/delete-merged-branch@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/draft-release-notes-workflow.yml b/.github/workflows/draft-release-notes-workflow.yml deleted file mode 100644 index 5e67f9a5a..000000000 --- a/.github/workflows/draft-release-notes-workflow.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Release Drafter - -on: - push: - branches: - - main - -jobs: - update_release_draft: - name: Update draft release notes - runs-on: ubuntu-latest - steps: - - name: Update draft release notes - uses: release-drafter/release-drafter@v5 - with: - config-name: draft-release-notes-config.yml - name: Version (set here) - tag: (None) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index bac8e16a7..000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: "Pull Request Labeler" -on: - pull_request_target: - branches: - - main - types: - - opened - -jobs: - label: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: GitHub App token - id: github_app_token - uses: tibdex/github-app-token@v1.5.0 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - installation_id: 22958780 - - name: Label - uses: actions/labeler@v4 - with: - repo-token: ${{ steps.github_app_token.outputs.token }} \ No newline at end of file diff --git a/.github/workflows/link-check-workflow.yml b/.github/workflows/link-check-workflow.yml deleted file mode 100644 index 2fd67552c..000000000 --- a/.github/workflows/link-check-workflow.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Link Checker -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - linkchecker: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: lychee Link Checker - id: lychee - uses: lycheeverse/lychee-action@master - with: - args: --accept=200,403,429 --exclude=localhost **/*.html **/*.md **/*.txt **/*.json - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Fail if there were link errors - run: exit ${{ steps.lychee.outputs.exit_code }} diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml deleted file mode 100644 index f91eacb63..000000000 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ /dev/null @@ -1,265 +0,0 @@ -# Running AD integ tests stored in https://github.com/opensearch-project/opensearch-dashboards-functional-test -# In the future we should pull dependencies from bundled build snapshots. Because that is not available -# yet we build the cluster from source (besides core Opensearch, which is a pulled min artifact). -name: Remote integ tests workflow -on: - push: - branches: - - "*" - pull_request: - branches: - - "*" -jobs: - Get-CI-Image-Tag: - uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main - with: - product: opensearch - - integ-test-without-security-linux: - name: Run integ tests without security - linux - strategy: - matrix: - os: [ubuntu-latest] - java: [11] - include: - - os: ubuntu-latest - cypress_cache_folder: ~/.cache/Cypress - runs-on: ${{ matrix.os }} - needs: Get-CI-Image-Tag - 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 }} - options: --user root - steps: - - name: Set up Java 11 - uses: actions/setup-java@v3 - with: - distribution: 'corretto' - java-version: '11' - - - name: Enable longer filenames - if: ${{ matrix.os == 'windows-latest' }} - run: git config --system core.longpaths true - - - name: Checkout OpenSearch Dashboards - uses: actions/checkout@v2 - with: - repository: opensearch-project/OpenSearch-Dashboards - ref: '${{ github.base_ref }}' - path: OpenSearch-Dashboards - - - name: Checkout Anomaly Detection OpenSearch Dashboards plugin - uses: actions/checkout@v2 - with: - path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - - - name: Setup Node - uses: actions/setup-node@v3 - with: - 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('./OpenSearch-Dashboards/package.json').engines.yarn") - echo "Installing yarn@$YARN_VERSION" - npm i -g yarn@$YARN_VERSION - - - run: node -v - - run: yarn -v - - - name: Checkout Anomaly-Detection - uses: actions/checkout@v2 - with: - path: anomaly-detection - repository: opensearch-project/anomaly-detection - ref: '${{ github.base_ref }}' - - - name: Run OpenSearch with plugin - run: | - cd anomaly-detection - CONFIG_PATH=../OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin/opensearch_dashboards.json - OPENSEARCH_VERSION=$(node -p "require('$CONFIG_PATH').opensearchDashboardsVersion")-SNAPSHOT - echo "Using OpenSearch version $OPENSEARCH_VERSION" - ./gradlew run -Dopensearch.version=$OPENSEARCH_VERSION & - timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done' - shell: bash - - - name: Bootstrap the plugin - run: | - cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn osd bootstrap - - - name: Run OpenSearch Dashboards server - run: | - cd OpenSearch-Dashboards - yarn start --no-base-path --no-watch & - shell: bash - - # Window is slow so wait longer - - name: Sleep until OSD server starts - windows - if: ${{ matrix.os == 'windows-latest' }} - run: Start-Sleep -s 400 - shell: powershell - - - name: Sleep until OSD server starts - non-windows - if: ${{ matrix.os != 'windows-latest' }} - run: sleep 300 - shell: bash - - - name: Checkout opensearch-dashboards-functional-test - uses: actions/checkout@v2 - with: - path: opensearch-dashboards-functional-test - repository: opensearch-project/opensearch-dashboards-functional-test - ref: '${{ github.base_ref }}' - - - name: Get Cypress version - id: cypress_version - run: | - echo "::set-output name=cypress_version::$(cat ./opensearch-dashboards-functional-test/package.json | jq '.devDependencies.cypress' | tr -d '"')" - - - name: Cache Cypress - id: cache-cypress - uses: actions/cache@v1 - with: - path: ${{ matrix.cypress_cache_folder }} - key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }} - env: - CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }} - - run: npx cypress cache list - - run: npx cypress cache path - - - name: Run AD cypress tests - uses: cypress-io/github-action@v2 - with: - working-directory: opensearch-dashboards-functional-test - command: yarn run cypress run --env SECURITY_ENABLED=false --spec cypress/integration/plugins/anomaly-detection-dashboards-plugin/**/*.js - env: - CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }} - - # TODO: once github actions supports windows and macos docker containers, we can - # merge these in to the above step's matrix. - integ-test-without-security-windows: - name: Run integ tests without security - windows - strategy: - matrix: - os: [windows-latest] - java: [11] - include: - - os: windows-latest - cypress_cache_folder: ~/AppData/Local/Cypress/Cache - runs-on: ${{ matrix.os }} - needs: Get-CI-Image-Tag - steps: - - name: Set up Java 11 - uses: actions/setup-java@v3 - with: - distribution: 'corretto' - java-version: '11' - - - name: Enable longer filenames - if: ${{ matrix.os == 'windows-latest' }} - run: git config --system core.longpaths true - - - name: Checkout OpenSearch Dashboards - uses: actions/checkout@v2 - with: - repository: opensearch-project/OpenSearch-Dashboards - ref: '${{ github.base_ref }}' - path: OpenSearch-Dashboards - - - name: Checkout Anomaly Detection OpenSearch Dashboards plugin - uses: actions/checkout@v2 - with: - path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - - - name: Setup Node - uses: actions/setup-node@v3 - with: - 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('./OpenSearch-Dashboards/package.json').engines.yarn") - echo "Installing yarn@$YARN_VERSION" - npm i -g yarn@$YARN_VERSION - - - run: node -v - - run: yarn -v - - - name: Checkout Anomaly-Detection - uses: actions/checkout@v2 - with: - path: anomaly-detection - repository: opensearch-project/anomaly-detection - ref: '${{ github.base_ref }}' - - - name: Run OpenSearch with plugin - run: | - cd anomaly-detection - CONFIG_PATH=../OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin/opensearch_dashboards.json - OPENSEARCH_VERSION=$(node -p "require('$CONFIG_PATH').opensearchDashboardsVersion")-SNAPSHOT - echo "Using OpenSearch version $OPENSEARCH_VERSION" - ./gradlew run -Dopensearch.version=$OPENSEARCH_VERSION & - timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done' - shell: bash - - - name: Bootstrap the plugin - run: | - cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - yarn osd bootstrap - - - name: Run OpenSearch Dashboards server - run: | - cd OpenSearch-Dashboards - yarn start --no-base-path --no-watch & - shell: bash - - # Window is slow so wait longer - - name: Sleep until OSD server starts - windows - if: ${{ matrix.os == 'windows-latest' }} - run: Start-Sleep -s 400 - shell: powershell - - - name: Sleep until OSD server starts - non-windows - if: ${{ matrix.os != 'windows-latest' }} - run: sleep 300 - shell: bash - - - name: Checkout opensearch-dashboards-functional-test - uses: actions/checkout@v2 - with: - path: opensearch-dashboards-functional-test - repository: opensearch-project/opensearch-dashboards-functional-test - ref: '${{ github.base_ref }}' - - - name: Get Cypress version - id: cypress_version - run: | - echo "::set-output name=cypress_version::$(cat ./opensearch-dashboards-functional-test/package.json | jq '.devDependencies.cypress' | tr -d '"')" - - - name: Cache Cypress - id: cache-cypress - uses: actions/cache@v1 - with: - path: ${{ matrix.cypress_cache_folder }} - key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }} - env: - CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }} - - run: npx cypress cache list - - run: npx cypress cache path - - - name: Run AD cypress tests - uses: cypress-io/github-action@v2 - with: - working-directory: opensearch-dashboards-functional-test - command: yarn run cypress run --env SECURITY_ENABLED=false --spec cypress/integration/plugins/anomaly-detection-dashboards-plugin/**/*.js - env: - CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }}