forked from aws/aws-sam-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor-windows.yml
289 lines (238 loc) · 10.5 KB
/
appveyor-windows.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
version: 1.0.{build}
image: Visual Studio 2019
build: off
clone_folder: C:\source
configuration:
- BuildIntegTesting
- LocalZipTerraformBuildIntegTesting
- LocalZipTerraformBuildInContainerIntegTesting
- S3ZipTerraformBuildIntegTesting
- S3ZipTerraformBuildInContainerIntegTesting
- OtherTerraformBuildIntegTesting
- DeployIntegTesting
- PackageIntegTesting
- DeleteIntegTesting
- SyncIntegTesting
- LocalIntegTesting
# other Integration testing, Dev, regression and smoke testing
- OtherTesting
environment:
AWS_DEFAULT_REGION: us-east-1
SAM_CLI_DEV: 1
# Python uses $TMPDIR envvar to find root of tempdir
TMPDIR: "%TEMP%"
TMP: "%TEMP%"
# MSI Installers only use Py3.7.6. It is sufficient to test with this version here.
PYTHON_HOME: "C:\\Python37-x64"
PYTHON_SCRIPTS: "C:\\Python37-x64\\Scripts"
PYTHON_EXE: "C:\\Python37-x64\\python.exe"
PYTHON_ARCH: "64"
HOME: 'C:\Users\appveyor'
HOMEDRIVE: "C:"
HOMEPATH: 'C:\Users\appveyor'
NOSE_PARAMETERIZED_NO_WARN: 1
AWS_S3: "AWS_S3_TESTING"
AWS_ECR: "AWS_ECR_TESTING"
APPVEYOR_CONSOLE_DISABLE_PTY: true
init:
# Uncomment this for RDP
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" }
- ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" }
- git config --global core.autocrlf false
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- ps: git config --system core.longpaths true
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
install:
# setup make
- "choco install make"
# Make sure the temp directory exists for Python to use.
- ps: "mkdir -Force C:\\tmp"
- "SET PATH=%PYTHON_HOME%;C:\\Ruby27-x64\\bin;%PATH%"
- "echo %PYTHON_HOME%"
- "echo %PATH%"
- "python --version"
- "docker info"
# install Terraform CLI
- "choco install terraform"
- "terraform -version"
# Upgrade setuptools, wheel and virtualenv
- "python -m pip install --upgrade setuptools wheel virtualenv"
# Install AWS CLI Globally via pip3
- "pip install awscli"
# Switch to Docker Linux containers
- ps: Switch-DockerLinux
# Check for git executable
- "git --version"
# Get testing env vars
- ps: "
If (Test-Path env:BY_CANARY){
python -m virtualenv venv_env_vars;
./venv_env_vars/Scripts/pip install boto3;
$test_env_var = ./venv_env_vars/Scripts/python tests/get_testing_resources.py;
$test_env_var_json = ConvertFrom-Json $test_env_var;
$env:CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID = $env:AWS_ACCESS_KEY_ID;
$env:CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY = $env:AWS_SECRET_ACCESS_KEY;
$env:CI_ACCESS_ROLE_AWS_SESSION_TOKEN = $env:AWS_SESSION_TOKEN;
$env:AWS_ACCESS_KEY_ID = $test_env_var_json.accessKeyID;
$env:AWS_SECRET_ACCESS_KEY = $test_env_var_json.secretAccessKey;
$env:AWS_SESSION_TOKEN = $test_env_var_json.sessionToken;
$env:TASK_TOKEN = $test_env_var_json.taskToken;
$env:AWS_S3_TESTING = $test_env_var_json.TestBucketName;
$env:AWS_ECR_TESTING = $test_env_var_json.TestECRURI;
$env:AWS_KMS_KEY = $test_env_var_json.TestKMSKeyArn;
$env:AWS_SIGNING_PROFILE_NAME = $test_env_var_json.TestSigningProfileName;
$env:AWS_SIGNING_PROFILE_VERSION_ARN = $test_env_var_json.TestSigningProfileARN;
}"
# Create new virtual environment with chosen python version and activate it
- "python -m virtualenv venv"
- "venv\\Scripts\\activate"
- "python --version"
# Actually install SAM CLI's dependencies
- 'pip install -e ".[dev]"'
# Install aws cli
- "pip install awscli"
# Echo final Path
- "echo %PATH%"
- "IF DEFINED BY_CANARY ECHO Logging in Public ECR && aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws"
# Final clean up no matter success or failure
on_finish:
- ps: "
If (Test-Path env:BY_CANARY){
$env:AWS_ACCESS_KEY_ID = $env:CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID;
$env:AWS_SECRET_ACCESS_KEY = $env:CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY;
$env:AWS_SESSION_TOKEN = $env:CI_ACCESS_ROLE_AWS_SESSION_TOKEN;
aws stepfunctions send-task-success --task-token \"$env:TASK_TOKEN\" --task-output \"{}\" --region us-west-2;
}"
for:
#Integ testing build, regression
- matrix:
only:
- configuration: BuildIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/buildcmd --ignore tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
# Local ZIP Terraform Build integ testing
- matrix:
only:
- configuration: LocalZipTerraformBuildIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv -n 4 tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndLocalBackend_0 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
# Local ZIP Terraform Build In Container integ testing
- matrix:
only:
- configuration: LocalZipTerraformBuildInContainerIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndLocalBackend_1 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
# S3 ZIP Terraform Build integ testing
- matrix:
only:
- configuration: S3ZipTerraformBuildIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv -n 4 tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndS3Backend_0 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
# S3 ZIP Terraform Build In Container integ testing
- matrix:
only:
- configuration: S3ZipTerraformBuildInContainerIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndS3Backend_1 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
# Other Terraform Build integ testing
- matrix:
only:
- configuration: OtherTerraformBuildIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv -n 4 tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
#Integ testing deploy
- matrix:
only:
- configuration: DeployIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/deploy --json-report --json-report-file=TEST_REPORT-integration-deploy.json"
# Integ testing package
- matrix:
only:
- configuration: PackageIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/package -n 4 --reruns 4 --json-report --json-report-file=TEST_REPORT-integration-package.json"
# Integ testing delete
- matrix:
only:
- configuration: DeleteIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/delete -n 4 --reruns 4 --json-report --json-report-file=TEST_REPORT-integration-delete.json"
# Integ testing sync
- matrix:
only:
- configuration: SyncIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/sync --json-report --json-report-file=TEST_REPORT-integration-sync.json"
#Integ testing local
- matrix:
only:
- configuration: LocalIntegTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-local.json"
#Other testing
- matrix:
only:
- configuration: OtherTesting
test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest --cov samcli --cov-report term-missing --cov-fail-under 94 tests/unit --json-report --json-report-file=TEST_REPORT-unit.json"
- "mypy setup.py samcli tests"
- ps: "pytest -n 4 tests/functional --json-report --json-report-file=TEST_REPORT-functional.json"
- ps: "pytest -vv tests/integration --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-others.json"
- ps: "pytest -vv tests/regression --json-report --json-report-file=TEST_REPORT-regression.json"
# Uncomment for RDP
# on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
artifacts:
- path: './TEST_REPORT*.json'