diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index f893f1398e5b..fbf9d4ba5490 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -25,12 +25,12 @@ env: OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true jobs: - build-lint-test: + build-lint-test-posix: runs-on: ubuntu-latest container: image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2 options: --user 1001 - name: Build and Verify + name: Build and Verify on Linux steps: - name: Checkout code uses: actions/checkout@v2 @@ -71,12 +71,55 @@ jobs: id: integration-tests run: yarn test:jest_integration:ci - functional-tests: + build-lint-test-windows: + runs-on: windows-latest + name: Build and Verify on Windows + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version-file: '.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup Yarn + run: | + npm uninstall -g yarn + npm i -g yarn@1.22.10 + + - name: Run bootstrap + run: yarn osd bootstrap + + - name: Run linter + id: linter + run: yarn lint + + - name: Run unit tests with coverage + id: unit-tests + run: yarn test:jest:ci:coverage + + - name: Run mocha tests with coverage + id: mocha-tests + run: yarn test:mocha:coverage + +# - name: Upload Code Coverage +# id: upload-code-coverage +# uses: codecov/codecov-action@v3 +# with: +# directory: ./target/opensearch-dashboards-coverage + + - name: Run integration tests + id: integration-tests + run: yarn test:jest_integration:ci + + functional-tests-posix: runs-on: ubuntu-latest container: image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2 options: --user 1001 - name: Run functional tests + name: Run functional tests on Linux strategy: matrix: group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ] @@ -116,12 +159,60 @@ jobs: JOB: ci${{ matrix.group }} CACHE_DIR: ciGroup${{ matrix.group }} - build-min-artifact-tests: + functional-tests-windows: + runs-on: windows-latest + name: Run functional tests on Windows + strategy: + matrix: + group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ] + steps: + - run: echo Running functional tests for ciGroup${{ matrix.group }} + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version-file: '.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup Yarn + run: | + npm uninstall -g yarn + npm i -g yarn@1.22.10 + + # image has the latest chrome v99 + - name: Setup chromedriver + run: yarn add --dev chromedriver@106.0.1 + + - name: Run bootstrap + run: yarn osd bootstrap + + - name: Build plugins + run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10 + + - name: Run CI test group ${{ matrix.group }} + id: ftr-tests + run: node scripts/functional_tests.js --config test/functional/config.js --include ciGroup${{ matrix.group }} + env: + CI_GROUP: ciGroup${{ matrix.group }} + CI_PARALLEL_PROCESS_NUMBER: ciGroup${{ matrix.group }} + JOB: ci${{ matrix.group }} + CACHE_DIR: ciGroup${{ matrix.group }} + + build-min-artifact-tests-posix: runs-on: ubuntu-latest container: image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2 options: --user 1001 - name: Build min release artifacts + name: Build min release artifacts on Linux defaults: run: working-directory: ./artifacts @@ -174,8 +265,59 @@ jobs: path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }} retention-days: 1 + build-min-artifact-tests-windows: + runs-on: windows-latest + name: Build min release artifacts on Windows + defaults: + run: + working-directory: ./artifacts + strategy: + matrix: + include: + - name: Windows x64 + ext: zip + suffix: windows-x64 + script: build-platform --windows --skip-os-packages + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ./artifacts + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version-file: './artifacts/.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup Yarn + run: | + npm uninstall -g yarn + npm i -g yarn@1.22.10 + + - name: Get package version + run: | + echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV + + - name: Get artifact build name + run: | + echo "ARTIFACT_BUILD_NAME=opensearch-dashboards-${{ env.VERSION }}-${{ matrix.suffix }}.${{ matrix.ext }}" >> $GITHUB_ENV + + - name: Run bootstrap + run: yarn osd bootstrap + + - name: Build `${{ matrix.name }}` + run: yarn ${{ matrix.script }} --release + + - uses: actions/upload-artifact@v3 + if: success() + with: + name: ${{ matrix.suffix }}-${{ env.VERSION }} + path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }} + retention-days: 1 + bwc-tests: - needs: [build-min-artifact-tests] + needs: [build-min-artifact-tests-posix] runs-on: ubuntu-latest container: image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2 diff --git a/packages/osd-eslint-plugin-eslint/rules/no_restricted_paths.js b/packages/osd-eslint-plugin-eslint/rules/no_restricted_paths.js index 6343af30028e..ecd14f7317aa 100644 --- a/packages/osd-eslint-plugin-eslint/rules/no_restricted_paths.js +++ b/packages/osd-eslint-plugin-eslint/rules/no_restricted_paths.js @@ -58,7 +58,7 @@ function traverseToTopFolder(src, pattern) { const srcIdx = src.lastIndexOf(path.sep); src = src.slice(0, srcIdx); } - return src; + return src.replace(/\\/g, '/'); } function isSameFolderOrDescendent(src, imported, pattern) { diff --git a/packages/osd-plugin-generator/src/cli.ts b/packages/osd-plugin-generator/src/cli.ts index 596f55159ed0..2d23cb8facfb 100644 --- a/packages/osd-plugin-generator/src/cli.ts +++ b/packages/osd-plugin-generator/src/cli.ts @@ -32,7 +32,7 @@ import Path from 'path'; import Fs from 'fs'; import execa from 'execa'; -import { REPO_ROOT } from '@osd/utils'; +import { PROCESS_WORKING_DIR, REPO_ROOT } from '@osd/cross-platform'; import { run, createFailError, createFlagError } from '@osd/dev-utils'; import { snakeCase } from './casing'; @@ -78,7 +78,7 @@ export function runCli() { } log.success( - `🎉\n\nYour plugin has been created in ${Path.relative(process.cwd(), outputDir)}\n` + `🎉\n\nYour plugin has been created in ${Path.relative(PROCESS_WORKING_DIR, outputDir)}\n` ); }, { diff --git a/packages/osd-plugin-helpers/src/integration_tests/build.test.ts b/packages/osd-plugin-helpers/src/integration_tests/build.test.ts index 6b0edd411b29..780682d27658 100644 --- a/packages/osd-plugin-helpers/src/integration_tests/build.test.ts +++ b/packages/osd-plugin-helpers/src/integration_tests/build.test.ts @@ -32,7 +32,7 @@ import Path from 'path'; import Fs from 'fs'; import execa from 'execa'; -import { REPO_ROOT } from '@osd/cross-platform'; +import { REPO_ROOT, standardize } from '@osd/cross-platform'; import { createStripAnsiSerializer, createReplaceSerializer } from '@osd/dev-utils'; import extract from 'extract-zip'; import del from 'del'; @@ -78,7 +78,9 @@ it('builds a generated plugin into a viable archive', async () => { expect(generateProc.all).toMatchInlineSnapshot(` " succ 🎉 - Your plugin has been created in `); + Your plugin has been created in ${standardize('plugins/foo_test_plugin', false, true)} + " + `); const buildProc = await execa( process.execPath, @@ -164,7 +166,9 @@ it('builds a non-semver generated plugin into a viable archive', async () => { expect(generateProc.all).toMatchInlineSnapshot(` " succ 🎉 - Your plugin has been created in `); + Your plugin has been created in ${standardize('plugins/foo_test_plugin', false, true)} + " + `); const buildProc = await execa( process.execPath,