22#
33version : 2.1
44commands :
5+ quit_for_nominorversion :
6+ description : >-
7+ If current release is not a minor version bump, stop executing the current job and return success.
8+ steps :
9+ - run :
10+ name : skip left steps and return immediately from current job if current release is not a minor version bump
11+ command : |
12+ echo $release_version
13+ maintenance=$(echo $release_version | sed "s/[0-9]*.[0-9]*.\([0-9]*\)/\1/")
14+ echo $maintenance
15+ if [ "$maintenance" != "0" ]; then
16+ echo "This is not minor version bump release, so marking this step successful"
17+ circleci step halt
18+ fi
19+
520 configure_aws :
621 description : >-
722 install aws cli and configure android aws release profile
@@ -41,22 +56,91 @@ commands:
4156 release_type=$(echo "$release_tag" | sed 's|\(.*\)_v\([0-9\.]*\).*|\1|')
4257 echo "export release_type=$release_type" >> $BASH_ENV
4358
44- jobs :
45- build :
46- working_directory : ~/code
47- docker :
48- - image : circleci/android:api-27-alpha
49- environment :
50- JVM_OPTS : -Xmx3200m
59+ setup_emulator :
60+ description : >-
61+ setup emulator
5162 steps :
52- - checkout
5363 - run :
54- name : build the whole project
64+ name : Setup emulator
65+ command : |
66+ sdkmanager "system-images;android-24;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-24;default;armeabi-v7a"
67+ - run :
68+ name : Launch emulator
69+ command : export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -no-boot-anim -no-window -accel auto -verbose
70+ background : true
71+ - run :
72+ name : Launch logcat
73+ command :
74+ adb logcat > logcat.log
75+ background : true
76+ - run :
77+ name : Wait emulator
78+ command : |
79+ echo "wait for emulator to have booted"
80+ circle-android wait-for-boot
81+ python3 CircleciScripts/unlock_emulatorscreen.py
82+
83+
84+ bump_version_pre :
85+ description : >-
86+ prepare bump version
87+ steps :
88+ - run :
89+ name : checkout repository for bump version
90+ command : |
91+ git config --local user.name "${GITHUB_BUMPVERSION_USER}"
92+ git clone "https://github.com/${GITHUB_BUMPVERSION_USER}/${bumpversion_repo_name}.git"
93+ cd ${bumpversion_repo_name}
94+ git fetch
95+ branches=$(git branch)
96+ if [[ $branches == *"bump_version"* ]]; then
97+ echo "the branch is already pesent"
98+ git checkout bump_version
99+ else
100+ echo "create new branch bump_version"
101+ git checkout -b bump_version
102+ fi
103+ git remote add upstream https://github.com/${bumpversion_repo_user}/${bumpversion_repo_name}
104+ git remote -v
105+ git fetch upstream
106+ git reset --hard upstream/master
107+ echo "push update the branch"
108+ git push --force -q https://${GITHUB_BUMPVERSION_TOKEN}@github.com/${GITHUB_BUMPVERSION_USER}/${bumpversion_repo_name}.git
109+
110+ bump_version_post :
111+ description : >-
112+ check in bump version change
113+ steps :
114+ - run :
115+ name : stage changes
116+ command : |
117+ cd ${bumpversion_repo_name}
118+ git config --local user.name "${GITHUB_BUMPVERSION_USER}"
119+ gitstatus=$(git status)
120+ echo $gitstatus
121+ if [[ $gitstatus == *"Changes not staged for commit:"* ]]; then
122+ git add .
123+ else
124+ echo "No changes for bump version"
125+ circleci step halt
126+ fi
127+ - run :
128+ name : check in changes
55129 command : |
56- echo "id=${android_distribution_id}"
57- bash gradlew build -x test
130+ cd ${bumpversion_repo_name}
131+ git status
132+ git config --local user.name "${GITHUB_BUMPVERSION_USER}"
133+ git commit -m "${bump_version_message}"
134+ git push --force -q https://${GITHUB_BUMPVERSION_TOKEN}@github.com/${GITHUB_BUMPVERSION_USER}/${bumpversion_repo_name}.git
135+ title="${bump_version_pr_title}"
136+ content="${bump_version_message}"
137+ echo "title:$title"
138+ echo "content:$content"
139+ python3 ../CircleciScripts/create_pullrequest.py "${GITHUB_BUMPVERSION_USER}" "${GITHUB_BUMPVERSION_TOKEN}" "$title" "$content" "master" "${GITHUB_BUMPVERSION_USER}:bump_version" ${bumpversion_repo_user} ${bumpversion_repo_name}
58140
59- buildforrelease :
141+
142+ jobs :
143+ build :
60144 working_directory : ~/code
61145 docker :
62146 - image : circleci/android:api-27-alpha
85169 JVM_OPTS : -Xmx1024m
86170 steps :
87171 - checkout
88- - set_enviroment_variables
89172 - run :
90173 name : run unit tests
91174 command : |
@@ -117,6 +200,7 @@ jobs:
117200 - run :
118201 name : release the tag
119202 command : |
203+ tagname="AWS SDK for Android $release_version"
120204 tagdescription=$(sed -n "/## \[Release $release_version\]/,/## \[Release [0-9]*\.[0-9]*\.[0-9]\]/p" CHANGELOG.md | sed '1d' | sed '$d')
121205 echo "$tagdescription" | github-release release -s ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t $release_tag --name "$tagname" -d -
122206
@@ -318,25 +402,194 @@ jobs:
318402 - run :
319403 name : upload to s3
320404 command : |
321- aws s3 cp "$ sdkNameWithVersion.zip" "s3://$release_bucket/ $sdkNameWithVersion.zip" --profile android_sdk_release
322- aws s3 cp "$sdkNameWithVersion.zip" "s3://$release_bucket/ latest/$sdkName.zip" --profile android_sdk_release
405+ aws s3api put-object --bucket "$release_bucket" --key "$ sdkNameWithVersion.zip" --body "$sdkNameWithVersion.zip" --content-disposition "attachment;filename= $sdkNameWithVersion.zip" --acl public-read --profile android_sdk_release
406+ aws s3api put-object --bucket "$release_bucket" --key " latest/$sdkName.zip" --body "$sdkNameWithVersion.zip" --content-disposition "attachment;filename=$sdkNameWithVersion.zip" --acl public-read --profile android_sdk_release
323407 - run :
324408 name : invalidate cloudfront
325409 command : |
326- python3 CircleciScripts/cloudfront_invalidate.py android_sdk_release "${android_distribution_id}" "$sdkName.zip"
410+ python3 CircleciScripts/cloudfront_invalidate.py android_sdk_release "${android_distribution_id}" "latest/$sdkName.zip"
411+
412+ integrationtest :
413+ working_directory : ~/code
414+ docker :
415+ # Android the primary container
416+ - image : circleci/android@sha256:5cdc8626cc6f13efe5ed982cdcdb432b0472f8740fed8743a6461e025ad6cdfc
417+ environment :
418+ JVM_OPTS : -Xmx3200m
419+ steps :
420+ - checkout
421+ - configure_aws
422+ - run :
423+ name : install python3-pip
424+ command : |
425+ sudo apt-get update
426+ sudo apt-get -y install python3-pip
427+ - run :
428+ name : Install json parser
429+ command : sudo pip3 install demjson
430+ - run :
431+ name : Install lxml
432+ command : sudo pip3 install lxml
433+ - run :
434+ name : install sdk
435+ command : |
436+ sudo yes | sdkmanager "platforms;android-27"
437+ - setup_emulator
438+ - run :
439+ name : Configure test information
440+ command : |
441+ aws s3 cp s3://android-circleci-payload/testinformation/testinformation.json testinformation.json
442+ python3 CircleciScripts/replace_testinformation.py $(pwd) testinformation.json
443+ - run :
444+ name : run integration tests
445+ command : |
446+ echo "${ANDROID_TESTS_CREDENTIALS_JSON}" | base64 -di > awsconfiguration.json
447+ python3 CircleciScripts/run_integrationtest.py "~/test_results" "$(pwd)" "$(pwd)/awsconfiguration.json"
448+ - run :
449+ name : check integration test result
450+ command : |
451+ echo "testresult=$testresult"
452+ if [ "$testresult" == "0" ]
453+ then
454+ echo "test succeed!"
455+ else
456+ echo "There are test failures"
457+ exit 1
458+ fi
459+ - store_artifacts :
460+ path : " ~/test_results"
461+ uitest :
462+ working_directory : ~/code
463+ docker :
464+ # Android the primary container
465+ - image : circleci/android@sha256:5cdc8626cc6f13efe5ed982cdcdb432b0472f8740fed8743a6461e025ad6cdfc
466+ environment :
467+ JVM_OPTS : -Xmx3200m
468+ steps :
469+ - checkout
470+ - configure_aws
471+ - run :
472+ name : checkout sample applications
473+ command : |
474+ git clone https://github.com/sunchunqiang/aws-sdk-android-samples.git
475+ - restore_cache :
476+ key : Libs-{{ .Revision }}
477+ - run :
478+ name : copy third party
479+ command : |
480+ aws s3 cp s3://android-circleci-payload/third-party/third-party.zip third-party.zip
481+ unzip third-party.zip
482+ cp third-party/**/*.jar lib/
483+ - run :
484+ name : create aws configure json file
485+ command :
486+ echo "${S3SAMPLE_JSON}" | base64 -di > aws-sdk-android-samples/S3TransferUtilitySample/res/raw/awsconfiguration.json
487+ - run :
488+ name : configure aws dependencies
489+ command : |
490+ python3 CircleciScripts/replace_awsdependencies.py "$(pwd)/aws-sdk-android-samples/S3TransferUtilitySample/build.gradle" "implementation fileTree(dir: '$(pwd)/lib', include: ['*.jar', '*.aar'])"
491+ - setup_emulator
492+ - run :
493+ name : run sample ui test
494+ command : |
495+ cd aws-sdk-android-samples/S3TransferUtilitySample
496+ bash gradlew connectedAndroidTest
497+ - store_artifacts :
498+ path : " aws-sdk-android-samples/S3TransferUtilitySample/build/outputs"
499+ - store_artifacts :
500+ path : " aws-sdk-android-samples/S3TransferUtilitySample/build.gradle"
501+ - store_artifacts :
502+ path : logcat.log
503+
504+ bump_sampleapp_version :
505+ working_directory : ~/code
506+ docker :
507+ - image : circleci/android:api-27-alpha
508+ environment :
509+ JVM_OPTS : -Xmx3200m
510+ steps :
511+ - set_enviroment_variables
512+ - quit_for_nominorversion
513+ - checkout
514+ - run :
515+ name : set_bumpversion_enviroment
516+ command : |
517+ bumpversion_repo_user=awslabs
518+ bumpversion_repo_name=aws-sdk-android-samples
519+ minorversion=$(echo $release_version | sed "s/\([0-9]*.[0-9]*\).[0-9]*/\1/")
520+ echo ${minorversion}
521+ bump_version_message="Update sample apps to use ${minorversion}.+ version of the SDK"
522+ bump_version_pr_title="Bump sample applications versions to ${minorversion}.+"
523+ echo "export bumpversion_repo_user=$bumpversion_repo_user" >> $BASH_ENV
524+ echo "export bumpversion_repo_name=$bumpversion_repo_name" >> $BASH_ENV
525+ echo "export minorversion=$minorversion" >> $BASH_ENV
526+ echo "export bump_version_message='${bump_version_message}'" >> $BASH_ENV
527+ echo "export bump_version_pr_title='${bump_version_pr_title}'" >> $BASH_ENV
528+ echo "bump_version_pr_title:$bump_version_pr_title"
529+ - bump_version_pre
530+ - run :
531+ name : bump version
532+ command :
533+ python3 CircleciScripts/bump_androidsample_version.py "$(pwd)/aws-sdk-android-samples" $release_version
534+ - bump_version_post
535+
536+ bump_applifydocs_version :
537+ working_directory : ~/code
538+ docker :
539+ - image : circleci/android:api-27-alpha
540+ environment :
541+ JVM_OPTS : -Xmx3200m
542+ steps :
543+ - set_enviroment_variables
544+ - quit_for_nominorversion
545+ - checkout
546+ - run :
547+ name : set_bumpversion_enviroment
548+ command : |
549+ bumpversion_repo_user=aws-amplify
550+ bumpversion_repo_name=docs
551+ minorversion=$(echo $release_version | sed "s/\([0-9]*.[0-9]*\).[0-9]*/\1/")
552+ echo ${minorversion}
553+ bump_version_message="Update Android docs to ${release_version}"
554+ bump_version_pr_title="Update Android docs to ${release_version}"
555+ echo "export bumpversion_repo_user=$bumpversion_repo_user" >> $BASH_ENV
556+ echo "export bumpversion_repo_name=$bumpversion_repo_name" >> $BASH_ENV
557+ echo "export minorversion=$minorversion" >> $BASH_ENV
558+ echo "export bump_version_message='${bump_version_message}'" >> $BASH_ENV
559+ echo "export bump_version_pr_title='${bump_version_pr_title}'" >> $BASH_ENV
560+ echo "bump_version_pr_title:$bump_version_pr_title"
561+ - bump_version_pre
562+ - run :
563+ name : bump version
564+ command :
565+ python3 CircleciScripts/bump_amplifydocs_version.py "$(pwd)/${bumpversion_repo_name}/android" $release_version
566+ - bump_version_post
327567
328568workflows :
329569 version : 2
330-
331570 build_test :
332571 jobs :
333572 - build
334- - unittest :
573+ - unittest
574+ - integrationtest :
575+ filters :
576+ branches :
577+ only :
578+ - master
579+ - develop
580+
581+ - uitest :
335582 requires :
336583 - build
584+ filters :
585+ branches :
586+ only :
587+ - master
588+ - develop
589+
337590 release_sdk :
338591 jobs :
339- - buildforrelease :
592+ - build :
340593 filters :
341594 branches :
342595 ignore : /.*/
@@ -370,7 +623,7 @@ workflows:
370623
371624 - release_s3 :
372625 requires :
373- - buildforrelease
626+ - build
374627 - release_javadoc
375628 - release_maven
376629 filters :
@@ -386,4 +639,23 @@ workflows:
386639 branches :
387640 ignore : /.*/
388641 tags :
389- only : /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/
642+ only : /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/
643+ - bump_sampleapp_version :
644+ requires :
645+ - release_tag
646+ filters :
647+ branches :
648+ ignore : /.*/
649+ tags :
650+ only : /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/
651+ - bump_applifydocs_version :
652+ requires :
653+ - release_tag
654+ filters :
655+ branches :
656+ ignore : /.*/
657+ tags :
658+ only : /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/
659+
660+
661+
0 commit comments