diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml new file mode 100644 index 0000000000..12bf595afc --- /dev/null +++ b/.github/workflows/lint-js.yml @@ -0,0 +1,38 @@ +name: JS Lint + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + js-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn + + - name: Install Webapp dependencies + run: yarn install + - run: yarn build + - name: Run Format check + run: yarn format:check + - name: Run Lint + # Use use --quiet so that it only report errors + run: yarn lint:quiet + + - name: Run Type check + run: yarn type-check diff --git a/.github/workflows/tests-js.yml b/.github/workflows/tests-js.yml index 2b604a7571..5eca531078 100644 --- a/.github/workflows/tests-js.yml +++ b/.github/workflows/tests-js.yml @@ -1,4 +1,4 @@ -name: JS Tests/Lint/Type-check +name: JS Tests on: push: @@ -27,14 +27,11 @@ jobs: - name: Install Webapp dependencies run: yarn install - - # build the application before testing - # otherwise it won't be able to resolve dependencies - - name: build - run: yarn build - + - name: Get number of CPU cores + id: cpu-cores + uses: SimenB/github-actions-cpu-cores@v1 - name: Run Webapp tests - run: yarn run test --coverage + run: yarn run test --coverage --max-workers ${{ steps.cpu-cores.outputs.count }} - name: Upload codecov coverage if: always() uses: codecov/codecov-action@v1 @@ -42,12 +39,3 @@ jobs: name: js coverage fail_ci_if_error: false verbose: true - - - name: Run Lint - # Use use --quiet so that it only report errors - run: yarn lint:quiet - - name: Run Format check - run: yarn format:check - - - name: Run Type check - run: yarn type-check diff --git a/package.json b/package.json index 3bf0f2511a..d8c48a9b3b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "build:standalone": "webpack --config scripts/webpack/webpack.standalone.ts", "build:size-limit": "NODE_ENV=production webpack --config scripts/webpack/webpack.size-limit.ts", "build:flamegraph": "lerna run build --scope=@pyroscope/flamegraph", - "test": "jest --runInBand", + "test": "jest", "test:ss": "UPDATE_SNAPSHOTS=true ./scripts/jest-snapshots/run-docker.sh", "test:ss-check": "./scripts/jest-snapshots/run-docker.sh", "lint": "lerna run lint --parallel --no-bail", diff --git a/packages/pyroscope-flamegraph/src/FlameGraph/FlameGraphComponent/Tooltip.spec.tsx b/packages/pyroscope-flamegraph/src/FlameGraph/FlameGraphComponent/Tooltip.spec.tsx index b6b18a4331..ddff1046bd 100644 --- a/packages/pyroscope-flamegraph/src/FlameGraph/FlameGraphComponent/Tooltip.spec.tsx +++ b/packages/pyroscope-flamegraph/src/FlameGraph/FlameGraphComponent/Tooltip.spec.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { Maybe } from 'true-myth'; -import type { Units } from '@pyroscope/models'; +import type { Units } from '@pyroscope/models/src'; import { diffColorRed, diffColorGreen } from './color'; import Tooltip, { TooltipProps } from './Tooltip'; diff --git a/scripts/jest-snapshots/run-snapshots.sh b/scripts/jest-snapshots/run-snapshots.sh index ec0fd6d7d3..56e9a33172 100755 --- a/scripts/jest-snapshots/run-snapshots.sh +++ b/scripts/jest-snapshots/run-snapshots.sh @@ -27,6 +27,5 @@ fi # error eslint-import-resolver-webpack@0.13.1: The engine "node" is incompatible with this module. Expected version "^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10 || ^9 || ^8 || ^7 || ^6". Got "17.0.1" # error Found incompatible module. yarn install --ignore-engines -yarn build -RUN_SNAPSHOTS=true yarn test --testNamePattern='group:snapshot' --verbose "$updateArg" +RUN_SNAPSHOTS=true yarn test --testNamePattern='group:snapshot' --verbose "$updateArg" --runInBand