-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
source ./codebuild_specs/scripts-windows/shared-scripts-windows.sh | ||
|
||
# export CODEBUILD_SOURCE_VERSION=e1dce3fd6083503048f8d6eec3c09cf1b5d8a007 | ||
loadCache repo-windows $CODEBUILD_SRC_DIR | ||
loadCache .cache-windows $HOME/AppData/Local/Yarn/Cache/v6 | ||
|
||
loadCache verdaccio-cache $CODEBUILD_SRC_DIR/../verdaccio-cache | ||
loadCache all-binaries $CODEBUILD_SRC_DIR/out | ||
loadCacheFile .amplify-pkg-version $CODEBUILD_SRC_DIR/.amplify-pkg-version | ||
loadCacheFile UNIFIED_CHANGELOG.md $CODEBUILD_SRC_DIR/UNIFIED_CHANGELOG.md | ||
|
||
ls $CODEBUILD_SRC_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
source ./codebuild_specs/scripts-windows/shared-scripts-windows.sh | ||
|
||
_install_packaged_cli_win |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# set exit on error to true | ||
set -e | ||
|
||
export MSYS_NO_PATHCONV=1 | ||
export MSYS2_ARG_CONV_EXCL="*" | ||
|
||
export AMPLIFY_DIR=$CODEBUILD_SRC_DIR\\out | ||
export AMPLIFY_PATH=$CODEBUILD_SRC_DIR\\out\\amplify.exe | ||
export NODE_OPTIONS=--max-old-space-size=5120 | ||
|
||
source .circleci/local_publish_helpers_codebuild.sh | ||
source ./codebuild_specs/scripts-windows/shared-scripts-windows.sh | ||
|
||
# source $BASH_ENV | ||
|
||
amplify version | ||
|
||
cd packages/amplify-e2e-tests | ||
|
||
_loadTestAccountCredentials | ||
|
||
retry runE2eTestCb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# set exit on error to true | ||
set -e | ||
|
||
source ./codebuild_specs/scripts-windows/shared-scripts-windows.sh && _saveBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
#!/bin/bash | ||
|
||
# set exit on error to true | ||
set -e | ||
|
||
# The flags address the issue here: https://github.com/boto/botocore/issues/1716 | ||
export MSYS_NO_PATHCONV=1 | ||
export MSYS2_ARG_CONV_EXCL="*" | ||
|
||
# We have custom caching for our CodeBuild pipelines | ||
# which allows us to share caches with jobs in the same batch | ||
|
||
# storeCache <local path> <cache location> | ||
function storeCache { | ||
localPath="$1" | ||
alias="$2" | ||
s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$alias" | ||
echo writing cache to $s3Path | ||
# zip contents and upload to s3 | ||
# if ! (cd $localPath && tar -czf cache.tar . && ls && aws s3 cp cache.tar $s3Path); then | ||
# echo Something went wrong storing the cache. | ||
# fi | ||
if ! (cd $localPath && tar -czf cache.tar . && ls && aws s3 cp cache.tar $s3Path); then | ||
echo Something went wrong storing the cache. | ||
fi | ||
echo done writing cache | ||
cd $CODEBUILD_SRC_DIR | ||
} | ||
function storeCacheFile { | ||
localFilePath="$1" | ||
alias="$2" | ||
s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$alias" | ||
echo writing cache to $s3Path | ||
# zip contents and upload to s3 | ||
if ! (aws s3 cp $localFilePath $s3Path); then | ||
echo Something went wrong storing the cache. | ||
fi | ||
echo done writing cache | ||
cd $CODEBUILD_SRC_DIR | ||
} | ||
# loadCache <cache location> <local path> | ||
function loadCache { | ||
alias="$1" | ||
localPath="$2" | ||
s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$alias" | ||
echo loading cache from $s3Path | ||
# create directory if it doesn't exist yet | ||
mkdir -p $localPath | ||
# check if cache exists in s3 | ||
if ! aws s3 ls $s3Path > /dev/null; then | ||
echo "Cache not found." | ||
exit 0 | ||
fi | ||
# tar --help | ||
# load cache and unzip it | ||
# if ! (cd $localPath && aws s3 cp $s3Path cache.tar && ls && tar -xzkf cache.tar); then | ||
# echo "Something went wrong fetching the cache. Continuing anyway." | ||
# fi | ||
if ! (cd $localPath && aws s3 cp $s3Path - | tar xzkf -); then | ||
echo "Something went wrong fetching the cache. Continuing anyway." | ||
fi | ||
echo done loading cache | ||
cd $CODEBUILD_SRC_DIR | ||
} | ||
function loadCacheFile { | ||
alias="$1" | ||
localFilePath="$2" | ||
s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$alias" | ||
echo loading cache file from $s3Path | ||
# check if cache file exists in s3 | ||
if ! aws s3 ls $s3Path > /dev/null; then | ||
echo "Cache file not found." | ||
exit 0 | ||
fi | ||
# load cache file | ||
if ! (aws s3 cp $s3Path $localFilePath); then | ||
echo "Something went wrong fetching the cache file. Continuing anyway." | ||
fi | ||
echo done loading cache | ||
cd $CODEBUILD_SRC_DIR | ||
} | ||
function _loadTestAccountCredentials { | ||
echo ASSUMING PARENT TEST ACCOUNT credentials | ||
session_id=$((1 + $RANDOM % 10000)) | ||
creds=$(aws sts assume-role --role-arn $TEST_ACCOUNT_ROLE --role-session-name testSession${session_id} --duration-seconds 3600) | ||
if [ -z $(echo $creds | jq -c -r '.AssumedRoleUser.Arn') ]; then | ||
echo "Unable to assume parent e2e account role." | ||
return | ||
fi | ||
echo "Using account credentials for $(echo $creds | jq -c -r '.AssumedRoleUser.Arn')" | ||
export AWS_ACCESS_KEY_ID=$(echo $creds | jq -c -r ".Credentials.AccessKeyId") | ||
export AWS_SECRET_ACCESS_KEY=$(echo $creds | jq -c -r ".Credentials.SecretAccessKey") | ||
export AWS_SESSION_TOKEN=$(echo $creds | jq -c -r ".Credentials.SessionToken") | ||
} | ||
|
||
|
||
|
||
function _lsOut { | ||
ls .. | ||
ls ~ | ||
ls $HOME | ||
ls $HOME/.. | ||
ls $HOME/../.. | ||
} | ||
function _build { | ||
echo Windows Build | ||
yarn run production-build | ||
yarn build-tests | ||
} | ||
function _saveBuild { | ||
_lsOut | ||
storeCache $CODEBUILD_SRC_DIR repo-windows | ||
storeCache $HOME/AppData/Local/Yarn/Cache/v6 .cache-windows | ||
} | ||
function _install_packaged_cli_win { | ||
echo Install Amplify Packaged CLI to PATH | ||
# rename the command to amplify | ||
cd $CODEBUILD_SRC_DIR/out | ||
cp amplify-pkg-win-x64.exe amplify.exe | ||
|
||
echo Move to CLI Binary to already existing PATH | ||
# This is a Hack to make sure the Amplify CLI is in the PATH | ||
|
||
cp $CODEBUILD_SRC_DIR/out/amplify.exe $HOME/AppData/Local/Microsoft/WindowsApps | ||
ls $HOME/AppData/Local/Microsoft/WindowsApps | ||
|
||
# reset working directory | ||
cd $CODEBUILD_SRC_DIR | ||
} | ||
|
||
|
||
function _scanArtifacts { | ||
if ! yarn ts-node .circleci/scan_artifacts_codebuild.ts; then | ||
echo "Cleaning the repository" | ||
git clean -fdx | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# set exit on error to true | ||
set -e | ||
|
||
export MSYS_NO_PATHCONV=1 | ||
export MSYS2_ARG_CONV_EXCL="*" | ||
|
||
export NODE_OPTIONS=--max-old-space-size=4096 | ||
|
||
source shared-scripts.sh | ||
_waitForJobs $CODEBUILD_SRC_DIR/codebuild_specs/wait_windows.json requirePrevJobsToSucceed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: powershell.exe | ||
phases: | ||
build: | ||
commands: | ||
- bash ./codebuild_specs/scripts-windows/load-e2e-cache.sh | ||
- yarn test-ci | ||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |