forked from schismtracker/schismtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
131 lines (108 loc) · 4.88 KB
/
appveyor.yml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
environment:
matrix:
- arch: x86_64
bits: 64
- arch: i686
bits: 32
install:
- ps: |
[Environment]::SetEnvironmentVariable("MSYS2_PATH_TYPE", "inherit", "Machine")
$arch = $env:Arch
$bits = $env:Bits
$msys = "msys$bits"
$mingw = "mingw$bits"
$mingwUpper = $mingw.ToUpper()
$buildFolder = $env:APPVEYOR_BUILD_FOLDER
$posixBuildFolder = $buildFolder -Replace '\\', '/'
$env:PATH="C:\$msys\$mingw\bin;C:\$msys\usr\bin;$env:PATH"
function bash($command, $dieOnError = $true) {
""
Write-Host $command
& "C:\$msys\usr\bin\sh.exe" --login -c "MSYSTEM=$mingwUpper . /etc/profile && cd $posixBuildFolder && $command"
if ($LASTEXITCODE -eq 0) {
Write-Host "'$command' succeeded. While its output might be red, it exited with '0'." -ForegroundColor Green
} else {
Write-Host "'$command' failed with exit code $LASTEXITCODE! " -ForegroundColor Red -NoNewline
if ($dieOnError) {
Write-Host "Exiting." -ForegroundColor Red
exit $LASTEXITCODE
} else {
"Continuing."
}
}
}
# 32-bit MSYS2 is not offered on AppVeyor yet, so we need to install it.
if ($arch -eq "i686") {
Write-Host "Installing 32-bit MSYS2..." -ForegroundColor Cyan
# download installer
$zipPath = "$($env:USERPROFILE)\msys2-i686-latest.tar.xz"
$tarPath = "$($env:USERPROFILE)\msys2-i686-latest.tar"
"Downloading MSYS2 installation package..."
(New-Object Net.WebClient).DownloadFile('http://repo.msys2.org/distrib/msys2-i686-latest.tar.xz', $zipPath)
Write-Host "Unzipping $zipPath..."
7z x $zipPath -y -o"$env:USERPROFILE" | Out-Null
Write-Host "Untaring $tarPath to C:\msys32\..."
7z x $tarPath -y -oC:\ | Out-Null
del $zipPath
del $tarPath
Write-Host "32-bit MSYS2 installed" -ForegroundColor Green
bash "pacman --sync --noconfirm --needed pacman pacman-mirrors"
bash "pacman --sync --noconfirm --needed VCS"
bash "pacman --sync --noconfirm --needed base-devel"
bash "pacman --sync --noconfirm --needed msys2-devel"
bash "pacman --sync --noconfirm --needed mingw-w64-$arch-toolchain"
}
bash "pacman --sync --noconfirm --needed mingw-w64-$arch-SDL"
build_script:
- ps: |
bash "autoreconf --install --include=/$mingw/share/aclocal/"
bash "./configure"
bash "make"
xcopy C:\$msys\$mingw\bin\SDL.dll .\
if ($arch -eq "i686") {
xcopy C:\$msys\$mingw\bin\libgcc_s_dw2-1.dll .\
xcopy C:\$msys\$mingw\bin\libwinpthread-1.dll .\
}
test_script:
- ps: |
$exe = "$buildFolder\schismtracker.exe"
if (Test-Path $exe) {
Write-Host "'$exe' exists. Continuing." -ForegroundColor Green
} else {
Write-Host "'$exe' does not exist. Exiting." -ForegroundColor Red
exit 1
}
Start-Process -Wait -FilePath $exe -ArgumentList '--version'
$result = Get-Content "stdout.txt"
if ($result -Match 'Schism Tracker') {
Write-Host "'$exe --version' output 'Schism Tracker'. Success!" -ForegroundColor Green
} elseif ([string]::IsNullOrWhiteSpace($result)) {
Write-Host "'$exe --version' did not output anything. It might be damaged." -ForegroundColor Red
exit 1
} else {
Write-Host "'$exe --version' did not output 'Schism Tracker' as expected. The result was:" -ForegroundColor Red
Write-Host $result -ForegroundColor Red
exit 1
}
on_failure:
- dir /s /b > dir.txt
- if exist "stdout.txt" 7z a -tzip schismtracker_debug_logs.zip "stdout.txt" > nul
- if exist "stderr.txt" 7z a -tzip schismtracker_debug_logs.zip "stderr.txt" > nul
- if exist "dir.txt" 7z a -tzip schismtracker_debug_logs.zip "dir.txt" > nul
- if exist "config.log" 7z a -tzip schismtracker_debug_logs.zip "config.log" > nul
- if exist "configure.ac" 7z a -tzip schismtracker_debug_logs.zip "configure.ac" > nul
- if exist "configure" 7z a -tzip schismtracker_debug_logs.zip "configure" > nul
- if exist "C:\msys%bits%\mingw%bits%\bin\sdl-config" 7z a -tzip schismtracker_debug_logs.zip "C:\msys%bits%\mingw%bits%\bin\sdl-config" > nul
on_finish:
- if exist "schismtracker_debug_logs.zip" appveyor PushArtifact "schismtracker_debug_logs.zip"
- if exist "schismtracker.exe" 7z a -tzip schismtracker.zip "schismtracker.exe" > nul
- if exist "SDL.dll" 7z a -tzip schismtracker.zip "SDL.dll" > nul
- if exist "libgcc_s_dw2-1.dll" 7z a -tzip schismtracker.zip "libgcc_s_dw2-1.dll" > nul
- if exist "libwinpthread-1.dll" 7z a -tzip schismtracker.zip "libwinpthread-1.dll" > nul
- if exist "schismtracker.zip" appveyor PushArtifact "schismtracker.zip"
artifacts:
- path: '*.zip'
notifications:
on_build_success: false
on_build_failure: false
on_build_status_changed: true