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

wip: bridged test sharding #1054

Draft
wants to merge 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ jobs:
build_sdk:
name: build_sdk
runs-on: #{{ if .Config.runner.buildSdk }}##{{- .Config.runner.buildSdk }}##{{ else }}##{{- .Config.runner.default }}##{{ end }}#
strategy:
fail-fast: true
matrix:
language:
- nodejs
- python
- dotnet
- go
- java
steps:
- name: Checkout Repo
uses: #{{ .Config.actionVersions.checkout }}#
Expand All @@ -47,8 +38,8 @@ jobs:
run: make install_plugins
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Build SDK
run: make build_${{ matrix.language }}
- name: Build SDKs
run: make -j4 build_sdks
- name: Check worktree clean
uses: pulumi/git-status-check-action@v1
with:
Expand All @@ -58,7 +49,11 @@ jobs:
sdk/go/**/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Tar SDK folder
run: tar -zcf sdk.tar.gz -C sdk .
- name: Upload SDK
uses: ./.github/actions/upload-sdk
uses: actions/upload-artifact@v4
with:
language: ${{ matrix.language }}
name: sdk.tar.gz
path: ${{ github.workspace}}/sdk.tar.gz
retention-days: 30
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ jobs:
name: comment-notification
runs-on: #{{ .Config.runner.default }}#
steps:
- id: run-url
name: Create URL to the run output
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> "$GITHUB_OUTPUT"
- name: Update with Result
uses: peter-evans/create-or-update-comment@v1
with:
body: "Please view the PR build: ${{ steps.run-url.outputs.run-url }}"
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
token: ${{ secrets.PULUMI_BOT_TOKEN }}
- id: run-url
name: Create URL to the run output
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> "$GITHUB_OUTPUT"
- name: Update with Result
uses: peter-evans/create-or-update-comment@v1
with:
body: "Please view the PR build: ${{ steps.run-url.outputs.run-url }}"
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
token: ${{ secrets.PULUMI_BOT_TOKEN }}
#{{ if .Config.lint -}}#
lint:
if: github.event_name == 'repository_dispatch' ||
Expand All @@ -65,28 +65,28 @@ jobs:
if: github.event_name == 'repository_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
needs:
- test
- build_provider
- license_check
#{{- if .Config.lint }}#
- lint
#{{- end }}#
#{{- range $action, $_ := .Config.extraTests }}#
- #{{ $action }}#
- test
- build_provider
- license_check
#{{- if .Config.lint }}#
- lint
#{{- end }}#
#{{- range $action, $_ := .Config.extraTests }}#
- #{{ $action }}#
#{{- end }}#
runs-on: #{{ .Config.runner.default }}#
steps:
- uses: guibranco/github-status-action-v2@0849440ec82c5fa69b2377725b9b7852a3977e76
with:
authToken: ${{secrets.GITHUB_TOKEN}}
# Write an explicit status check called "Sentinel" which will only pass if this code really runs.
# This should always be a required check for PRs.
context: 'Sentinel'
description: 'All required checks passed'
state: 'success'
# Write to the PR commit SHA if it's available as we don't want the merge commit sha,
# otherwise use the current SHA for any other type of build.
sha: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: guibranco/github-status-action-v2@0849440ec82c5fa69b2377725b9b7852a3977e76
with:
authToken: ${{secrets.GITHUB_TOKEN}}
# Write an explicit status check called "Sentinel" which will only pass if this code really runs.
# This should always be a required check for PRs.
context: "Sentinel"
description: "All required checks passed"
state: "success"
# Write to the PR commit SHA if it's available as we don't want the merge commit sha,
# otherwise use the current SHA for any other type of build.
sha: ${{ github.event.pull_request.head.sha || github.sha }}

