From cf73e79abb185aa44e6cdeadb68f83742fc5dc6d Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Thu, 5 Jan 2023 13:36:09 -0800 Subject: [PATCH 1/8] Add windows env to integration test workflow Signed-off-by: Tyler Ohlsen --- .../remote-integ-tests-workflow-windows | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/remote-integ-tests-workflow-windows diff --git a/.github/workflows/remote-integ-tests-workflow-windows b/.github/workflows/remote-integ-tests-workflow-windows new file mode 100644 index 000000000..c4edf7a42 --- /dev/null +++ b/.github/workflows/remote-integ-tests-workflow-windows @@ -0,0 +1,115 @@ +# 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: + - '*' +env: + OPENSEARCH_DASHBOARDS_VERSION: 'main' + OPENSEARCH_VERSION: '3.0.0-SNAPSHOT' + OPENSEARCH_DASHBOARDS_FTREPO_VERSION: 'main' + ANOMALY_DETECTION_PLUGIN_VERSION: 'main' +jobs: + test-without-security: + name: Run integ tests without security + strategy: + matrix: + os: [windows-latest] + java: [11] + runs-on: ${{ matrix.os }} + steps: + - name: Enable longer filenames + run: git config --system core.longpaths true + + - name: Checkout Anomaly-Detection + uses: actions/checkout@v2 + with: + path: anomaly-detection + repository: opensearch-project/anomaly-detection + ref: ${{ env.ANOMALY_DETECTION_PLUGIN_VERSION }} + + - name: Run Opensearch with plugin + run: | + cd anomaly-detection + ./gradlew run -Dopensearch.version=${{ env.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: Checkout OpenSearch Dashboards + uses: actions/checkout@v2 + with: + repository: opensearch-project/OpenSearch-Dashboards + ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} + path: OpenSearch-Dashboards + + - name: Checkout Anomaly Detection OpenSearch Dashboards plugin + uses: actions/checkout@v2 + with: + path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin + + - name: Get node and yarn versions + id: versions_step + run: | + echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" + 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 + 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 + + - name: Sleep using Windows powershell + run: Start-Sleep -s 400 + shell: powershell + + - name: Checkout opensearch-dashboards-functional-test + uses: actions/checkout@v2 + with: + path: opensearch-dashboards-functional-test + repository: opensearch-project/opensearch-dashboards-functional-test + ref: ${{ env.OPENSEARCH_DASHBOARDS_FTREPO_VERSION }} + + - 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: ~/AppData/Local/Cypress/Cache + 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 From e57c73c38e786ca086fd3ccae0f3deffc82c8e7c Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Fri, 6 Jan 2023 09:06:15 -0800 Subject: [PATCH 2/8] Change name Signed-off-by: Tyler Ohlsen --- .github/workflows/remote-integ-tests-workflow-windows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/remote-integ-tests-workflow-windows b/.github/workflows/remote-integ-tests-workflow-windows index c4edf7a42..5e66ddd1e 100644 --- a/.github/workflows/remote-integ-tests-workflow-windows +++ b/.github/workflows/remote-integ-tests-workflow-windows @@ -1,7 +1,7 @@ # 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 +name: Remote integ tests workflow - windows on: push: branches: From 9d2c84d1615a03356afd05db66e4b134dcc579bb Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Fri, 6 Jan 2023 09:12:43 -0800 Subject: [PATCH 3/8] Merge windows workflow to existing one Signed-off-by: Tyler Ohlsen --- .../remote-integ-tests-workflow-windows | 115 ------------------ .../workflows/remote-integ-tests-workflow.yml | 42 ++++++- 2 files changed, 38 insertions(+), 119 deletions(-) delete mode 100644 .github/workflows/remote-integ-tests-workflow-windows diff --git a/.github/workflows/remote-integ-tests-workflow-windows b/.github/workflows/remote-integ-tests-workflow-windows deleted file mode 100644 index 5e66ddd1e..000000000 --- a/.github/workflows/remote-integ-tests-workflow-windows +++ /dev/null @@ -1,115 +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 - windows -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' -env: - OPENSEARCH_DASHBOARDS_VERSION: 'main' - OPENSEARCH_VERSION: '3.0.0-SNAPSHOT' - OPENSEARCH_DASHBOARDS_FTREPO_VERSION: 'main' - ANOMALY_DETECTION_PLUGIN_VERSION: 'main' -jobs: - test-without-security: - name: Run integ tests without security - strategy: - matrix: - os: [windows-latest] - java: [11] - runs-on: ${{ matrix.os }} - steps: - - name: Enable longer filenames - run: git config --system core.longpaths true - - - name: Checkout Anomaly-Detection - uses: actions/checkout@v2 - with: - path: anomaly-detection - repository: opensearch-project/anomaly-detection - ref: ${{ env.ANOMALY_DETECTION_PLUGIN_VERSION }} - - - name: Run Opensearch with plugin - run: | - cd anomaly-detection - ./gradlew run -Dopensearch.version=${{ env.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: Checkout OpenSearch Dashboards - uses: actions/checkout@v2 - with: - repository: opensearch-project/OpenSearch-Dashboards - ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} - path: OpenSearch-Dashboards - - - name: Checkout Anomaly Detection OpenSearch Dashboards plugin - uses: actions/checkout@v2 - with: - path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin - - - name: Get node and yarn versions - id: versions_step - run: | - echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" - 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 - 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 - - - name: Sleep using Windows powershell - run: Start-Sleep -s 400 - shell: powershell - - - name: Checkout opensearch-dashboards-functional-test - uses: actions/checkout@v2 - with: - path: opensearch-dashboards-functional-test - repository: opensearch-project/opensearch-dashboards-functional-test - ref: ${{ env.OPENSEARCH_DASHBOARDS_FTREPO_VERSION }} - - - 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: ~/AppData/Local/Cypress/Cache - 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 diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index 824589133..852d372af 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -19,36 +19,51 @@ jobs: name: Run integ tests without security strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest] java: [11] + include: + - os: windows-latest + cypress_cache_folder: ~/AppData/Local/Cypress/Cache + - os: ubuntu-latest + cypress_cache_folder: ~/.cache/Cypress runs-on: ${{ matrix.os }} steps: + - name: Enable longer filenames + if: ${{ matrix.os == 'windows-latest' }} + run: git config --system core.longpaths true + - name: Checkout Anomaly-Detection uses: actions/checkout@v2 with: path: anomaly-detection repository: opensearch-project/anomaly-detection ref: ${{ env.ANOMALY_DETECTION_PLUGIN_VERSION }} - - name: Run Opensearch with plugin + + - name: Run OpenSearch with plugin run: | cd anomaly-detection ./gradlew run -Dopensearch.version=${{ env.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: Checkout OpenSearch Dashboards uses: actions/checkout@v2 with: repository: opensearch-project/OpenSearch-Dashboards ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} path: OpenSearch-Dashboards + - name: Checkout Anomaly Detection OpenSearch Dashboards plugin uses: actions/checkout@v2 with: path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin + - name: Get node and yarn versions id: versions_step run: | echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" 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: @@ -60,37 +75,56 @@ jobs: 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 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 & - sleep 300 + 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: ${{ env.OPENSEARCH_DASHBOARDS_FTREPO_VERSION }} + - 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: ~/.cache/Cypress + 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 }} From 24032895028b0d75e90e6950776ea7c6b186aaf3 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Fri, 6 Jan 2023 09:27:51 -0800 Subject: [PATCH 4/8] Run with java 14 Signed-off-by: Tyler Ohlsen --- .github/workflows/remote-integ-tests-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index 852d372af..34d326449 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - java: [11] + java: [14] include: - os: windows-latest cypress_cache_folder: ~/AppData/Local/Cypress/Cache From b095649b4fb336f0b08fc7d0e7a1c59c53f2620c Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Fri, 6 Jan 2023 09:33:01 -0800 Subject: [PATCH 5/8] Revert to 11 Signed-off-by: Tyler Ohlsen --- .github/workflows/remote-integ-tests-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index 34d326449..852d372af 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - java: [14] + java: [11] include: - os: windows-latest cypress_cache_folder: ~/AppData/Local/Cypress/Cache From 9f2b2438ea866f59c6f95894d1f389f13d52ce69 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Fri, 6 Jan 2023 09:43:35 -0800 Subject: [PATCH 6/8] Use gh action to set up java Signed-off-by: Tyler Ohlsen --- .github/workflows/remote-integ-tests-workflow.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index 852d372af..718b8640f 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -20,13 +20,18 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - java: [11] include: - os: windows-latest cypress_cache_folder: ~/AppData/Local/Cypress/Cache - os: ubuntu-latest cypress_cache_folder: ~/.cache/Cypress runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '11' steps: - name: Enable longer filenames if: ${{ matrix.os == 'windows-latest' }} From d4b76ff271143db0c5e001fb90095d81cdbcaa16 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Fri, 6 Jan 2023 09:48:30 -0800 Subject: [PATCH 7/8] embed in step Signed-off-by: Tyler Ohlsen --- .github/workflows/remote-integ-tests-workflow.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index 718b8640f..162a4e8ac 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -20,6 +20,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] + java: [11] include: - os: windows-latest cypress_cache_folder: ~/AppData/Local/Cypress/Cache @@ -27,12 +28,13 @@ jobs: cypress_cache_folder: ~/.cache/Cypress runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: 'corretto' - java-version: '11' - steps: + - name: Set up Java 11 + uses: actions/checkout@v3 + 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 From 45a849be4822587d4c8adb52110f1fcd3e16a428 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Fri, 6 Jan 2023 09:49:32 -0800 Subject: [PATCH 8/8] Remove extra uses Signed-off-by: Tyler Ohlsen --- .github/workflows/remote-integ-tests-workflow.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index 162a4e8ac..d57e3b670 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -29,7 +29,6 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Set up Java 11 - uses: actions/checkout@v3 uses: actions/setup-java@v3 with: distribution: 'corretto'