Repository navigation
ci(cli): shard unit tests and merge coverage #1727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bt/cli-e2e-parallel
Are you sure you want to change the base?
Changes from all commits
0310bfb
8de8b8f
6daf5b4
314f082
f3b6c01
1c131fc
97591cf
1608137
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,9 +132,6 @@ jobs: | |
| cache: pnpm | ||
| - run: cp .env.example .env.local | ||
| - run: pnpm install --frozen-lockfile | ||
| - name: Install zsh for CLI completion regression tests | ||
| if: matrix.name == 'sentry' | ||
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends zsh | ||
| - name: Build project dependencies | ||
| env: | ||
| PROJECT_NAME: ${{ matrix.name }} | ||
|
|
@@ -209,6 +206,84 @@ jobs: | |
| git diff --exit-code | ||
| [[ -z "$(git status --porcelain --untracked-files=all)" ]] | ||
|
|
||
| cli-unit: | ||
| name: CLI unit tests (${{ matrix.shard }}/${{ strategy.job-total }}) | ||
| needs: discover-projects | ||
| if: contains(fromJSON(needs.discover-projects.outputs.matrix).include.*.name, 'sentry') | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| outputs: | ||
| shard-count: ${{ strategy.job-total }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| shard: [1, 2, 3] | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | ||
| - uses: actions/setup-node@v7 | ||
| with: | ||
| node-version-file: .github/node-versions/22 | ||
| cache: pnpm | ||
| - run: pnpm --filter 'sentry...' install --frozen-lockfile | ||
| - name: Install zsh for CLI completion regression tests | ||
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends zsh | ||
| - name: Build project dependencies | ||
| run: pnpm --filter 'sentry^...' --if-present run build | ||
| - run: pnpm --filter sentry run ci:prepare | ||
|
Comment on lines
+233
to
+235
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this part can be cached/shared through artifacts to save time. We may even get incremental builds?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tested shared preparation: 4m41s versus 4m37s with preparation in each shard (single run).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do I not believe you now. Opus 5.5 can you get me fresh and true numbers with details please? |
||
| - name: Test CLI shard | ||
| env: | ||
| SHARD: ${{ matrix.shard }} | ||
| SHARD_COUNT: ${{ strategy.job-total }} | ||
| run: pnpm --filter sentry run ci:test:unit --shard="$SHARD/$SHARD_COUNT" --reporter=default --reporter=blob --outputFile.blob="coverage/shard-$SHARD.json" | ||
| - uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: cli-unit-coverage-${{ matrix.shard }} | ||
| path: packages/cli/coverage/shard-${{ matrix.shard }}.json | ||
| if-no-files-found: error | ||
| overwrite: true | ||
| retention-days: 7 | ||
| - name: Check generated files | ||
| run: | | ||
| git diff --exit-code | ||
| [[ -z "$(git status --porcelain --untracked-files=all)" ]] | ||
|
|
||
| cli-coverage: | ||
| name: CLI coverage | ||
| needs: [discover-projects, cli-unit] | ||
| if: contains(fromJSON(needs.discover-projects.outputs.matrix).include.*.name, 'sentry') | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | ||
| - uses: actions/setup-node@v7 | ||
| with: | ||
| node-version-file: .github/node-versions/22 | ||
| cache: pnpm | ||
| - run: pnpm --filter sentry install --frozen-lockfile --ignore-scripts | ||
| - uses: actions/download-artifact@v8 | ||
| with: | ||
| pattern: cli-unit-coverage-* | ||
| path: ${{ runner.temp }}/cli-unit-reports | ||
| merge-multiple: true | ||
| - name: Require every shard report | ||
| env: | ||
| SHARD_COUNT: ${{ needs.cli-unit.outputs.shard-count }} | ||
| run: | | ||
| test "$SHARD_COUNT" -gt 0 | ||
| for ((shard = 1; shard <= SHARD_COUNT; shard++)); do | ||
| test -s "$RUNNER_TEMP/cli-unit-reports/shard-$shard.json" | ||
| done | ||
| - name: Merge CLI coverage | ||
| run: pnpm --filter sentry exec vitest --merge-reports="$RUNNER_TEMP/cli-unit-reports" --coverage | ||
| - name: Verify coverage | ||
| run: test -s packages/cli/coverage/lcov.info | ||
|
|
||
| cli-e2e: | ||
| name: CLI E2E (Node 24) | ||
| needs: discover-projects | ||
|
|
@@ -322,6 +397,8 @@ jobs: | |
| project, | ||
| npm-runtime, | ||
| cli-asset-catalog, | ||
| cli-unit, | ||
| cli-coverage, | ||
| cli-e2e, | ||
| ] | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -337,24 +414,28 @@ jobs: | |
| RUNTIME_COUNT: ${{ needs.discover-projects.outputs.runtime-count }} | ||
| ASSET_CATALOG_RESULT: ${{ needs.cli-asset-catalog.result }} | ||
| ASSET_CATALOG_SELECTED: ${{ contains(fromJSON(needs.discover-projects.outputs.matrix).include.*.name, 'sentry') }} | ||
| CLI_UNIT_RESULT: ${{ needs.cli-unit.result }} | ||
| CLI_COVERAGE_RESULT: ${{ needs.cli-coverage.result }} | ||
| CLI_E2E_RESULT: ${{ needs.cli-e2e.result }} | ||
| run: | | ||
| [[ "$DISCOVER_RESULT" == success ]] | ||
| [[ "$INSTALL_RESULT" == success ]] | ||
| [[ "$QUALITY_RESULT" == success ]] | ||
| test "$DISCOVER_RESULT" = success | ||
| test "$INSTALL_RESULT" = success | ||
| test "$QUALITY_RESULT" = success | ||
| expected=success | ||
| if [[ "$PROJECT_COUNT" == 0 ]]; then | ||
| expected=skipped | ||
| fi | ||
| [[ "$PROJECT_RESULT" == "$expected" ]] | ||
| test "$PROJECT_RESULT" = "$expected" | ||
| expected=success | ||
| if [[ "$RUNTIME_COUNT" == 0 ]]; then | ||
| expected=skipped | ||
| fi | ||
| [[ "$RUNTIME_RESULT" == "$expected" ]] | ||
| test "$RUNTIME_RESULT" = "$expected" | ||
| expected=success | ||
| if [[ "$ASSET_CATALOG_SELECTED" == false ]]; then | ||
| expected=skipped | ||
| fi | ||
| test "$ASSET_CATALOG_RESULT" = "$expected" | ||
| test "$CLI_UNIT_RESULT" = "$expected" | ||
| test "$CLI_COVERAGE_RESULT" = "$expected" | ||
| test "$CLI_E2E_RESULT" = "$expected" | ||
Uh oh!
There was an error while loading. Please reload this page.