Skip to content
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

Test sharding #4912

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 59 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,35 +52,58 @@ jobs:
ref: ${{ env.PR_COMMIT_SHA }}
submodules: true
persist-credentials: false
- name: Checkout p/examples
if: matrix.testTarget == 'pulumiExamples'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: pulumi/examples
path: p-examples
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, pulumicli, ${{ matrix.language }}
- name: Prepare local workspace
run: make prepare_local_workspace
- name: Download bin
uses: ./.github/actions/download-bin
- name: Download SDK
- name: Download nodejs SDK
uses: ./.github/actions/download-sdk
with:
language: nodejs
- name: Restore makefile progress
run: make --touch provider schema build_nodejs
- name: Install dependencies
run: make install_nodejs_sdk
- name: Download python SDK
uses: ./.github/actions/download-sdk
with:
language: python
- name: Restore makefile progress
run: make --touch provider schema build_python
- name: Install dependencies
run: make install_python_sdk
- name: Download dotnet SDK
uses: ./.github/actions/download-sdk
with:
language: ${{ matrix.language }}
language: dotnet
- name: Restore makefile progress
run: make --touch provider schema build_${{ matrix.language }}
run: make --touch provider schema build_dotnet
- name: Install dependencies
run: make install_dotnet_sdk
- name: Download go SDK
uses: ./.github/actions/download-sdk
with:
language: go
- name: Restore makefile progress
run: make --touch provider schema build_go
- name: Install dependencies
run: make install_go_sdk
- name: Download java SDK
uses: ./.github/actions/download-sdk
with:
language: java
- name: Restore makefile progress
run: make --touch provider schema build_java
- name: Install dependencies
run: make install_java_sdk
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Install Python deps
if: matrix.language == 'python'
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
- name: Install dependencies
run: make install_${{ matrix.language}}_sdk
- name: Install gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
Expand All @@ -97,22 +120,29 @@ jobs:
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Make upstream
run: make upstream
- name: Run tests
if: matrix.testTarget == 'local'
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -skip TestPulumiExamples -parallel 4 .
- name: Run pulumi/examples tests
if: matrix.testTarget == 'pulumiExamples'
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -run TestPulumiExamples -parallel 4 .
- name: Generate shard
run: make shard
env:
SHARD_TOTAL: ${{ matrix.total }}
SHARD_INDEX: ${{ matrix.index }}
- name: Run integration tests
run: make test_shard
strategy:
fail-fast: false
matrix:
language:
- nodejs
- python
- dotnet
- go
- java
testTarget: [local]
fail-fast: false
matrix:
total:
- 10
index:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
upstream_lint:
name: Run upstream provider-lint
runs-on: ubuntu-latest
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ provider_dist-darwin-arm64: bin/$(PROVIDER)-v$(VERSION_GENERIC)-darwin-arm64.tar
provider_dist-windows-amd64: bin/$(PROVIDER)-v$(VERSION_GENERIC)-windows-amd64.tar.gz
provider_dist: provider_dist-linux-amd64 provider_dist-linux-arm64 provider_dist-darwin-amd64 provider_dist-darwin-arm64 provider_dist-windows-amd64
.PHONY: provider_dist-linux-amd64 provider_dist-linux-arm64 provider_dist-darwin-amd64 provider_dist-darwin-arm64 provider_dist-windows-amd64 provider_dist

# shard computes tests to run and modifies the CI runner's environment.
shard:
@(cd examples && go run github.com/blampe/shard@latest --total $(SHARD_TOTAL) --index $(SHARD_INDEX) --output env) >> "$(GITHUB_ENV)"

# test_shard runs the tests specified by a regex contained in $SHARD_TESTS for paths $SHARD_PATHS.
test_shard:
cd examples && \
go test -tags=all -v -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 3h -parallel ${TESTPARALLELISM} -run "$(SHARD_TESTS)" $(SHARD_PATHS)
# Permit providers to extend the Makefile with provider-specific Make includes.
include $(wildcard .mk/*.mk)
Loading