generated from saltstack-formulas/template-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.appveyor.yml
216 lines (200 loc) · 9.37 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
---
version: "1.0.{build}"
skip_tags: true
environment:
matrix:
# Linux job
# https://www.appveyor.com/docs/linux-images-software/
- job_name: Lint Tests (salt-lint, yamllint, rubocop, shellcheck, powershell-script-analyzer and commitlint)
job_group: Lint Tests
appveyor_build_worker_image: Ubuntu
# Windows jobs
# https://www.appveyor.com/docs/windows-images-software/
- job_name: Chef Inspec Tests (Windows Server 2019)
job_depends_on: Lint Tests
job_group: Chef Inspec Tests
appveyor_build_worker_image: Visual Studio 2019
- job_name: Chef Inspec Tests (Windows Server 2016)
job_depends_on: Lint Tests
job_group: Chef Inspec Tests
appveyor_build_worker_image: Visual Studio 2017
- job_name: Chef Inspec Tests (Windows Server 2012 R2)
job_depends_on: Lint Tests
job_group: Chef Inspec Tests
appveyor_build_worker_image: Visual Studio 2015
- job_name: On-Premise Chef Inspec Test Results (Windows 10 Build 1909)
local_kitchen_suite_platform: py3-windows-10-1909
job_depends_on: Chef Inspec Tests
job_group: Mock Chef Inspec Tests
appveyor_build_worker_image: Visual Studio 2019
- job_name: On-Premise Chef Inspec Test Results (Windows 10 Build 1903)
local_kitchen_suite_platform: py3-windows-10-1903
job_depends_on: Chef Inspec Tests
job_group: Mock Chef Inspec Tests
appveyor_build_worker_image: Visual Studio 2019
- job_name: On-Premise Chef Inspec Test Results (Windows 10 Build 1809)
local_kitchen_suite_platform: py3-windows-10-1809
job_depends_on: Chef Inspec Tests
job_group: Mock Chef Inspec Tests
appveyor_build_worker_image: Visual Studio 2019
- job_name: On-Premise Chef Inspec Test Results (Windows 10 Build 1803)
local_kitchen_suite_platform: py3-windows-10-1803
job_depends_on: Chef Inspec Tests
job_group: Mock Chef Inspec Tests
- job_name: On-Premise Chef Inspec Test Results (Windows 10 Build 1709)
local_kitchen_suite_platform: py3-windows-10-1709
job_depends_on: Chef Inspec Tests
job_group: Mock Chef Inspec Tests
appveyor_build_worker_image: Visual Studio 2019
- job_name: Release
appveyor_build_worker_image: Ubuntu
job_depends_on: Lint Tests, Chef Inspec Tests, Mock Chef Inspec Tests
MAINTAINER_TOKEN: ${GH_TOKEN}
matrix:
fast_finish: true
for:
- matrix:
only:
- job_group: Lint Tests
build_script:
- sh: echo build_script for $APPVEYOR_JOB_NAME
- sh: ./scripts/appveyor_tools.sh -f get-sysinfo
- sh: PATH=$PATH:/home/appveyor/.local/bin
- sh: ./scripts/appveyor_tools.sh -f test -i
test_script:
- sh: echo test_script for $APPVEYOR_JOB_NAME
- sh: ./scripts/appveyor_tools.sh -f test -t yamllint || error=true
- sh: ./scripts/appveyor_tools.sh -f test -t salt-lint || error=true
- sh: ./scripts/appveyor_tools.sh -f test -t powershell-script-analyzer || error=true
- sh: ./scripts/appveyor_tools.sh -f test -t rubocop || error=true
- sh: ./scripts/appveyor_tools.sh -f test -t shellcheck || error=true
- sh: ./scripts/appveyor_tools.sh -f test -t commitlint </dev/null || error=true
- sh: ./scripts/appveyor_tools.sh -f output-sysinfo
- sh: if [ $error ]; then exit 1; fi
# $host.SetShouldExit(1)
deploy: off
- matrix:
only:
- job_depends_on: Lint Tests
build_script:
- ps: Write-Host "build_script for $env:APPVEYOR_JOB_NAME"
# Saltstack needs to see the CI environment variable when run through test kitchen proxy driver
- ps: if (Test-Path env:CI) {[System.Environment]::SetEnvironmentVariable("CI", $Env:CI, "Machine")}
- ps: >
if (Test-Path env:WIN10DSC_USER_ADMIN_PASSWORD)
{[System.Environment]::SetEnvironmentVariable("WIN10DSC_USER_ADMIN_PASSWORD",
$Env:WIN10DSC_USER_ADMIN_PASSWORD, "Machine")}
# - ps: if ($env:CI -imatch 'True') {write-host 'IS CI'} else {write-host 'IS NOT CI'}
# - ps: ./scripts/appveyor_tools.ps1 -function sysinfo
- ps: $ErrorActionPreference = "Stop";
- ps: ./scripts/appveyor_tools.ps1 -function setup -program test-kitchen
- ps: >
./scripts/appveyor_tools.ps1 -function uninstall -program apps-saltstack-will-install |
Select-String -Pattern 'True', 'False' -NotMatch
- ps: c:\opscode\chefdk\bin\chef.bat exec bundle install
- ps: c:\opscode\chefdk\bin\chef.bat exec kitchen list
- ps: $ErrorActionPreference = "Continue";
- ps: mkdir c:\results
# - ps: if ($LastExitCode -ne 0) {write-host "last exit code $LastExitCode"; $host.SetShouldExit($LastExitCode)}
test_script:
- ps: Write-Host "test_script for $env:APPVEYOR_JOB_NAME"
- ps: c:\opscode\chefdk\bin\chef.bat exec kitchen test
deploy: off
on_failure:
- ps: >
if (Test-Path "c:\results\salt_minion.log" -PathType Leaf)
{ Get-Content "c:\results\salt_minion.log" }
- ps: >
if (Test-Path ".kitchen/logs/py3-windows.log" -PathType Leaf)
{ Get-Content ".kitchen/logs/py3-windows.log" }
on_finish:
- ps: Write-Host "on_finish for $env:APPVEYOR_JOB_NAME"
# uncomment to debug
# - ps: ./scripts/appveyor_tools.ps1 -function setup -program rdp
- ps: ./scripts/appveyor_tools.ps1 -function submit -results inspec_tests
- matrix:
only:
- job_depends_on: Chef Inspec Tests
branches:
only:
- master
build_script:
- ps: Write-Host "build_script for $env:APPVEYOR_JOB_NAME"
- ps: $ErrorActionPreference = "Stop";
- ps: $env:local_kitchen_results = "c:\projects\windows-formula\test\results"
- ps: $env:local_kitchen_results_log = "$env:local_kitchen_results\$env:local_kitchen_suite_platform.log"
- ps: >
$env:local_kitchen_results_xml =
"$env:local_kitchen_results\$env:local_kitchen_suite_platform.inspec.results.xml"
# git rev-list --left-right --count $(git rev-parse --abbrev-ref HEAD)...
# b8624e80f282c0c06e7d069d6395414cd1abefd7 | awk '{print "Behind "$1" - Ahead "$2""}'
- ps: >
$test_results_commit_id = get-content $env:local_kitchen_results_log |
Select-String 'CURRENT BRANCH COMMIT ID' -Context 0,1 | ForEach-Object { Write-Output $_.Context.PostContext}
- ps: >
$test_results_exit_code = get-content $env:local_kitchen_results_log |
Select-String 'KITCHEN TEST EXIT CODE' -Context 0,1 | ForEach-Object { Write-Output $_.Context.PostContext}
- ps: $current_branch = $(git rev-parse --abbrev-ref HEAD)
- ps: >
$behind = git rev-list --left-right --count $current_branch...$test_results_commit_id | %{ $_.Split()[0]; }
- ps: >
if ($behind -gt 1) {write-output "THESE TEST RESULTS MAY BE OUT OF DATE. THEY ARE FROM COMMIT ID
$test_results_commit_id WHICH IS $behind COMMITS BEHIND THE HEAD OF THE CURRENT BRANCH $current_branch"}
- ps: >
if (Test-Path "$env:local_kitchen_results_log" -PathType Leaf)
{
Write-Host "OUTPUTTING ON PREMISE TEST KITCHEN RESULTS FOR $env:local_kitchen_suite_platform"
Get-Content "$env:local_kitchen_results_log"
}
Else { Write-Host "NO LOCAL RESULTS. $env:local_kitchen_results_log DOES NOT EXIST." }
- ps: >
if (Test-Path "$env:local_kitchen_results_xml" -PathType Leaf)
{ Copy-Item "$env:local_kitchen_results_xml" "$env:local_kitchen_results\appveyor-windows.xml" }
else
{ Copy-Item "$env:local_kitchen_results\formats\xml_error.template"
"$env:local_kitchen_results\appveyor-windows.xml" }
test: off
deploy: off
on_finish:
- ps: Write-Host "on_finish for $env:APPVEYOR_JOB_NAME"
# uncomment to debug
# - ps: ./scripts/appveyor_tools.ps1 -function setup -program rdp
- ps: ./scripts/appveyor_tools.ps1 -function submit -results inspec_tests
- ps: >
if (Get-Variable 'test_results_exit_code' -Scope Global -ErrorAction 'Ignore')
{
write-output "last exit code $test_results_exit_code";
if ($test_results_exit_code -ne 0)
{
write-output "test failed"
# $host.SetShouldExit($test_results_exit_code -as [int])
exit ($test_results_exit_code -as [int])
}
}
- matrix:
only:
- job_name: Release
- job_depends_on: Lint Tests, Chef Inspec Tests, Mock Chef Inspec Tests
branches:
only:
- master
build_script:
- sh: echo build_script for $APPVEYOR_JOB_NAME on branch $APPVEYOR_REPO_BRANCH
- sh: go get github.com/myii/maintainer
- sh: nvm use stable
- sh: >
npm i -D semantic-release/changelog>[email protected]
semantic-release/exec>[email protected] semantic-release/git>[email protected]
deploy_script:
# - sh: if [ "$APPVEYOR_REPO_BRANCH" == "master" ]; then npx semantic-release>[email protected]; fi
- sh: maintainer contributor
- sh: npx semantic-release
# - sh: npm i -D @semantic-release/changelog@3 @semantic-release/exec@3
# @semantic-release/git@7 semantic-release@>=15.8.0
# - sh: npx [email protected]
# - sh: npm i
# deploy:
# provider: Script
# sh: npx semantic-release
# # sh: if [ "$APPVEYOR_REPO_BRANCH" == "master" ]; then npx [email protected]; fi
test: off