|
| 1 | +#!/bin/bash |
| 2 | +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | +# SPDX-License-Identifier: Apache-2.0. |
| 4 | + |
| 5 | +# This script builds a sample app |
| 6 | +# Directories created and files are prefixed with PREFIX_DIR argument |
| 7 | +# SDK installation is expected to be in ${PREFIX_DIR}/mac-install and a clone of aws-sdk-cpp is expected to be in ${PREFIX_DIR}/aws-sdk-cpp |
| 8 | +# A AWS_ACCOUNT with proper role setup is required to run the built app, if passed argument, app is tried to run after build |
| 9 | +# Platform: Windows |
| 10 | + |
| 11 | +param($PREFIX_DIR) |
| 12 | + |
| 13 | +cd "${PREFIX_DIR}/aws-sdk-cpp/tools/CI/install-test" |
| 14 | +mkdir "${PREFIX_DIR}/sample-build" |
| 15 | +mkdir "${PREFIX_DIR}/sample-install" |
| 16 | +cd "${PREFIX_DIR}/sample-build" |
| 17 | +&'C:\\Program Files\\CMake\\bin\\cmake.exe' ../aws-sdk-cpp/tools/CI/install-test -DCMAKE_CXX_FLAGS="-ggdb -fsanitize=address" -DCMAKE_PREFIX_PATH="${PREFIX_DIR}/win-install" -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}/sample_install" |
| 18 | +&'C:\\Program Files\\CMake\\bin\\cmake.exe' --build . |
| 19 | +&'C:\\Program Files\\CMake\\bin\\cmake.exe' --build . --target install |
| 20 | + |
| 21 | +echo "Setting the run environment" |
| 22 | +$TEST_ASSUME_ROLE_ARN = "arn:aws:iam::${env:AWS_ACCOUNT}:role/IntegrationTest" |
| 23 | +${env:TEST_LAMBDA_CODE_PATH} = "${env:PREFIX_DIR}/aws-sdk-cpp/tests/aws-cpp-sdk-lambda-integration-tests/resources" |
| 24 | +$sts = aws sts assume-role --role-arn "${TEST_ASSUME_ROLE_ARN}" --role-session-name "${env:AWS_ROLE_SESSION_NAME}" --query "Credentials.[AccessKeyId, SecretAccessKey, SessionToken]" |
| 25 | +$sts |
| 26 | +aws configure set aws_access_key_id (${sts}[1] -replace " " -replace "`"" -replace ",") |
| 27 | +aws configure set aws_secret_access_key (${sts}[2] -replace " " -replace "`"" -replace ",") |
| 28 | +aws configure set aws_session_token (${sts}[3] -replace " " -replace "`"" -replace ",") |
| 29 | +aws configure list |
| 30 | +# Run tests |
| 31 | +cd "${PREFIX_DIR}/sample_install" |
| 32 | +app |
0 commit comments