-
Notifications
You must be signed in to change notification settings - Fork 0
Sharding vitest #1108
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
Open
MrFjellstad
wants to merge
11
commits into
main
Choose a base branch
from
shardVitest
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sharding vitest #1108
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f9dec08
Sharding vitest
MrFjellstad adcac18
Sharding vitest
MrFjellstad ac8fde9
Sharding vitest
MrFjellstad 3c4c6c3
Sharding vitest
MrFjellstad 42e98f7
Sharding vitest
MrFjellstad 05580c9
Potential fix for code scanning alert no. 42: Workflow does not conta…
MrFjellstad b60429f
Mocker dekoratoren (#1109)
MrFjellstad 991c84c
Vis refusjonsendringer om den går fra ikke refundert, til at det blir…
MrFjellstad 1c40dcf
Slår på flertråd kjøring igjen
MrFjellstad 2265096
Bruker PW docker image (#1111)
MrFjellstad efa7a10
Bump pino from 9.8.0 to 9.9.0 (#1112)
dependabot[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| name: test | ||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| vitest: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| shard: [1, 2, 3, 4] # number of shards | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - run: npm ci | ||
| - name: Run shard ${{ matrix.shard }} | ||
| env: | ||
| # unique sonar test execution file per shard (vitest-sonar-reporter) | ||
| VITEST_SONAR_FILE: sonar-report-${{ matrix.shard }}.xml | ||
| run: | | ||
| npx vitest run \ | ||
| --shard ${{ matrix.shard }}/4 \ | ||
| --threads=false \ | ||
| --reporter=default | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-${{ matrix.shard }} | ||
| path: | | ||
| coverage | ||
| sonar-report-*.xml | ||
|
|
||
| sonar: | ||
| name: SonarCloud | ||
| needs: vitest | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| # Download all shard artifacts into the workspace | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: coverage-* | ||
| merge-multiple: true | ||
|
|
||
| # Merge coverage and gather test execution reports | ||
| - name: Merge coverage and collect reports | ||
| run: | | ||
| mkdir -p reports/sonar | ||
| # Merge LCOVs from all shards | ||
| npx --yes lcov-result-merger 'coverage/**/lcov.info' 'reports/lcov.info' | ||
| # Collect Generic Test Execution XMLs (from vitest-sonar-reporter) | ||
| mv sonar-report-*.xml reports/sonar/ || true | ||
| echo "SONAR_TEST_REPORTS=$(ls reports/sonar/*.xml 2>/dev/null | paste -sd, -)" >> $GITHUB_ENV | ||
|
|
||
| # Run SonarCloud analysis (requires SONAR_TOKEN secret). | ||
| - uses: SonarSource/sonarcloud-github-action@v2 | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| with: | ||
| args: > | ||
| -Dsonar.organization=YOUR_ORG_KEY | ||
| -Dsonar.projectKey=YOUR_PROJECT_KEY | ||
| -Dsonar.javascript.lcov.reportPaths=reports/lcov.info | ||
| -Dsonar.testExecutionReportPaths=${{ env.SONAR_TEST_REPORTS }} | ||
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.