forked from fuzzball-muck/fuzzball
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
160 lines (140 loc) · 7.77 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# See https://www.appveyor.com/docs/build-environment/
image: Visual Studio 2019
version: '{build}'
install:
# Set up Visual Studio build environment, 32-bit output with a 64-bit builder
# > Increment version number when newer version of Visual Studio supported by Appveyor
- cmd: '"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsall.bat" amd64_x86'
# Set up Conan package manager
- cmd: set PATH=%PATH%;%PYTHON%/Scripts/
- cmd: pip.exe install conan
- cmd: conan user # Create conan data directory
- cmd: conan --version
- cmd: choco install doxygen.install
init:
# Set "build version number" to "short-commit-hash" or when tagged to "tag name" (Travis style)
# Thanks to @jakoch and @ronaldbarendse
# Modified to also include the build number, distinguishes rebuilds of the same commit
# See comments on https://github.com/appveyor/ci/issues/691
#
# While it's possible to use 'Update-AppveyorBuild -Version' to change the build number, that
# breaks Github's "Details" link until the build completes. Just change the build output.
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq "true")
{
# Trim any starting 'v' from tags
$env:DEPLOY_IMAGE_NAME = "$($env:APPVEYOR_REPO_TAG_NAME.TrimStart("v"))-$env:APPVEYOR_BUILD_NUMBER"
} else {
$env:DEPLOY_IMAGE_NAME = "dev-$($env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-$env:APPVEYOR_BUILD_NUMBER"
}
function ConvertMarkdownToHtml([String] $InputFile, [String] $OutputDir) {
# Find the filename without path
$filename = Split-Path $InputFile -leaf
# Convert to Markdown
# See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertfrom-markdown
# Convert ".md" links to ".md.htm", ensuring filename starts with a letter/number
# Check if we're running on PowerShell 7 or newer
if ($PSVersionTable.PSVersion -ge [Version]::new(7, 0, 0)) {
# ConvertFrom-Markdown is native
(ConvertFrom-Markdown -Path "$InputFile").Html | % {$_ -replace "<a href=""(\w.*)\.md(#.*)?"">", "<a href=""`$1.md.htm`$2"">"} | Out-File "$OutputDir/$filename.htm"
} else {
# Send to the AppVeyor PowerShell 7 program
# Don't use a PowerShell Script Block as it prevents parameters from being substituted in
& "C:\Program Files\PowerShell\7\pwsh.exe" -Command @"
(ConvertFrom-Markdown -Path ""$InputFile"").Html | % {`$_ -replace ""<a href=""""(\w.*)\.md(#.*)?"""">"", ""<a href=""""```$1.md.htm```$2"""">""} | Out-File ""$OutputDir/$filename.htm""
"@
}
}
build_script:
- ps: |
# Install Conan dependencies for 32-bit (x86) using the local directory's conanfile
conan install . --settings arch=x86
# > For statically-linked OpenSSL, specify: -s compiler="Visual Studio" -s compiler.runtime=MT
# Then modify makefile.win to reference ..MT.lib instead. Dynamic linking is preferred.
# Set up the variables for makefile.win
$env:OUTDIR = "$env:APPVEYOR_BUILD_FOLDER/build"
# Conan.io exports outputs to here, including OpenSSL
$env:PACKAGE_DIR = "$env:APPVEYOR_BUILD_FOLDER/bin"
# Build Fuzzball
# > NMake writes to standard error for the version header when it's not actually an error.
# Treat all output as standard output instead.
# See https://stackoverflow.com/questions/2095088/error-when-calling-3rd-party-executable-from-powershell-when-using-an-ide
cmd /c 'nmake /f %APPVEYOR_BUILD_FOLDER%/makefile.win 2>&1'
# Package and store the build results
# > File name of compressed output
$artifact_name = "fuzzball-win32-$env:DEPLOY_IMAGE_NAME"
# > Folder name stored inside compressed output
# Don't include "...-$env:APPVEYOR_BUILD_VERSION" as that's now part of the artifact name
$artifact_root = "$env:APPVEYOR_BUILD_FOLDER/$artifact_name"
# > Exact filename for compressed output (change extension for different format)
$artifact_zip = "$artifact_name.zip"
$docs_zip = "$artifact_name-docs.zip"
echo "Preparing release artifact..."
mkdir "$artifact_root"
# Copy contents of game folder
cp -Recurse "$env:APPVEYOR_BUILD_FOLDER/game/*" "$artifact_root"
# Remove Unix "restart.in" if copied
if (Test-Path "$artifact_root/restart.in") {
Remove-Item "$artifact_root/restart.in"
}
# Copy starter database folder
cp -Recurse "$env:APPVEYOR_BUILD_FOLDER/dbs" "$artifact_root"
# Copy documentation folders
cp -Recurse "$env:APPVEYOR_BUILD_FOLDER/docs" "$artifact_root"
md "$artifact_root/data/info"
cp "$env:APPVEYOR_BUILD_FOLDER/docs/mpi-intro" "$artifact_root/data/info"
cp "$env:APPVEYOR_BUILD_FOLDER/docs/mpi-intro2" "$artifact_root/data/info"
cp "$env:APPVEYOR_BUILD_FOLDER/docs/muf-tutorial" "$artifact_root/data/info"
cp "$env:APPVEYOR_BUILD_FOLDER/docs/changesfb7" "$artifact_root/data/info"
# Copy source and include folder
cp -Recurse "$env:APPVEYOR_BUILD_FOLDER/src" "$artifact_root"
cp -Recurse "$env:APPVEYOR_BUILD_FOLDER/include" "$artifact_root"
# Copy Windows source
cp -Recurse "$env:APPVEYOR_BUILD_FOLDER/win32" "$artifact_root"
# Copy text help files to data folder
cp "$artifact_root/docs/*.txt" "$artifact_root/data/"
# Copy README files, transforming to Windows line endings
# See https://stackoverflow.com/questions/17579553/windows-command-to-convert-unix-line-endings/17580505#17580505
#
(Get-Content "$env:APPVEYOR_BUILD_FOLDER/README.md") | Set-Content "$artifact_root/README.md.txt"
(Get-Content "$env:APPVEYOR_BUILD_FOLDER/README_WINDOWS.md") | Set-Content "$artifact_root/README_WINDOWS.md.txt"
#
# Also render the Markdown into an HTML file for easier reference
ConvertMarkdownToHtml "$env:APPVEYOR_BUILD_FOLDER/README.md" "$artifact_root"
ConvertMarkdownToHtml "$env:APPVEYOR_BUILD_FOLDER/README_WINDOWS.md" "$artifact_root"
# Copy compiled binaries and libraries
cp -Recurse "$env:APPVEYOR_BUILD_FOLDER/build/*" "$artifact_root"
# Build docs
& "c:\program files\doxygen\bin\doxygen.exe" "$env:APPVEYOR_BUILD_FOLDER/Doxyfile"
# Verify basics and make the archive
if ((Test-Path "$artifact_root/fbmuck.exe") -And (Test-Path "$artifact_root/restart.exe")) {
echo "Packaging release artifact..."
7z a "$artifact_zip" "$artifact_root"
7z a "$docs_zip" "$env:APPVEYOR_BUILD_FOLDER/api-docs"
Push-AppveyorArtifact "$artifact_zip"
Push-AppveyorArtifact "$docs_zip"
echo "Packaging successful!"
} else {
echo "Could not find compiled Fuzzball or related executables, build failed"
Exit 1
}
# Guidance for future maintainers: Powershell versus Windows Command Interpreter
# Environment variables
# > Powershell: $env:NAME
# > cmd: %NAME%
# Quoting
# > Powershell: $env:NAME = "TEST"
# echo "Test message"
# > cmd: set NAME=TEST
# echo Test message
# Running programs with spaces
# > Powershell: & "C:\path to\app.exe" Argument1 Argument2
# > cmd: "C:\path to\app.exe" Argument1 Argument2
# (No difference if without spaces)
# Running programs in current directory
# > Powershell: .\app.exe
# > cmd: app.exe
# Paths
# > Powershell: 'C:/path/to/file' or 'C:\path\to\file'
# > cmd: 'C:\path\to\file' only
# Thanks to TheOneRing (Freenode #quassel, Github) for initial help with setting up Appveyor