-
Notifications
You must be signed in to change notification settings - Fork 301
/
Makefile
49 lines (39 loc) · 2.1 KB
/
Makefile
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
.PHONY: clean test test-docker install release docs
PROJECT_NAME ?= twilio_twilio-csharp
SONAR_SOURCES ?= /d:sonar.exclusions=src/Twilio/Rest/**/*.*,test/Twilio.Test/**/*.*
clean:
dotnet clean
install:
@dotnet --version || (echo "Dotnet is not installed, please install Dotnet CLI"; exit 1);
dotnet restore
test:
dotnet build -c Release
dotnet test -c Release --filter TestCategory!="ClusterTest"
test-docker:
docker build -t twilio/twilio-csharp .
docker run twilio/twilio-csharp /bin/bash -c "dotnet build -c Release; dotnet test -c Release --filter TestCategory!=\"ClusterTest\""
release:
dotnet pack -c Release
docs:
doxygen Doxyfile
API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
CURRENT_TAG=$(shell expr "${GITHUB_TAG}" : ".*-rc.*" >/dev/null && echo "rc" || echo "latest")
docker-build:
docker build -t twilio/twilio-csharp .
docker tag twilio/twilio-csharp twilio/twilio-csharp:${GITHUB_TAG}
docker tag twilio/twilio-csharp twilio/twilio-csharp:apidefs-${API_DEFINITIONS_SHA}
docker tag twilio/twilio-csharp twilio/twilio-csharp:${CURRENT_TAG}
docker-push:
docker push twilio/twilio-csharp:${GITHUB_TAG}
docker push twilio/twilio-csharp:apidefs-${API_DEFINITIONS_SHA}
docker push twilio/twilio-csharp:${CURRENT_TAG}
cover:
# TODO: /d:sonar.coverage.exclusions is a temporary fix for new code files to be ignored from coverage report
dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.coverage.exclusions=src/Twilio/JWT/AccessToken/TaskRouterGrant.cs /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml"
# Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines
dotnet build Twilio.sln > buildsonar.log
dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov
dotnet sonarscanner end /d:sonar.token="${SONAR_TOKEN}"
cache:
directories:
- '$HOME/.sonar/cache'