-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
155 lines (146 loc) · 7.04 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
image:
- macos-bigsur
- Ubuntu1604
- Visual Studio 2015
platform:
- x86
environment:
access_token:
secure: Me2UWjTL1G91AfTT9ruasivTMxtSO0SZbv3wIFRS2RygMiZhU8r9sSQ3a9QB7h70wnl2W2Cv8o1v0Z2hONpltyxKxlSP4OqXeIIIx0ssRMgg8rkm2qlDWcCzZur3tM4v
matrix:
fast_finish: true
cache:
- ../windows-build
- ../Development-Binaries
skip_commits:
files:
- doc/*
- '**/*.md'
- '**/*.txt'
before_build:
- ps: |
Write-Output "Building repo '$env:APPVEYOR_REPO_NAME' branch: $env:APPVEYOR_REPO_BRANCH"
$platform = uname -s
if ($platform -eq 'Linux') {
sudo apt-get update -yqqm
sudo apt-get install -ym gcc libpcap-dev libvdeplug-dev libpcre3-dev libedit-dev libsdl2-dev libpng-dev libsdl2-ttf-dev
} else {
if ($platform -eq 'Darwin') {
$env:HOMEBREW_NO_AUTO_UPDATE=1; brew install vde pcre libedit sdl2 libpng zlib sdl2_ttf make git-lfs
}
}
git lfs install
build_script:
- cmd: |
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
echo Building with %NUMBER_OF_PROCESSORS% processors
cd "Visual Studio Projects" & vcbuild /M%NUMBER_OF_PROCESSORS% /useenv /rebuild simh.sln "Release|Win32" & cd ..
- ps: |
if ($isWindows) {
$platform = 'Windows'
$arch = 'Win32'
$commit_id_file = 'Visual Studio Projects\.git-commit-id.h'
} else {
$platform = uname -s
$arch = arch
if ($platform -eq 'Linux') {
$ncpus = nproc
$parallel = '-j' + $ncpus
Write-Host "Building with $ncpus processors"
} else {
$platform = 'macOS'
}
$commit_id_file = '.git-commit-id'
make QUIET=1 $parallel
}
on_success:
- ps: |
$id_line = Select-String -Path $commit_id_file -Pattern 'SIM_GIT_COMMIT_ID'
$id = $id_line.Line.SubString($id_line.line.IndexOf("SIM_GIT_COMMIT_ID") + 18, 8)
$datetime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
$version_major = (Select-String -Path 'sim_rev.h' -Pattern '#define\s+SIM_MAJOR\s+(\d+)').Matches.Groups[1].Value
$version_minor = (Select-String -Path 'sim_rev.h' -Pattern '#define\s+SIM_MINOR\s+(\d+)').Matches.Groups[1].Value
$version_mode = (Select-String -Path 'sim_rev.h' -Pattern '#define\s+SIM_VERSION_MODE\s+"(.+?)"').Matches.Groups[1].Value
- git config --global credential.helper store
- ps: Set-Content -Path "$HOME\.git-credentials" -Value "https://$($env:access_token):[email protected]`n" -NoNewline
- git config --global credential.helper store
- git config --global user.email "[email protected]"
- git config --global user.name "Mark Pizzolato"
- git config --global core.autocrlf false
# Linux & macOS use the shell to address this, Windows uses cmd. Poweshell on Windows doesn't like git output to stderr
- sh: |
if test -d ../Development-Binaries
then
pushd ../Development-Binaries
git pull origin master
popd
else
pushd ..
git clone -q "https://github.com/simh/Development-Binaries" Development-Binaries
popd
fi
- cmd: |
if NOT EXIST ..\Development-Binaries pushd .. & git clone -q "https://github.com/simh/Development-Binaries" Development-Binaries & popd
pushd ..\Development-Binaries & git pull origin master & popd
- ps: |
cd ../Development-Binaries
$pkg_filename = "simh-$datetime-$platform-$arch-$version_major.$version_minor-$version_mode-$id"
if ($isWindows) {
$pkg_filename = $pkg_filename + '.zip'
Compress-Archive -Path $env:APPVEYOR_BUILD_FOLDER\BIN\NT\Win32-Release\*.exe -DestinationPath "$pkg_filename"
} else {
$pkg_filename = $pkg_filename + '.tgz'
pushd $env:APPVEYOR_BUILD_FOLDER/BIN
tar -cvzf ../../Development-Binaries/$pkg_filename --exclude=buildtools --exclude=NT '--exclude=*-build' *
popd
}
"$platform Build results for simh Commit: https://github.com/simh/simh/commit/$id" | Out-File -FilePath ../pkg_commit_message -Encoding Ascii
(Get-Content README.md) -replace ('(\['+$platform+' is here\]\(https\:\/\/github\.com\/simh\/Development-Binaries\/blob\/master\/)([a-zA-Z0-9._-]+)(.+\.)'),('$1'+$pkg_filename+'$3') | Out-File -FilePath README.md -Encoding Ascii
$recent_saved_commit = git log -1 --grep="$platform Build" --pretty=format:%H
$recent_saved_commit_time = git log -1 --pretty="%at" $recent_saved_commit
$oneweek=$((60 * 60 * 24 * 7))
# Only update the https://github.com/simh/DevelopmentBinaries repository
# during CI/CD processing of direct commits pushed to the
# https://github.com/simh/simh repository (i.e. don't update the
# DevelopmentBinaries when CI/CD actions are being done on external
# pull requests.
# Additionally, only update the https://github.com/simh/DevelopmentBinaries
# repository if the current build for this platform is one week or more
# from the last saved build for this platform in the repository
if (((Get-Date -UFormat %s) -gt $recent_saved_commit_time + $oneweek) -and
("$env:APPVEYOR_REPO_NAME" -eq "simh/simh") -and
("$env:APPVEYOR_REPO_BRANCH" -eq "master")) {
("$platform Build") | Out-File -FilePath ../Save-Build-Results
}
Write-Output "Building repo '$env:APPVEYOR_REPO_NAME' branch: $env:APPVEYOR_REPO_BRANCH"
if (("$env:APPVEYOR_REPO_NAME" -ne "simh/simh") -or
("$env:APPVEYOR_REPO_BRANCH" -ne "master")) {
Write-Output "Skipping Saving binaries for non simh/simh master branch CI build"
} else {
if ((Get-Date -UFormat %s) -lt $recent_saved_commit_time + $oneweek) {
Write-Output "Skipping Saving binaries since the last one was saved " + (([System.DateTimeOffset]::FromUnixTimeSeconds($recent_saved_commit_time)).DateTime).ToString()
}
}
# Linux & macOS use the shell to perform git activities.
# Windows uses cmd. Poweshell on Windows doesn't like git output to stderr
- sh: |
if [ -f ../Save-Build-Results ]
then
git add *
git commit -F ../pkg_commit_message
git push -u origin master
else
# clean up the un-committed pieces so the cache is maintained correctly
git reset --hard
fi
- cmd: |
if EXIST ..\Save-Build-Results git add *
if EXIST ..\Save-Build-Results git commit -F ../pkg_commit_message
if EXIST ..\Save-Build-Results git push -u origin master
rem clean up the un-committed pieces so the cache is maintained correctly
if NOT EXIST ..\Save-Build-Results git reset --hard
notifications:
- provider: Email
to:
on_build_success: false