Skip to content

Commit

Permalink
chore(test): add sharding
Browse files Browse the repository at this point in the history
  • Loading branch information
binoy14 committed Oct 25, 2023
1 parent f074dc9 commit 9459e77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
os: [ubuntu-latest]
node: [18, 20]
experimental: [false]
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
# include:
# - os: windows-latest
# node: 16
Expand Down Expand Up @@ -80,6 +82,7 @@ jobs:
run: |
node -v
npm -v
yarn test --silent
yarn test --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }}
env:
SANITY_CI_CLI_AUTH_TOKEN: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }}
GITHUB_SHARD_IDENTIFIER: ${{ matrix.shardIndex }}_${{ matrix.shardTotal }}
2 changes: 1 addition & 1 deletion packages/@sanity/cli/test/shared/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const getTestId = () => {

const localId = readFileSync(testIdPath, 'utf8').trim()
const ghRunId = `${process.env.GITHUB_RUN_ID || ''}`.slice(-4)
const ghId = `${ghRunId}-${process.env.GITHUB_RUN_NUMBER}-${process.env.GITHUB_RUN_ATTEMPT}`
const ghId = `${ghRunId}-${process.env.GITHUB_RUN_NUMBER}-${process.env.GITHUB_RUN_ATTEMPT}-${process.env.GITHUB_SHARD_IDENTIFIER}`
const githubId = process.env.GITHUB_RUN_ID ? `gh-${ghId}` : ''
const runId = `${githubId || localId}`.replace(/\W/g, '-').replace(/(^-+|-+$)/g, '')

Expand Down

0 comments on commit 9459e77

Please sign in to comment.