forked from aws/aws-sam-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor-ubuntu.yml
353 lines (290 loc) · 13.2 KB
/
appveyor-ubuntu.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
version: 1.0.{build}
image:
- Ubuntu2004
configuration:
- BuildIntegTesting
- LocalZipTerraformBuildIntegTesting
- LocalZipTerraformBuildInContainerIntegTesting
- S3ZipTerraformBuildIntegTesting
- S3ZipTerraformBuildInContainerIntegTesting
- OtherTerraformBuildIntegTesting
- DeployIntegTesting
- PackageIntegTesting
- DeleteIntegTesting
- SyncIntegTesting
- LocalIntegTesting
- EndToEndTesting
# other Integration testing, Dev, regression and smoke testing
- OtherTesting
environment:
AWS_DEFAULT_REGION: us-east-1
SAM_CLI_DEV: 1
NODE_VERSION: "14.17.6"
AWS_S3: 'AWS_S3_TESTING'
AWS_ECR: 'AWS_ECR_TESTING'
CARGO_LAMBDA_VERSION: "v0.17.1"
matrix:
- PYTHON_HOME: "$HOME/venv3.7/bin"
PYTHON_VERSION: '3.7'
PYTHON_ARCH: '64'
NOSE_PARAMETERIZED_NO_WARN: 1
INSTALL_PY_38_PIP: 1
INSTALL_PY_39_PIP: 1
INSTALL_PY_310_PIP: 1
APPVEYOR_CONSOLE_DISABLE_PTY: true
- PYTHON_HOME: "$HOME/venv3.8/bin"
PYTHON_VERSION: '3.8'
PYTHON_ARCH: '64'
NOSE_PARAMETERIZED_NO_WARN: 1
INSTALL_PY_37_PIP: 1
INSTALL_PY_39_PIP: 1
INSTALL_PY_310_PIP: 1
APPVEYOR_CONSOLE_DISABLE_PTY: true
- PYTHON_HOME: "$HOME/venv3.9/bin"
PYTHON_VERSION: '3.9'
PYTHON_ARCH: '64'
NOSE_PARAMETERIZED_NO_WARN: 1
INSTALL_PY_37_PIP: 1
INSTALL_PY_38_PIP: 1
INSTALL_PY_310_PIP: 1
APPVEYOR_CONSOLE_DISABLE_PTY: true
install:
# AppVeyor's apt-get cache might be outdated, and the package could potentially be 404.
- sh: "sudo apt-get update"
- sh: "gvm use go1.19"
- sh: "echo $PATH"
- sh: "ls /usr/"
# install latest maven which is compatible with jdk17
- sh: "sudo apt-get -y remove maven"
- sh: "wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.zip -P /tmp"
- sh: "sudo unzip -d /opt/mvn /tmp/apache-maven-*.zip"
- sh: "PATH=/opt/mvn/apache-maven-3.8.8/bin:$PATH"
- sh: "JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
- sh: "PATH=$JAVA_HOME/bin:$PATH"
- sh: "javac -version"
- sh: "java -version"
- sh: "mvn --version"
- sh: "source ${HOME}/venv${PYTHON_VERSION}/bin/activate"
- sh: "rvm use 2.7.2"
- sh: "docker --version"
- sh: "nvm install ${NODE_VERSION}"
- sh: "npm install [email protected] -g"
- sh: "npm -v"
# Install latest gradle
- sh: "sudo apt-get -y remove gradle"
- sh: "wget https://services.gradle.org/distributions/gradle-7.3.1-bin.zip -P /tmp"
- sh: "sudo unzip -d /opt/gradle /tmp/gradle-*.zip"
- sh: "PATH=/opt/gradle/gradle-7.3.1/bin:$PATH"
# Install AWS CLI
- sh: "virtualenv aws_cli"
- sh: "./aws_cli/bin/python -m pip install awscli"
- sh: "PATH=$(echo $PWD'/aws_cli/bin'):$PATH"
- sh: "PATH=$PATH:$HOME/venv3.7/bin:$HOME/venv3.8/bin:$HOME/venv3.9/bin:$HOME/venv3.10/bin"
# update ca-certificates which causes failures with newest golang library
- sh: "sudo apt-get install --reinstall ca-certificates"
# get testing env vars
- sh: "sudo apt install -y jq"
# install Terraform
- sh: "sudo apt update"
- sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`"
- sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp"
- sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip"
- sh: "sudo mv /opt/terraform/terraform /usr/local/bin/"
- sh: "terraform -version"
# install Rust
- sh: "curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL https://sh.rustup.rs | sh -s -- --default-toolchain none -y > /dev/null 2>&1"
- sh: "source $HOME/.cargo/env"
- sh: "rustup toolchain install stable --profile minimal --no-self-update"
- sh: "rustup default stable"
- sh: "rustup target add x86_64-unknown-linux-gnu --toolchain stable"
- sh: "rustup target add aarch64-unknown-linux-gnu --toolchain stable"
- sh: "pip install cargo-lambda==$CARGO_LAMBDA_VERSION"
- sh: "rustc -V"
- sh: "cargo -V"
- sh: "cargo lambda -V"
- sh: "python3.9 -m venv .venv_env_vars"
- sh: ".venv_env_vars/bin/pip install boto3"
- sh: "test_env_var=$(.venv_env_vars/bin/python tests/get_testing_resources.py)"
- sh: '
if [ $? -ne 0 ]; then
echo "get_testing_resources failed. Failed to acquire credentials or test resources.";
false;
fi
'
- sh: 'export CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID'
- sh: 'export CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY'
- sh: 'export CI_ACCESS_ROLE_AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN'
- sh: 'export AWS_ACCESS_KEY_ID=$(echo "$test_env_var" | jq -j ".accessKeyID")'
- sh: 'export AWS_SECRET_ACCESS_KEY=$(echo "$test_env_var" | jq -j ".secretAccessKey")'
- sh: 'export AWS_SESSION_TOKEN=$(echo "$test_env_var" | jq -j ".sessionToken")'
- sh: 'export TASK_TOKEN=$(echo "$test_env_var" | jq -j ".taskToken")'
- sh: 'export AWS_S3_TESTING=$(echo "$test_env_var" | jq -j ".TestBucketName")'
- sh: 'export AWS_ECR_TESTING=$(echo "$test_env_var" | jq -j ".TestECRURI")'
- sh: 'export AWS_KMS_KEY=$(echo "$test_env_var" | jq -j ".TestKMSKeyArn")'
- sh: 'export AWS_SIGNING_PROFILE_NAME=$(echo "$test_env_var" | jq -j ".TestSigningProfileName")'
- sh: 'export AWS_SIGNING_PROFILE_VERSION_ARN=$(echo "$test_env_var" | jq -j ".TestSigningProfileARN")'
# required for RIE with arm64 in linux
- sh: "
if [[ -n $BY_CANARY ]] && [[ -n $DOCKER_USER ]] && [[ -n $DOCKER_PASS ]];
then echo Logging in Docker Hub; echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin registry-1.docker.io;
fi"
- sh: "
if [[ -n $BY_CANARY ]] && [[ -n $DOCKER_USER ]] && [[ -n $DOCKER_PASS ]];
then echo Logging in Docker Hub; echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin;
fi"
- sh: "docker run --rm --privileged multiarch/qemu-user-static --reset -p yes"
# Runs only in Linux, logging Public ECR when running canary and cred is available
- sh: "
if [[ -n $BY_CANARY ]];
then echo Logging in Public ECR; aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws;
fi"
build_script:
- "python -c \"import sys; print(sys.executable)\""
# Final clean up no matter success or failure
on_finish:
# Upload test reports as artifacts
- sh: find "$APPVEYOR_BUILD_FOLDER" -type f -name 'TEST_REPORT-*.json' -print0 | xargs -0 -I '{}' appveyor PushArtifact '{}'
- sh: >
AWS_ACCESS_KEY_ID=$TEST_REPORT_S3_BUCKET_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=$TEST_REPORT_S3_BUCKET_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN=$TEST_REPORT_S3_BUCKET_SESSION_TOKEN
aws s3 cp "$APPVEYOR_BUILD_FOLDER" "s3://$TEST_REPORT_S3_BUCKET_NAME/appveyor/$APPVEYOR_PROJECT_SLUG/$APPVEYOR_BUILD_ID/$APPVEYOR_JOB_ID/" --recursive --exclude "*" --include "TEST_REPORT-*.json" --region us-west-2
# notify task success
- sh: 'export AWS_ACCESS_KEY_ID=$CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID'
- sh: 'export AWS_SECRET_ACCESS_KEY=$CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY'
- sh: 'export AWS_SESSION_TOKEN=$CI_ACCESS_ROLE_AWS_SESSION_TOKEN'
- sh: 'aws stepfunctions send-task-success --task-token "$TASK_TOKEN" --task-output "{}" --region us-west-2'
for:
# Integ testing build
-
matrix:
only:
- configuration: BuildIntegTesting
test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "pip install -e \".[dev]\""
- sh: "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"
# Set JAVA_HOME to java11
- sh: "JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
- sh: "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k test_building_java11_in_process --json-report --json-report-file=TEST_REPORT-integration-buildcmd-java11.json"
# Local ZIP Terraform Build integ testing
-
matrix:
only:
- configuration: LocalZipTerraformBuildIntegTesting
test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "pip install -e \".[dev]\""
- sh: "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:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "pip install -e \".[dev]\""
- sh: "pytest -vv -n 4 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:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "pip install -e \".[dev]\""
- sh: "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:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "pip install -e \".[dev]\""
- sh: "pytest -vv -n 4 tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndS3Backend_1 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
# Other Terraform Build In Container integ testing
-
matrix:
only:
- configuration: OtherTerraformBuildIntegTesting
test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "pip install -e \".[dev]\""
- sh: "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:
- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/deploy -n 4 --reruns 4 --dist=loadgroup --json-report --json-report-file=TEST_REPORT-integration-deploy.json"
# Integ testing package
-
matrix:
only:
- configuration: PackageIntegTesting
test_script:
- "pip install -e \".[dev]\""
- sh: "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:
- "pip install -e \".[dev]\""
- sh: "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:
- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/sync -n 3 --reruns 3 --dist loadscope --json-report --json-report-file=TEST_REPORT-integration-sync.json"
# Integ testing local
-
matrix:
only:
- configuration: LocalIntegTesting
test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "ruff samcli"
- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-local.json"
# End-to-end testing
-
matrix:
only:
- configuration: EndToEndTesting
test_script:
- "pip install -e \".[dev]\""
- sh: "pytest -vv -n 4 --reruns 5 --dist loadscope tests/end_to_end --json-report --json-report-file=TEST_REPORT-end-to-end.json"
# Other testing
-
matrix:
only:
- configuration: OtherTesting
test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""
- "ruff samcli"
# Dev Tests
- "pip install -e \".[dev]\""
- "pytest --cov samcli --cov-report term-missing --cov-fail-under 94 tests/unit --json-report --json-report-file=TEST_REPORT-unit.json"
- "ruff samcli"
- "mypy setup.py samcli tests"
- "pytest -n 4 tests/functional --json-report --json-report-file=TEST_REPORT-functional.json"
- sh: "pytest 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"
- sh: "pytest -vv tests/regression --json-report --json-report-file=TEST_REPORT-regression.json"
- sh: "black --check setup.py tests samcli"
- sh: "pytest -n 4 -vv tests/smoke --json-report --json-report-file=TEST_REPORT-smoke.json"