-
Notifications
You must be signed in to change notification settings - Fork 67
/
build-and-test.cmd
50 lines (40 loc) · 1.13 KB
/
build-and-test.cmd
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
@echo off
setlocal
set thisdir=%~dp0
set configuration=Debug
set runtests=true
:parseargs
if "%1" == "" goto argsdone
if /i "%1" == "-c" goto set_configuration
if /i "%1" == "--configuration" goto set_configuration
if /i "%1" == "-notest" goto set_notest
if /i "%1" == "--notest" goto set_notest
echo Unsupported argument: %1
goto error
:set_configuration
set configuration=%2
shift
shift
goto parseargs
:set_notest
set runtests=false
shift
goto parseargs
:argsdone
call "%thisdir%generate-code.cmd"
dotnet restore
if errorlevel 1 goto error
dotnet build --configuration %configuration%
if errorlevel 1 goto error
if /i "%runtests%" == "true" (
dotnet test --configuration %configuration% --no-restore --no-build
if errorlevel 1 goto error
)
dotnet pack --no-restore --no-build --configuration %configuration%
set PACKAGE_COUNT=0
for %%a in ("%thisdir%artifacts\packages\%configuration%\*.nupkg") do set /a PACKAGE_COUNT+=1
if not "%PACKAGE_COUNT%" == "1" echo Expected a single NuGet package but found %PACKAGE_COUNT% at '%thisdir%artifacts\packages\%configuration%' && goto error
goto :eof
:error
echo Error building project.
exit /b 1