Skip to content

Commit 2f7b0f0

Browse files
committed
Add test sharding to ci
1 parent 998d2ac commit 2f7b0f0

File tree

2 files changed

+60
-21
lines changed

2 files changed

+60
-21
lines changed

.ci-mgmt.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ provider: eks
22
major-version: 3
33
aws: true
44
kubectl: true
5+
shards: 25 # number of shards to use for parallel testing across all languages.
6+
57
env:
68
ALT_AWS_ACCESS_KEY_ID: ${{ secrets.ALT_AWS_ACCESS_KEY_ID }}
79
ALT_AWS_SECRET_ACCESS_KEY: ${{ secrets.ALT_AWS_SECRET_ACCESS_KEY }}

.github/workflows/test.yml

Lines changed: 58 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,41 @@ jobs:
5858
ref: ${{ env.PR_COMMIT_SHA }}
5959
persist-credentials: false
6060
- name: Checkout p/examples
61-
if: matrix.testTarget == 'pulumiExamples'
6261
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6362
with:
6463
repository: pulumi/examples
6564
path: p-examples
6665
- name: Setup tools
6766
uses: ./.github/actions/setup-tools
68-
with:
69-
tools: pulumictl, pulumicli, ${{ matrix.language }}
7067
- name: Prepare local workspace
7168
run: make prepare_local_workspace
7269
- name: Download bin
7370
uses: ./.github/actions/download-bin
74-
- name: Download SDK
71+
- name: Download nodejs SDK
72+
uses: ./.github/actions/download-sdk
73+
with:
74+
language: nodejs
75+
- name: Download python SDK
76+
uses: ./.github/actions/download-sdk
77+
with:
78+
language: python
79+
- name: Download dotnet SDK
7580
uses: ./.github/actions/download-sdk
7681
with:
77-
language: ${{ matrix.language }}
82+
language: dotnet
83+
- name: Download go SDK
84+
uses: ./.github/actions/download-sdk
85+
with:
86+
language: go
87+
- name: Download java SDK
88+
uses: ./.github/actions/download-sdk
89+
with:
90+
language: java
7891
- name: Restore makefile progress
79-
run: make --touch provider schema build_${{ matrix.language }}
92+
run: make --touch provider schema build_sdks
8093
- name: Update path
8194
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
8295
- name: Install Python deps
83-
if: matrix.language == 'python'
8496
run: |-
8597
pip3 install virtualenv==20.0.23
8698
pip3 install pipenv
@@ -93,21 +105,46 @@ jobs:
93105
role-duration-seconds: 7200
94106
role-session-name: eks@githubActions
95107
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
96-
- name: Install dependencies
97-
run: make install_${{ matrix.language}}_sdk
108+
- name: Install prebuilt SDKs
109+
run: make install_sdks
110+
- name: Generate test shards
111+
run: |-
112+
cd examples
113+
go run github.com/pulumi/shard@861c9ce4aa851e98c19f8376892bf7e47238fa1b \
114+
--total ${{ matrix.total-shards }} \
115+
--index ${{ matrix.current-shard }} \
116+
--output env >> "$GITHUB_ENV"
98117
- name: Run tests
99-
if: matrix.testTarget == 'local'
100-
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -skip TestPulumiExamples -parallel 4 .
101-
- name: Run pulumi/examples tests
102-
if: matrix.testTarget == 'pulumiExamples'
103-
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -run TestPulumiExamples -parallel 4 .
118+
run: |
119+
make GOTESTARGS="-test.run ${SHARD_TESTS} ${SHARD_PATHS}" test
104120
strategy:
105121
fail-fast: false
106122
matrix:
107-
language:
108-
- nodejs
109-
- python
110-
- dotnet
111-
- go
112-
- java
113-
testTarget: [local]
123+
total-shards:
124+
- 25
125+
current-shard:
126+
- 0
127+
- 1
128+
- 2
129+
- 3
130+
- 4
131+
- 5
132+
- 6
133+
- 7
134+
- 8
135+
- 9
136+
- 10
137+
- 11
138+
- 12
139+
- 13
140+
- 14
141+
- 15
142+
- 16
143+
- 17
144+
- 18
145+
- 19
146+
- 20
147+
- 21
148+
- 22
149+
- 23
150+
- 24

0 commit comments

Comments
 (0)