Skip to content

Commit 77bd8a7

Browse files
committedOct 20, 2018
Tweak the build script
* Separate build, test and package phases We want to run tests before attempting to package * Publish msi only for release branches.
1 parent cd2b0ee commit 77bd8a7

File tree

3 files changed

+52
-16
lines changed

3 files changed

+52
-16
lines changed
 

‎Setup/Build.cmd

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@echo off
2+
3+
cd /d "%~p0"
4+
5+
SET Configuration=%1
6+
IF "%Configuration%"=="" SET Configuration=Release
7+
8+
for /f "tokens=*" %%i in ('hMSBuild.bat -only-path -notamd64') do set msbuild="%%i"
9+
set solution=..\GitExtensions.sln
10+
..\.nuget\nuget.exe update -self
11+
..\.nuget\nuget.exe restore -Verbosity Quiet %solution%
12+
set msbuildparams=/p:Configuration=%Configuration% /t:Rebuild /nologo /v:m
13+
14+
call BuildGitExtNative.cmd %Configuration% Rebuild
15+
IF ERRORLEVEL 1 EXIT /B 1
16+
17+
%msbuild% %solution% /p:Platform="Any CPU" %msbuildparams%
18+
IF ERRORLEVEL 1 EXIT /B 1

‎Setup/BuildInstallers.cmd

-12
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@ cd /d "%~p0"
55
SET Configuration=%1
66
IF "%Configuration%"=="" SET Configuration=Release
77

8-
for /f "tokens=*" %%i in ('hMSBuild.bat -only-path -notamd64') do set msbuild="%%i"
9-
set project=..\GitExtensions.sln
10-
..\.nuget\nuget.exe update -self
11-
..\.nuget\nuget.exe restore -Verbosity Quiet %project%
12-
set msbuildparams=/p:Configuration=%Configuration% /t:Rebuild /nologo /v:m
13-
14-
call BuildGitExtNative.cmd %Configuration% Rebuild
15-
IF ERRORLEVEL 1 EXIT /B 1
16-
17-
%msbuild% %project% /p:Platform="Any CPU" %msbuildparams%
18-
IF ERRORLEVEL 1 EXIT /B 1
19-
208
call MakeInstallers.cmd %Configuration% Rebuild
219
IF ERRORLEVEL 1 EXIT /B 1
2210

‎appveyor.yml

+34-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ environment:
1313
SKIP_PAUSE: TRUE
1414
ARCHIVE_WITH_PDB: TRUE
1515

16+
# Build settings, not to be confused with "before_build" and "after_build".
17+
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
1618
build:
19+
# enable MSBuild parallel builds
20+
parallel: true
21+
# MSBuild verbosity level
1722
verbosity: minimal
1823

1924
cache:
@@ -28,15 +33,14 @@ install:
2833
python set_version_to.py -v %APPVEYOR_BUILD_VERSION% -t %APPVEYOR_BUILD_VERSION%Dev@%APPVEYOR_REPO_COMMIT:~0,5%
2934
cd ..
3035
36+
# to run your custom scripts instead of automatic MSBuild
3137
build_script:
3238
- ps: |
3339
Write-Output "Platform: $env:IdeVersion"
34-
& Setup\BuildInstallers.cmd
40+
& Setup\Build.cmd
3541
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
36-
& Setup\MakePortableArchive.cmd Release %APPVEYOR_BUILD_VERSION%
37-
#Upload a portable archive, not a installer
38-
Get-ChildItem Setup\GitExtensions-Portable-*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
3942
43+
# to run your custom scripts instead of automatic tests
4044
test_script:
4145
- ps: |
4246
$testAssemblies = @(
@@ -62,3 +66,29 @@ test_script:
6266
$codecov_version = $packageConfig.SelectSingleNode('/packages/package[@id="Codecov"]').version
6367
$codecov = "packages\Codecov.$codecov_version\tools\codecov.exe"
6468
&$codecov -f ".\OpenCover.GitExtensions.xml"
69+
70+
# scripts to run after tests
71+
after_test:
72+
- ps: |
73+
& Setup\BuildInstallers.cmd
74+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
75+
& Setup\MakePortableArchive.cmd Release $env:APPVEYOR_BUILD_VERSION
76+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
77+
78+
artifacts:
79+
# upload the generated portable archive only
80+
- path: 'Setup/GitExtensions-Portable-*.zip'
81+
82+
# here we are going to override common configuration
83+
for:
84+
85+
# configuration for all branches starting from "dev-"
86+
# build in Debug mode and deploy locally for testing
87+
-
88+
branches:
89+
only:
90+
- /release\/.*/
91+
92+
artifacts:
93+
# upload the generated installer
94+
- path: 'Setup/GitExtensions-*.msi'

0 commit comments

Comments
 (0)
Please sign in to comment.