diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/build-and-test-workflow.yml similarity index 60% rename from .github/workflows/unit-tests-workflow.yml rename to .github/workflows/build-and-test-workflow.yml index fa425db14..f18a864b8 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -1,4 +1,4 @@ -name: Unit tests workflow +name: Build and test workflow on: push: branches: @@ -9,12 +9,34 @@ on: env: OPENSEARCH_DASHBOARDS_VERSION: 'main' jobs: - tests: - name: Run unit tests + 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-linux=$CI_IMAGE_VERSION" >> $GITHUB_OUTPUT + build-and-test: + name: Build the plugin and run unit tests strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} + needs: Get-CI-Image-Tag steps: # Enable longer filenames for windows - name: Enable longer filenames @@ -48,7 +70,10 @@ jobs: run: | cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin yarn osd bootstrap - - name: Run tests + - name: Build the plugin + 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 diff --git a/.github/workflows/remote-integ-tests-workflow.yml b/.github/workflows/remote-integ-tests-workflow.yml index 950d9341a..8e6a683d0 100644 --- a/.github/workflows/remote-integ-tests-workflow.yml +++ b/.github/workflows/remote-integ-tests-workflow.yml @@ -10,7 +10,28 @@ on: branches: - "*" jobs: - test-without-security: + 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-linux=$CI_IMAGE_VERSION" >> $GITHUB_OUTPUT + integ-test-without-security: name: Run integ tests without security strategy: matrix: @@ -22,6 +43,7 @@ jobs: - os: ubuntu-latest cypress_cache_folder: ~/.cache/Cypress runs-on: ${{ matrix.os }} + needs: Get-CI-Image-Tag steps: - name: Set up Java 11 uses: actions/setup-java@v3