-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathappveyor.yml
More file actions
182 lines (150 loc) · 6.24 KB
/
appveyor.yml
File metadata and controls
182 lines (150 loc) · 6.24 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
version: '2.2.{build}'
image:
- Visual Studio 2019
- Ubuntu1804
skip_commits:
files:
- .circleci/*
- '.travis.yml'
- '*.md'
clone_depth: 99999999
dotnet_csproj:
patch: true
file: '**\Version.props'
version: '{version}.%COMMIT_COUNT%'
package_version: '{version}.%COMMIT_COUNT%'
assembly_version: '{version}.%COMMIT_COUNT%'
file_version: '{version}.%COMMIT_COUNT%'
informational_version: '{version}.%COMMIT_COUNT%'
platform: Any CPU
init:
- sh: script=https://raw.githubusercontent.com/devizer/test-and-build/master/install-build-tools-bundle.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash
- sh: |
Say "Memory"
free -m
Say "Mounted Volumes"
df -h -T
Say "All partitions and disks"
sudo fdisk -l
true
- sh: |
Say "Installing .NET Core"
script=https://raw.githubusercontent.com/devizer/test-and-build/master/lab/install-DOTNET.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash
sudo ln -f -s /usr/share/dotnet/dotnet /usr/local/bin/dotnet
dotnet --info
- ps: |
# copy paste it
function Say { param( [string] $message )
Write-Host "$(Get-Elapsed) " -NoNewline -ForegroundColor Magenta
Write-Host "$message" -ForegroundColor Yellow
}
function Get-Elapsed
{
if ($Global:startAt -eq $null) { $Global:startAt = [System.Diagnostics.Stopwatch]::StartNew(); }
[System.String]::Concat("[", (new-object System.DateTime(0)).AddMilliseconds($Global:startAt.ElapsedMilliseconds).ToString("mm:ss"), "]");
}; Get-Elapsed | out-null;
# Display OS and CPU
if ($isWindows) {
$currentVersion=Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
$win_10_release_id = $currentVersion.ReleaseId; if (! $win_10_release_id) { $win_10_release_id = $currentVersion.CurrentBuildNumber }
$win_name = $(Get-WMIObject win32_operatingsystem -EA SilentlyContinue).Caption
Say "$($win_name): Release [$win_10_release_id], powershell [$($PSVersionTable.PSVersion)]"
$cpu=Get-WmiObject Win32_Processor; Say "CPU: $($cpu.Name), $([System.Environment]::ProcessorCount) Cores";
}
#- sh: |
# function header() {
# if [[ $(uname -s) != Darwin ]]; then
# startAt=${startAt:-$(date +%s)}; elapsed=$(date +%s); elapsed=$((elapsed-startAt)); elapsed=$(TZ=UTC date -d "@${elapsed}" "+%_H:%M:%S");
# fi
# LightGreen='\033[1;32m'; Yellow='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'; LightGray='\033[1;2m';
# printf "${LightGray}${elapsed:-}${NC} ${LightGreen}$1${NC} ${Yellow}$2${NC}\n";
# }
# counter=0; function Say() { echo ""; counter=$((counter+1)); header "STEP $counter" "$1"; }; Say "" >/dev/null; counter=0;
#
install:
- ps: '$Env:ARTIFACT = "$($Env:APPVEYOR_BUILD_FOLDER)$([IO.Path]::DirectorySeparatorChar)Artifact"; mkdir $Env:ARTIFACT | out-null; Say "ARTIFACT folder: $($Env:ARTIFACT)"'
- ps: '$Env:SQL_SETUP_LOG_FOLDER = $Env:ARTIFACT; Say "SQL_SETUP_LOG_FOLDER is [$($Env:SQL_SETUP_LOG_FOLDER)]"'
- ps: Start-Transcript "Artifact\Detailed-Build.log" -Force
- git submodule update --init --recursive
- ps: |
$commitsRaw = & { set TZ=GMT; git log -n 999999 --date=raw --pretty=format:"%cd" }
$lines = $commitsRaw.Split([Environment]::NewLine)
$ENV:COMMIT_COUNT = $lines.Length
Say "COMMIT_COUNT: $($ENV:COMMIT_COUNT)"
Say "Install Complete"
# - sh: 'mono --version || true; dotnet --info || true; '
before_build:
- ps: |
# Upgrade-PSReadLine
build_script:
- ps: |
Say "RESTORE and BUILD"
& dotnet restore
#- sh: |
# Say "Remove net 4.8 target for msbuild on linux"
# sed -i 's/net48;//g' Universe.CpuUsage/Universe.CpuUsage.csproj
# # cat Universe.CpuUsage/Universe.CpuUsage.csproj
- ps: |
Say "nuget restore for '$(pwd)'"
& nuget restore -verbosity quiet
#Say "Test using netcoreapp3.0"
#& dotnet test -f netcoreapp3.0 -v n --test-adapter-path:. --logger:Appveyor
pushd Universe.CpuUsage
if ($isWindows) {
Say "Rebuild and pack Release for windows"
& msbuild /t:"rebuild;pack" /p:Configuration=Release /v:q
} else {
Say "Rebuild and pack Release for linux"
& dotnet build -c Release -v q
}
popd
after_build:
test_script:
- ps: |
if ($isWindows) {
Say ".NET Framework Tests"
dotnet build -f net47 -c Debug
pushd "Universe.CpuUsage.Tests\bin\Debug\net47"
nunit3-console Universe.CpuUsage.Tests.dll --workers=1 "--result=Universe.CpuUsage.Tests.Result.xml;format=AppVeyor"
popd
}
- ps: |
Say ".NET Core Tests"
pushd Universe.CpuUsage.Tests
if ($isWindows) {
dotnet test -f netcoreapp3.0 -c Release --test-adapter-path:. --logger:Appveyor -- NUnit.NumberOfTestWorkers=1
} else {
dotnet test -f netcoreapp3.0 -c Release --test-adapter-path:. --logger:Appveyor -- NUnit.NumberOfTestWorkers=1
}
popd
- sh: |
echo "Starting tests using Mono in [$(pwd)]"
pushd Tests4Mono; set +e; source build-the-matrix.sh; echo $matrix_run
# need -e -c
sudo bash -e -c "$matrix_run" || true
popd
- ps: |
Say "Pack working folder as the 'AppVeyor Build Folder.7z' artifact"
& "7z" a -t7z -mx=3 -ms=on "AppVeyor Build Folder.7z" .
Say "Bye-bye"
after_test:
# do not publish nuget to feeds on LINUX
- sh: Say "removing [s]nupkg in $(pwd)"
- sh: shopt -s globstar; rm -f **/*.nupkg; rm -f **/*.snupkg;
- sh: 'find . -name "*.nupkg" -exec bash -c "DELETING {}; rm -f {}" \;'
- sh: 'find . -name "*.snupkg" -exec bash -c "DELETING {}; rm -f {}" \;'
- sh: 'Show-System-Stat || true'
- ps: Stop-Transcript;
# - cmd: bash -c 'time echo "Hello from $(bash --version)"'
nuget:
account_feed: false
project_feed: true
disable_publish_on_pr: true # disable publishing of .nupkg artifacts to account/project feeds for pull request builds
# Error uploading artifact the storage: The underlying connection was closed: An unexpected error occurred on a send.
artifacts:
- path: Artifact
- path: 'AppVeyor Build Folder.7z'
- path: '**\Release\*.nupkg'
- path: '**\Release\*.snupkg'
# on_success:
# - cmd: 'appveyor PushArtifact "Universe.CpuUsage\bin\Any CPU\Release\*.nupkg"'