Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ steps:
- exit_status: '*'
limit: 2
plugins:
- joscha/codecov#v3.1.0:
args:
- '-F browser'
- ssh://[email protected]/segmentio/cache-buildkite-plugin#v2.0.0:
key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}"
paths: ['.yarn/cache/']
Expand All @@ -95,6 +98,9 @@ steps:
- yarn run -T core test
- yarn turbo run --filter=core-integration-tests lint
plugins:
- joscha/codecov#v3.1.0:
args:
- '-F core'
- ssh://[email protected]/segmentio/cache-buildkite-plugin#v2.0.0:
key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}"
paths: ['.yarn/cache/']
Expand Down Expand Up @@ -128,6 +134,9 @@ steps:
- echo "+++ Run Tests"
- yarn turbo run --filter='./packages/consent/*' test
plugins:
- joscha/codecov#v3.1.0:
args:
- '-F consent'
- ssh://[email protected]/segmentio/cache-buildkite-plugin#v2.0.0:
key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}"

Expand All @@ -145,6 +154,9 @@ steps:
- echo "+++ Run Tests"
- yarn turbo run --filter='./packages/signals/*' test
plugins:
- joscha/codecov#v3.1.0:
args:
- '-F signals'
- ssh://[email protected]/segmentio/cache-buildkite-plugin#v2.0.0:
key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}"
paths: ['.yarn/cache/']
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
- run: yarn turbo run --filter='./packages/node*' lint
- run: yarn turbo run --filter='./packages/node*' test
- run: yarn turbo run --filter='./packages/node-integration-tests' test:perf-and-durability
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: node
slug: segmentio/analytics-next/node
analytics-node-cf-workers:
name: 'analytics-node QA (Cloudflare Workers)'
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions packages/config/src/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const createJestTSConfig = (
* No need to manually run yarn build all the time.
* This resolve packages for ts-jest so typescript compilation happens in-memory.
*/
collectCoverage: process.env.CI === true,
Copy link
Collaborator Author

@MichaelGHSeg MichaelGHSeg Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes some spurrious validation warnings. I didn't see a definitive answer about whether a new jest version would solve it. We can add --coverage to the test command lines instead

Copy link
Contributor

@silesky silesky Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    ...([process.env.CI, process.env.COVERAGE].includes('true') && isRootConfig
      ? { collectCoverage: true }
      : {}),
    coverageDirectory: '<rootDir>/coverage',

I've tested this --

Observations on this config:

  1. on Buildkite/CI, when yarn run -T core test is run -- the coverage directory is in the packages/core. I am not sure that codecov can handle a bunch of individual "coverage" folders like that, or it can only handle one big honking coverage folder. Sticking with this pattern would be ideal.

  2. We also support running yarn test --coverage at the monorepo root (which is a currently not a command we run on CI) which runs the test suite on every package -- and creates an aggregated coverage folder. We only don't do this on CI because we like having the CI steps be more atomic (test core, test browser, etc) -- it also is more flexible in the future if want to power up turborepo with distributed build caching.

I'm still kinda on the fence about whether we or not we should use the CI env variable for coverage, or whether that's confusing and we use the new COVERAGE env variable. (or ditch the process.env.CI and just run with --coverage, or, all three). There's too many ways to do this ;-)

coverageDirectory: path.join(dirname, 'coverage'),
coverageReporters: ['json'],
moduleNameMapper: moduleMap,
preset: 'ts-jest',
modulePathIgnorePatterns: [
Expand Down