From 88d23acc9a23c03995e5413a78624c7d40fde162 Mon Sep 17 00:00:00 2001 From: Min Bi Date: Tue, 15 Jan 2019 19:39:16 -0800 Subject: [PATCH] remove extras --- .circleci/config.yml | 166 ++++++++++++++----------------- CircleciScripts/maven_release.sh | 6 -- 2 files changed, 72 insertions(+), 100 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9a5012d08cd..04e33384639 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2.1 commands: configure_aws: description: >- - install aws cli and configure android aws release profile + install aws cli and configure android aws release profile steps: - run: name: install aws cli @@ -16,29 +16,29 @@ commands: aws configure --profile android_sdk_release set region us-east-1 echo -e "[android_sdk_release]\naws_access_key_id=${AWS_ACCESS_KEY_ID_ANDROID}\naws_secret_access_key=${AWS_SECRET_ACCESS_KEY_ANDROID}\n" >> ~/.aws/credentials - set_enviroment_vairables: + set_enviroment_variables: description: >- set environment variables steps: - run: - name: set environment variables + name: set environment variables command: | sdkName=aws-android-sdk echo "export sdkName=$sdkName" >> $BASH_ENV release_bucket=${RELEASE_BUCKET} - echo "export release_bucket=$release_bucket" >> $BASH_ENV + echo "export release_bucket=$release_bucket" >> $BASH_ENV release_tag=${CIRCLE_TAG} echo "export release_tag=$release_tag" >> $BASH_ENV - release_version=$(echo "$release_tag" | sed 's|.*v\([0-9\.]*\).*|\1|') - echo "export release_version=$release_version" >> $BASH_ENV + release_version=$(echo "$release_tag" | sed 's|.*v\([0-9\.]*\).*|\1|') + echo "export release_version=$release_version" >> $BASH_ENV sdkNameWithVersion="$sdkName-$release_version" echo "export sdkNameWithVersion=$sdkNameWithVersion" >> $BASH_ENV - release_type=$(echo "$release_tag" | sed 's|\(.*\)_v\([0-9\.]*\).*|\1|') + release_type=$(echo "$release_tag" | sed 's|\(.*\)_v\([0-9\.]*\).*|\1|') echo "export release_type=$release_type" >> $BASH_ENV jobs: @@ -53,7 +53,7 @@ jobs: - run: name: build the whole project command: | - echo "id=${android_distribution_id}" + echo "id=${android_distribution_id}" bash gradlew build -x test buildforrelease: @@ -85,22 +85,22 @@ jobs: JVM_OPTS: -Xmx1024m steps: - checkout - - set_enviroment_vairables + - set_enviroment_variables - run: name: run unit tests command: | python3 CircleciScripts/run_unittest.py "~/test_results" "$(pwd)" - run: - name : check unit test result + name : check unit test result command : | echo "testresult=$testresult" - if [ "$testresult" == "0" ] + if [ "$testresult" == "0" ] then echo "test succeed!" else echo "There are test failures" exit 1 - fi + fi - store_artifacts: path: "~/test_results" @@ -110,30 +110,30 @@ jobs: - image: circleci/golang:1.11 steps: - checkout - - set_enviroment_vairables + - set_enviroment_variables - run: name: install github-release - command: go get github.com/aktau/github-release + command: go get github.com/aktau/github-release - run: name: release the tag command: | tagdescription=$(sed -n "/## \[Release $release_version\]/,/## \[Release [0-9]*\.[0-9]*\.[0-9]\]/p" CHANGELOG.md | sed '1d' | sed '$d') - echo "$tagdescription" | github-release release -s ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t $release_tag --name "$tagname" -d - + echo "$tagdescription" | github-release release -s ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t $release_tag --name "$tagname" -d - release_javadoc: docker: - image: circleci/android:api-27-alpha environment: - JVM_OPTS: -Xmx3200m + JVM_OPTS: -Xmx3200m steps: - - checkout - - set_enviroment_vairables - - run: + - checkout + - set_enviroment_variables + - run: name: install python3-pip command: | sudo apt-get update sudo apt-get -y install python3-pip - - run: + - run: name: install json parser command: sudo pip3 install demjson - run: @@ -141,7 +141,7 @@ jobs: command: | sudo pip install awscli - run: - name: download third party libararies + name: download third party libararies command: | aws s3 cp s3://android-circleci-payload/third-party/third-party.zip third-party.zip unzip third-party.zip @@ -168,76 +168,63 @@ jobs: git add docs/reference git rm --cached CircleciScripts/preserve_olddocument.sh git commit -m "AWS SDK for Android $release_version" - if [ "$release_type" == "release" ] + if [ "$release_type" == "release" ] then - git push -q https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git + git push -q https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git else echo "skip checkin API reference" zip -r docs.zip docs - fi - + fi - store_artifacts: - path: "docs.zip" - + path: "docs.zip" - save_cache: key: API-Reference-{{ .Revision }} paths: - docs/reference/ - - - tag_doc: - docker: - - image: circleci/android:api-27-alpha - environment: - JVM_OPTS: -Xmx3200m - steps: - - checkout - - set_enviroment_vairables - run: name: Add documentation tags to gh-pages command: | git config --local user.name "${GITHUB_USER}" git checkout gh-pages - if [ "$release_type" == "release" ] + if [ "$release_type" == "release" ] then - git tag -a "docs_v$release_version" -m "Add documentation tags to version $release_version" + git tag -a "docs_v$release_version" -m "Add documentation tags to version $release_version" else - git tag -a "beta_docs_v$release_version" -m "Add documentation tags to version $release_version" - fi + git tag -a "beta_docs_v$release_version" -m "Add documentation tags to version $release_version" + fi - - git push --tags -q https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git + git push --tags -q https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git release_maven: - macos: + macos: xcode: "10.1.0" # Xcode version number does not matter here, we just need a MacOS image steps: - - checkout + - checkout - configure_aws - - set_enviroment_vairables + - set_enviroment_variables - run: name: Install Android SDK tools command: | HOMEBREW_LOGS=~/homebrew-logs - HOMEBREW_TEMP=~/homebrew-temp + HOMEBREW_TEMP=~/homebrew-temp brew update - brew doctor + brew doctor brew tap caskroom/cask brew cask install android-sdk - run: name: Install Android build tools command: | - sudo yes | /usr/local/bin/sdkmanager "platforms;android-21" "platforms;android-27" "build-tools;27.0.1" "extras;google;m2repository" "extras;android;m2repository" + sudo yes | /usr/local/bin/sdkmanager "platforms;android-21" "platforms;android-27" "build-tools;27.0.1" "extras;google;m2repository" "extras;android;m2repository" /usr/local/bin/sdkmanager --update - run: name: Install GPG command: | - brew install gnupg + brew install gnupg - run: name: Install Maven command: | - brew install maven + brew install maven - run: name: Set environment variables command: | @@ -248,7 +235,7 @@ jobs: echo "Home: ${HOME}" echo "JAVA_HOME: $JAVA_HOME" echo "ANDROID_HOME: $ANDROID_HOME" - echo "PATH: $PATH" + echo "PATH: $PATH" echo 'export ANDROID_PLATFORM="27"' >> $BASH_ENV echo 'export ANDROID_BUILDTOOL_VERSION="27.0.1"' >> $BASH_ENV - run: @@ -262,33 +249,33 @@ jobs: echo "${HOME}" echo "$JAVA_HOME" echo "$ANDROID_HOME" - echo "$M2_HOME" + echo "$M2_HOME" bash CircleciScripts/maven_release.sh mkdir m2 - cp -r ${HOME}/.m2/* m2 + cp -r ${HOME}/.m2/com/amazonaws/* m2 - store_artifacts: path: m2 # - run: # name: upload to maven # command: | - # python3 CircleciScripts/s3_maven.py "$(pwd)" $release_version android_sdk_release "$release_bucket/com/amazonaws" + # python3 CircleciScripts/s3_maven.py "$(pwd)" $release_version android_sdk_release "$release_bucket/com/amazonaws" release_s3: docker: - image: circleci/android:api-27-alpha environment: - JVM_OPTS: -Xmx1024m + JVM_OPTS: -Xmx1024m steps: - - checkout + - checkout - configure_aws - - set_enviroment_vairables + - set_enviroment_variables - run: name: Copy SDK resource files command: | mkdir -p "$sdkNameWithVersion" python3 CircleciScripts/copy_resourcefiles.py "$(pwd)" "$(pwd)/$sdkNameWithVersion" - restore_cache: - key: Libs-{{ .Revision }} + key: Libs-{{ .Revision }} - run: name: Copy libs command: | @@ -302,18 +289,18 @@ jobs: mkdir -p "$sdkNameWithVersion/documentation/javadoc" cp -R docs/reference/* "$sdkNameWithVersion/documentation/javadoc" - run: - name: copy third party + name: copy third party command: | aws s3 cp s3://android-circleci-payload/third-party/third-party.zip third-party.zip unzip third-party.zip - mv third-party "$sdkNameWithVersion/third-party" + mv third-party "$sdkNameWithVersion/third-party" - run: name: zip sdk folder command: | zip -r "$sdkNameWithVersion.zip" "$sdkNameWithVersion" - - run: + - run: name: copy zip file command: | mkdir -p sdkfiles @@ -324,91 +311,82 @@ jobs: name: check current release release_type command: | - if [ "$release_type" == "release" ] + if [ "$release_type" == "release" ] then - echo "" + echo "" else echo "skip upload to s3" circleci step halt - fi + fi - run: name: upload to s3 command: | - aws s3 cp "$sdkNameWithVersion.zip" "s3://$release_bucket/$sdkNameWithVersion.zip" --profile android_sdk_release - aws s3 cp "$sdkNameWithVersion.zip" "s3://$release_bucket/latest/$sdkName.zip" --profile android_sdk_release + aws s3 cp "$sdkNameWithVersion.zip" "s3://$release_bucket/$sdkNameWithVersion.zip" --profile android_sdk_release + aws s3 cp "$sdkNameWithVersion.zip" "s3://$release_bucket/latest/$sdkName.zip" --profile android_sdk_release - run: name: invalidate cloudfront command: | python3 CircleciScripts/cloudfront_invalidate.py android_sdk_release "${android_distribution_id}" "$sdkName.zip" - + workflows: version: 2 build_test: - jobs: - - build + jobs: + - build - unittest: requires: - - build + - build release_sdk: jobs: - buildforrelease: filters: branches: - ignore: /.*/ + ignore: /.*/ tags: only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ - unittest: - requires: - - buildforrelease filters: branches: - ignore: /.*/ + ignore: /.*/ tags: only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ - release_maven: - filters: - branches: - ignore: /.*/ - tags: - only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ - - - release_javadoc: requires: - - unittest + - unittest filters: branches: - ignore: /.*/ + ignore: /.*/ tags: only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ - - tag_doc: + - release_javadoc: requires: - - release_javadoc + - unittest filters: branches: - ignore: /.*/ + ignore: /.*/ tags: only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ - - release_s3: + - release_s3: requires: - - release_javadoc + - release_javadoc - release_maven filters: branches: - ignore: /.*/ + ignore: /.*/ tags: only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ - - release_tag: + - release_tag: requires: - - release_s3 + - release_s3 filters: branches: - ignore: /.*/ + ignore: /.*/ tags: - only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ + only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/ \ No newline at end of file diff --git a/CircleciScripts/maven_release.sh b/CircleciScripts/maven_release.sh index d327f692669..1f39a3a1cbd 100644 --- a/CircleciScripts/maven_release.sh +++ b/CircleciScripts/maven_release.sh @@ -6,8 +6,6 @@ export PATH=$ANDROID_HOME/tools:$PATH export PATH=$ANDROID_HOME/platform-tools:$PATH export PATH=$ANDROID_HOME:$PATH - - pom="pom.xml" settings="CircleciScripts/mvhome/settings.xml" localrepo="${HOME}/.m2" @@ -19,13 +17,9 @@ sonatype_password=${SonatypePassword} gpg_keyname=${GpgKeyname} gpg_passphrase="${GpgPassphrase}" -find $currentdir | grep 'src/main/jniLibs\$' | sed 's/jniLibs/jni/1' | xargs -I {} mv {}Libs {} -find $currentdir - # Perm gen space is increased for maven command MAVEN_OPTS="-Xms1024m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=1024m" - mvn clean deploy -X -e -Ppublishing \ -f "$pom" \ --settings="${currentdir}/CircleciScripts/mvnhome/settings.xml" \