forked from eiriktsarpalis/PolyType
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (65 loc) · 2.21 KB
/
Makefile
File metadata and controls
79 lines (65 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
SOURCE_DIRECTORY := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
ARTIFACT_PATH := $(SOURCE_DIRECTORY)artifacts
DOCS_PATH := $(SOURCE_DIRECTORY)docs
CONFIGURATION ?= Release
ADDITIONAL_ARGS ?= -p:ContinuousIntegrationBuild=true
NUGET_SOURCE ?= "https://api.nuget.org/v3/index.json"
NUGET_API_KEY ?= ""
DOCKER_IMAGE_NAME ?= "polytype-docker-build"
DOCKER_CMD ?= make pack
VERSION_FILE = $(SOURCE_DIRECTORY)version.json
VERSION ?= ""
clean:
dotnet clean --configuration $(CONFIGURATION)
rm -rf $(ARTIFACT_PATH)/*
rm -rf $(DOCS_PATH)/api
restore:
dotnet tool restore
dotnet restore
build: restore
dotnet build --no-restore --configuration $(CONFIGURATION) $(ADDITIONAL_ARGS)
test-clr: build
dotnet test \
--configuration $(CONFIGURATION) \
--no-build \
$(ADDITIONAL_ARGS) \
-p:SkipTUnitTestRuns=true \
--report-trx \
--coverage \
--coverage-output-format cobertura \
--crashdump \
--hangdump \
--hangdump-timeout 10m \
--results-directory $(ARTIFACT_PATH)/testResults
test-aot: build
dotnet publish $(SOURCE_DIRECTORY)/tests/PolyType.Tests.NativeAOT/PolyType.Tests.NativeAOT.csproj \
$(ADDITIONAL_ARGS) \
-o $(ARTIFACT_PATH)/native-aot-tests \
&& \
$(ARTIFACT_PATH)/native-aot-tests/PolyType.Tests.NativeAOT
test: test-clr test-aot
pack: build
dotnet pack --no-restore --configuration Release $(ADDITIONAL_ARGS)
push:
dotnet nuget push $(ARTIFACT_PATH)/*.nupkg -s $(NUGET_SOURCE) -k $(NUGET_API_KEY)
generate-docs: restore
dotnet build -c Release
dotnet docfx $(DOCS_PATH)/docfx.json --warningsAsErrors true
serve-docs: generate-docs
dotnet docfx serve $(ARTIFACT_PATH)/_site --port 8080
release: restore
test -n "$(VERSION)" || (echo "must specify VERSION" && exit 1)
git diff --quiet && git diff --cached --quiet || (echo "repo contains uncommitted changes" && exit 1)
dotnet nbgv set-version $(VERSION)
git commit -m "Bump version to $(VERSION)"
dotnet nbgv tag
git push && git push --tags
gh release create "`git describe --tags --abbrev=0`" --generate-notes --verify-tag
docker-build: clean
docker build -t $(DOCKER_IMAGE_NAME) . && \
docker run --rm -t \
-v $(ARTIFACT_PATH):/repo/artifacts \
$(DOCKER_IMAGE_NAME) \
$(DOCKER_CMD)
docker rmi -f $(DOCKER_IMAGE_NAME)
.DEFAULT_GOAL := test