Skip to content

Makefile migration: make test-automation-sdk #637

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

Draft
wants to merge 1 commit into
base: main
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
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,20 @@ lint::
--path-prefix $(pkg)) \
&&) true

# Test the Automation SDK
test-automation-sdk::
@echo "Testing Pulumi Automation SDK"
$(MAKE) clean-sdk
cd sdk && dotnet restore --no-cache
$(eval SDK_VERSION := $(shell cd pulumi-language-dotnet && grep -oP 'github.com/pulumi/pulumi/sdk/v3 v\K[0-9.]+' go.mod))
cd sdk/Pulumi.Automation.Tests && dotnet test --configuration Release -p:PulumiSdkVersion=$(SDK_VERSION)

# Test the Automation SDK with coverage
test-automation-sdk-coverage::
@echo "Testing Pulumi Automation SDK with coverage"
$(MAKE) clean-sdk
cd sdk && dotnet restore --no-cache
$(eval SDK_VERSION := $(shell cd pulumi-language-dotnet && grep -oP 'github.com/pulumi/pulumi/sdk/v3 v\K[0-9.]+' go.mod))
cd sdk/Pulumi.Automation.Tests && dotnet test --configuration Release -p:PulumiSdkVersion=$(SDK_VERSION) -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../coverage/coverage.pulumi.automation.xml

.PHONY: install build
16 changes: 6 additions & 10 deletions build/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,12 @@ let testPulumiSdk coverage =
then failwith "tests failed"

let testPulumiAutomationSdk coverage =
cleanSdk()
restoreSdk()
match findGoSDKVersion(pulumiLanguageDotnet) with
| None -> failwith "Could not find the Pulumi SDK version in go.mod"
| Some(version) ->
printfn "Testing Pulumi Automation SDK"
let coverageArgs = if coverage then $" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput={coverageDir}/coverage.pulumi.automation.xml" else ""
if Shell.Exec("dotnet", $"test --configuration Release -p:PulumiSdkVersion={version} {coverageArgs}", pulumiAutomationSdkTests) <> 0

then failwith "automation tests failed"
printfn "Deprecated: calling `make test-automation-sdk%s` instead" (if coverage then "-coverage" else "")
let target = if coverage then "test-automation-sdk-coverage" else "test-automation-sdk"
let cmd = Cli.Wrap("make").WithArguments(target).WithWorkingDirectory(repositoryRoot)
let output = cmd.ExecuteAsync().GetAwaiter().GetResult()
if output.ExitCode <> 0 then
failwith "automation tests failed"

let runSpecificIntegrationTest(testName: string) =
buildLanguagePlugin()
Expand Down
Loading