Skip to content

Commit 5dda3a9

Browse files
condo-botsitozzz
authored andcommitted
ci(condo): INFRA-1234 generate shard matrix
1 parent dd96bef commit 5dda3a9

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/nodejs.condo.ci.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ concurrency:
2121
env:
2222
DOCKER_IMAGE: condo/condo-image:${{ github.event.pull_request.head.sha || github.sha }}
2323
DOCKER_IMAGE_FULL: ${{ secrets.DOCKER_REGISTRY }}/condo/condo-image:${{ github.event.pull_request.head.sha || github.sha }}
24+
CONDO_TEST_SHARD_TOTAL: 16
2425
PG_IMAGE_FULL: ${{ secrets.DOCKER_REGISTRY }}/doma/utils/postgres:16.8
2526
REDIS_IMAGE_FULL: ${{ secrets.DOCKER_REGISTRY }}/doma/utils/redis:6.2
2627
REF: ${{ github.event.pull_request.head.sha || github.ref }}
@@ -419,19 +420,36 @@ jobs:
419420
needs:
420421
- authorize
421422
- build-image
423+
- generate-condo-test-shards
422424
strategy:
423425
# TODO: remove this back
424426
fail-fast: false
425427
matrix:
426-
shard_index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
428+
shard_index: ${{ fromJSON(needs.generate-condo-test-shards.outputs.ids) }}
427429
uses: ./.github/workflows/_nodejs.condo.core.tests.yml
428430
with:
429431
shard_index: ${{ matrix.shard_index }}
430-
shard_total: 16
432+
shard_total: ${{ fromJSON(needs.generate-condo-test-shards.outputs.total) }}
431433
runs-on: test-runners
432434
image_name: ${{ needs.build-image.outputs.DOCKER_IMAGE }}
433435
secrets: inherit
434436

437+
generate-condo-test-shards:
438+
name: Generate Condo test shards
439+
needs: authorize
440+
runs-on: ubuntu-22.04
441+
outputs:
442+
ids: ${{ steps.generate.outputs.ids }}
443+
total: ${{ steps.generate.outputs.total }}
444+
steps:
445+
- name: Generate shard indexes
446+
id: generate
447+
env:
448+
SHARD_TOTAL: ${{ env.CONDO_TEST_SHARD_TOTAL }}
449+
run: |
450+
echo "ids=$(jq -c -n --argjson total \"$SHARD_TOTAL\" '[range(1; $total + 1)]')" >> "$GITHUB_OUTPUT"
451+
echo "total=$SHARD_TOTAL" >> "$GITHUB_OUTPUT"
452+
435453
run-dev-portal-api-tests:
436454
name: Dev Portal API Tests
437455
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)