pulumi/sdk/dotnet/Makefile

71 lines
2.9 KiB
Makefile
Raw Normal View History

PROJECT_NAME := Pulumi .NET Core SDK
LANGHOST_PKG := github.com/pulumi/pulumi/sdk/v3/dotnet/cmd/pulumi-language-dotnet
PROJECT_PKGS := $(shell go list ./cmd...)
PROJECT_ROOT := $(realpath ../..)
DOTNET_VERSION := $(shell cd ../../ && pulumictl get version --language dotnet)
TESTPARALLELISM := 10
include ../../build/common.mk
# Motivation: running `make TEST_ALL_DEPS= test_all` permits running
# `test_all` without the dependencies.
TEST_ALL_DEPS = install
ensure::
# We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
dotnet restore dotnet.sln
build::
# From the nuget docs:
#
# Pre-release versions are then denoted by appending a hyphen and a string after the patch number.
# Technically speaking, you can use any string after the hyphen and NuGet will treat the package as
# pre-release. NuGet then displays the full version number in the applicable UI, leaving consumers
# to interpret the meaning for themselves.
#
# With this in mind, it's generally good to follow recognized naming conventions such as the
# following:
#
# -alpha: Alpha release, typically used for work-in-progress and experimentation
dotnet clean
dotnet build dotnet.sln /p:Version=${DOTNET_VERSION}
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
install_plugin::
GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
install:: build install_plugin
echo "Copying NuGet packages to ${PULUMI_NUGET}"
[ ! -e "$(PULUMI_NUGET)" ] || rm -rf "$(PULUMI_NUGET)/*"
rm -f $(PULUMI_NUGET)/*.nupkg
2021-01-06 21:13:34 +01:00
find . -name '*${VERSION_PREFIX}*.nupkg' -exec cp -p {} ${PULUMI_NUGET} \;
dotnet_test:: $(TEST_ALL_DEPS)
# include the version prefix/suffix to avoid generating a separate nupkg file
$(RUN_TESTSUITE) dotnet-test dotnet test --no-build --filter --filter FullyQualifiedName\\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
auto_test:: $(TEST_ALL_DEPS)
# include the version prefix/suffix to avoid generating a separate nupkg file
$(RUN_TESTSUITE) auto-dotnet dotnet test --no-build --filter --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
test_fast:: dotnet_test
$(GO_TEST_FAST) ${PROJECT_PKGS}
test_all:: dotnet_test auto_test
$(GO_TEST) ${PROJECT_PKGS}
dist::
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
2020-05-14 05:38:27 +02:00
Ensure that make brew works as expected rather than passing empty version (#6566) Fixes:#6565 As part of #6460, the logic for determing the version of the build was moved to be a dependency on pulumictl. Unfortunately, the homebrew installs use the "make dist" command to build + install Pulumi to the user maching and as that would have a dependency on pulumictl and it not existing on the user machine, it would pass an empty version to the ldflag This then manifested to the user as: ``` ▶ pulumi version warning: A new version of Pulumi is available. To upgrade from version '0.0.0' to '2.22.0', run $ brew upgrade pulumi or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes. ``` We are able to mitigate this behaviour by bringing back the get-version script and using that script as part of the make brew installation We can see that the versions are the same between the 2 different installation techniques ``` make dist <------- uses pulumict DIST: go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=2.24.0-alpha.1616029310+787eb70a" github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet DIST: BUILD: ``` ``` make brew <----- uses the legacy script ▶ make brew BREW: go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=v2.24.0-alpha.1616029310+g787eb70a2" github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet BREW: ``` A full post mortem will be carried out to ensure we mitigate these types of errors going forward and that we are able to better test these types of situations
2021-03-18 03:07:02 +01:00
brew:: BREW_VERSION := $(shell ../../scripts/get-version HEAD)
brew::
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v3/go/common/version.Version=${BREW_VERSION}" ${LANGHOST_PKG}
2020-09-22 01:20:05 +02:00
publish:: build install
echo "Publishing .nupkgs to nuget.org:"
find /opt/pulumi/nuget -name 'Pulumi*.nupkg' \
-exec dotnet nuget push -k ${NUGET_PUBLISH_KEY} -s https://api.nuget.org/v3/index.json {} ';'