test:
if: github.event_name == 'repository_dispatch' ||
Expand All @@ -102,128 +102,123 @@ jobs:
env:
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
steps:
#{{- if .Config.freeDiskSpaceBeforeTest }}#
# Run as first step so we don't delete things that have just been installed
- name: Free Disk Space (Ubuntu)
uses: #{{ .Config.actionVersions.freeDiskSpace }}#
with:
tool-cache: false
swap-storage: false
#{{- end }}#
- name: Checkout Repo
uses: #{{ .Config.actionVersions.checkout }}#
with:
ref: ${{ env.PR_COMMIT_SHA }}
#{{- if .Config.checkoutSubmodules }}#
submodules: #{{ .Config.checkoutSubmodules }}#
#{{- end }}#
- name: Checkout p/examples
if: matrix.testTarget == 'pulumiExamples'
uses: #{{ .Config.actionVersions.checkout }}#
with:
repository: pulumi/examples
path: p-examples
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, pulumicli, go, node, dotnet, python, java
- name: Download bin
uses: ./.github/actions/download-bin
- run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Download SDK
uses: ./.github/actions/download-sdk
with:
language: ${{ matrix.language }}
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Install Python deps
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
#{{- if .Config.docker }}#
- name: Run docker compose
run: docker compose -f testing/docker-compose.yml up --build -d
#{{- end }}#
#{{- if .Config.aws }}#
- name: Configure AWS Credentials
uses: #{{ .Config.actionVersions.configureAwsCredentials }}#
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 7200
role-session-name: #{{ .Config.provider }}#@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
#{{- end }}#
#{{- if .Config.gcp }}#
- name: Authenticate to Google Cloud
uses: #{{ .Config.actionVersions.googleAuth }}#
with:
service_account: ${{ env.GOOGLE_CI_SERVICE_ACCOUNT_EMAIL }}
workload_identity_provider: projects/${{ env.GOOGLE_PROJECT_NUMBER
}}/locations/global/workloadIdentityPools/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_POOL }}/providers/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_PROVIDER }}
- name: Setup gcloud auth
uses: #{{ .Config.actionVersions.setupGcloud }}#
with:
install_components: gke-gcloud-auth-plugin
#{{- end }}#
#{{- if .Config.gcpRegistry }}#
- name: Login to Google Cloud Registry
run: gcloud --quiet auth configure-docker
#{{- end }}#
#{{- if .Config.sshPrivateKey }}#
- name: Setup SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: #{{ .Config.sshPrivateKey }}#
#{{- end }}#
#{{- if .Config.integrationTestProvider }}#
- name: Prepare upstream code
run: make upstream
#{{- end }}#
#{{- if index .Config "setup-script" }}#
- name: Run setup script
run: #{{ index .Config "setup-script" }}#
#{{- end }}#
- name: Install dependencies
run: make install_${{ matrix.language}}_sdk
- name: Install gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
#{{- if .Config.integrationTestProvider }}#
- name: Run provider tests
if: matrix.testTarget == 'local'
working-directory: provider
run: go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
#{{- end }}#
- name: Run tests
if: matrix.testTarget == 'local'
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -skip TestPulumiExamples -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Run pulumi/examples tests
if: matrix.testTarget == 'pulumiExamples'
run: cd examples && go test -v -json -count=1 -cover -timeout 2h -tags=${{
matrix.language }} -run TestPulumiExamples -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
#{{- if .Config.freeDiskSpaceBeforeTest }}#
# Run as first step so we don't delete things that have just been installed
- name: Free Disk Space (Ubuntu)
uses: #{{ .Config.actionVersions.freeDiskSpace }}#
with:
tool-cache: false
swap-storage: false
#{{- end }}#
- name: Checkout Repo
uses: #{{ .Config.actionVersions.checkout }}#
with:
ref: ${{ env.PR_COMMIT_SHA }}
#{{- if .Config.checkoutSubmodules }}#
submodules: #{{ .Config.checkoutSubmodules }}#
#{{- end }}#
#{{- if .Config.testPulumiExamples }}#
- name: Checkout p/examples
uses: #{{ .Config.actionVersions.checkout }}#
with:
repository: pulumi/examples
path: p-examples
#{{- end }}#
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
tools: pulumictl, pulumicli, go, node, dotnet, python, java
- name: Download bin
uses: ./.github/actions/download-bin
- run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Download SDK
uses: actions/download-artifact@v4
with:
name: sdk.tar.gz
path: ${{ github.workspace}}
- name: UnTar SDK folder
run: tar -zxf ${{ github.workspace}}/sdk.tar.gz -C ${{github.workspace}}/sdk
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Install Python deps
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
#{{- if .Config.docker }}#
- name: Run docker compose
run: docker compose -f testing/docker-compose.yml up --build -d
#{{- end }}#
#{{- if .Config.aws }}#
- name: Configure AWS Credentials
uses: #{{ .Config.actionVersions.configureAwsCredentials }}#
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 7200
role-session-name: #{{ .Config.provider }}#@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
#{{- end }}#
#{{- if .Config.gcp }}#
- name: Authenticate to Google Cloud
uses: #{{ .Config.actionVersions.googleAuth }}#
with:
service_account: ${{ env.GOOGLE_CI_SERVICE_ACCOUNT_EMAIL }}
workload_identity_provider: projects/${{ env.GOOGLE_PROJECT_NUMBER
}}/locations/global/workloadIdentityPools/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_POOL }}/providers/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_PROVIDER }}
- name: Setup gcloud auth
uses: #{{ .Config.actionVersions.setupGcloud }}#
with:
install_components: gke-gcloud-auth-plugin
#{{- end }}#
#{{- if .Config.gcpRegistry }}#
- name: Login to Google Cloud Registry
run: gcloud --quiet auth configure-docker
#{{- end }}#
#{{- if .Config.sshPrivateKey }}#
- name: Setup SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: #{{ .Config.sshPrivateKey }}#
#{{- end }}#
#{{- if .Config.integrationTestProvider }}#
- name: Prepare upstream code
run: make upstream
#{{- end }}#
#{{- if index .Config "setup-script" }}#
- name: Run setup script
run: #{{ index .Config "setup-script" }}#
#{{- end }}#
- name: Install dependencies
run: make install_sdks
- name: Install gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v2.5.0
#{{- if .Config.actions.preTest }}#
#{{ .Config.actions.preTest | toYaml | indent 4 }}#
#{{- end }}#
#{{- if .Config.integrationTestProvider }}#
- name: Shard provider tests
working-directory: provider
run: go run github.com/blampe/shard --total ${{ strategy.job-total }} --index ${{ strategy.job-index }} > tests
- name: Run provider tests
working-directory: provider
run: xargs go test -v -json -count=1 -cover -timeout 2h -tags=all -parallel 4 {} < tests 2>&1 | tee /tmp/gotest.log | gotestfmt
#{{- end }}#
- name: Shard tests
working-directory: examples
run: go run github.com/blampe/shard --total ${{ strategy.job-total }} --index ${{ strategy.job-index }} > tests
- name: Run tests
working-directory: examples
run: xargs go test -v -json -count=1 -cover -timeout 2h -tags=all -parallel 4 {} < tests 2>&1 | tee /tmp/gotest.log | gotestfmt
strategy:
fail-fast: false
matrix:
language:
- nodejs
- python
- dotnet
- go
- java
#{{- if .Config.testPulumiExamples }}#
testTarget: [local, pulumiExamples]
#{{- else }}#
testTarget: [local]
#{{- end }}#
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
license_check:
name: License Check
uses: ./.github/workflows/license.yml
Expand All @@ -235,7 +230,7 @@ name: run-acceptance-tests
on:
pull_request:
paths-ignore:
- CHANGELOG.md
- CHANGELOG.md
repository_dispatch:
types:
- run-acceptance-tests-command
- run-acceptance-tests-command
Loading
Loading