diff --git a/.github/workflows/web-test-code-quality.yml b/.github/workflows/web-test-code-quality.yml new file mode 100644 index 00000000000..4281c88db43 --- /dev/null +++ b/.github/workflows/web-test-code-quality.yml @@ -0,0 +1,66 @@ +name: Web code quality checks +on: + pull_request: + paths: + - ".github/workflows/web-test.yml" + - "web-admin/**" + - "web-auth/**" + - "web-common/**" + - "web-local/**" +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Filter modified codepaths + uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + admin: + - ".github/workflows/web-test.yml" + - "web-admin/**" + auth: + - ".github/workflows/web-test.yml" + - "web-auth/**" + local: + - ".github/workflows/web-test.yml" + - "web-local/**" + common: + - ".github/workflows/web-test.yml" + - "web-common/**" + + - name: Set up NodeJS + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: NPM Install + run: npm install + + - name: lint and type checks for web common + if: steps.filter.outputs.common == 'true' + run: |- + npx eslint web-common --quiet + npx svelte-check --threshold error --workspace web-common --no-tsconfig --ignore "src/components/data-graphic,src/features/dashboards/time-series,src/features/dashboards/time-controls/TimeRangeSelector.svelte,src/features/dashboards/time-controls/TimeControls.svelte" + + - name: lint and type checks for web local + if: steps.filter.outputs.local == 'true' + run: |- + npx eslint web-local --quiet + npx svelte-check --workspace web-local --no-tsconfig --ignore "src/routes/dev" + + - name: lint and type checks for web admin + if: steps.filter.outputs.admin == 'true' + run: |- + npx eslint web-admin --quiet + npx svelte-check --workspace web-admin --no-tsconfig + + - name: lint and type checks for web auth + if: steps.filter.outputs.auth == 'true' + run: |- + npx eslint web-auth --quiet + npx svelte-check --workspace web-auth --no-tsconfig + diff --git a/.github/workflows/web-test.yml b/.github/workflows/web-test-e2e.yml similarity index 59% rename from .github/workflows/web-test.yml rename to .github/workflows/web-test-e2e.yml index 34fe6fbf214..f51dc9eb4a3 100644 --- a/.github/workflows/web-test.yml +++ b/.github/workflows/web-test-e2e.yml @@ -1,4 +1,4 @@ -name: Build and Test web code +name: End-to-end tests of web+runtime on: pull_request: paths: @@ -70,38 +70,6 @@ jobs: - name: Install browser for UI tests run: npx playwright install - - name: Prettier checks and lint for web common - if: steps.filter.outputs.common == 'true' - run: |- - npx prettier --check "web-common/**/*" - npx eslint web-common --quiet - npx svelte-check --threshold error --workspace web-common --no-tsconfig --ignore "src/components/data-graphic,src/features/dashboards/time-series,src/features/dashboards/time-controls/TimeRangeSelector.svelte,src/features/dashboards/time-controls/TimeControls.svelte" - - - name: Prettier checks and lint for web local - if: steps.filter.outputs.local == 'true' - run: |- - npx prettier --check "web-local/**/*" - npx eslint web-local --quiet - npx svelte-check --workspace web-local --no-tsconfig --ignore "src/routes/dev" - - - name: Prettier checks and lint for web admin - if: steps.filter.outputs.admin == 'true' - run: |- - npx prettier --check "web-admin/**/*" - npx eslint web-admin --quiet - npx svelte-check --workspace web-admin --no-tsconfig - - - name: Prettier checks and lint for web auth - if: steps.filter.outputs.auth == 'true' - run: |- - npx prettier --check "web-auth/**/*" - npx eslint web-auth --quiet - npx svelte-check --workspace web-auth --no-tsconfig - - - name: Test web common - if: steps.filter.outputs.common == 'true' - run: npm run test -w web-common - - name: Test web local if: ${{ steps.filter.outputs.local == 'true' || steps.filter.outputs.common == 'true' }} run: npm run test -w web-local @@ -118,7 +86,3 @@ jobs: run: |- npm run build -w web-admin npm run test -w web-admin - - - name: Build & Test storybook - run: |- - npm run storybook:smoketest -w web-common diff --git a/.github/workflows/web-test-unit-tests.yml b/.github/workflows/web-test-unit-tests.yml new file mode 100644 index 00000000000..88dcb90e693 --- /dev/null +++ b/.github/workflows/web-test-unit-tests.yml @@ -0,0 +1,53 @@ +name: Unit tests for web code +on: + pull_request: + paths: + - ".github/workflows/web-test.yml" + - "web-admin/**" + - "web-auth/**" + - "web-common/**" + - "web-local/**" +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Filter modified codepaths + uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + admin: + - ".github/workflows/web-test.yml" + - "web-admin/**" + auth: + - ".github/workflows/web-test.yml" + - "web-auth/**" + local: + - ".github/workflows/web-test.yml" + - "web-local/**" + common: + - ".github/workflows/web-test.yml" + - "web-common/**" + + - name: Set up NodeJS + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: NPM Install + run: npm install + + - name: Run web-common unit tests + if: steps.filter.outputs.common == 'true' + run: npm run test -w web-common + + - name: Run web-auth unit tests + if: steps.filter.outputs.auth == 'true' + run: npm run test -w web-auth + + - name: Run storybook smoke tests + run: |- + npm run storybook:smoketest -w web-common