Skip to content

Commit

Permalink
skip ci
Browse files Browse the repository at this point in the history
  • Loading branch information
sunchunqiang committed Jan 10, 2019
1 parent ad45c3e commit 75da1d8
Show file tree
Hide file tree
Showing 17 changed files with 1,523 additions and 86 deletions.
129 changes: 75 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-27-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- run:
name: build the whole project
command: |
bash gradlew build -x test
buildforrelease:
working_directory: ~/code
docker:
- image: circleci/android:api-27-alpha
Expand All @@ -13,6 +26,15 @@ jobs:
- run:
name: build the whole project
command: bash gradlew build -x test
- run:
name: copy libs
command: |
rootfolder=$(pwd)
python3 CircleciScripts/copylibs.py "$(pwd)" "$(pwd)/lib"
- save_cache:
key: Libs-{{ .Revision }}
paths:
- lib

unittest:
working_directory: ~/code
Expand All @@ -22,20 +44,14 @@ jobs:
JVM_OPTS: -Xmx1024m
steps:
- checkout

- run:
name: test
command : |
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
- run:
name: run unit tests
command: |
currentfolder=$(pwd)
python3 CircleciScripts/run_unittest.py test_results "$currentfolder"
- run:
name : check unit test result
command : bash CircleciScripts/check_test_result.sh test_results

command : bash CircleciScripts/check_test_result.sh test_results
- store_artifacts:
path: test_results

Expand Down Expand Up @@ -75,11 +91,13 @@ jobs:
name: install aws cli
command: |
sudo pip install awscli
- run:
name: download third party libararies
command: |
aws s3 sync s3://android-circleci-payload/third-party/ ./libs
aws s3 cp s3://android-circleci-payload/third-party/third-party.zip third-party.zip
unzip third-party.zip
cp "$ANDROID_HOME/platforms/android-27/android.jar" third-party/android.jar
- run:
name: set version
Expand All @@ -92,9 +110,7 @@ jobs:
name: generate documents
command: |
currentfolder=$(pwd)
python3 CircleciScripts/generatejavadoc.py CircleciScripts/ReleaseConfiguration.json "$currentfolder" build/javadoc libs "$release_version"

python3 CircleciScripts/generatejavadoc.py CircleciScripts/ReleaseConfiguration.json "$currentfolder" build/javadoc third-party "$release_version"
- run:
name: check out gh-pages and preserve old document
command: |
Expand All @@ -107,25 +123,22 @@ jobs:
name: copy new document
command: |
cp -R build/javadoc/* docs/reference/
- run:
name: check out gh-pages
command: |
cp -R build/javadoc/* docs/reference/
- run:
name: check in documents
command: |
git add docs/reference
git rm --cached CircleciScripts/preserveolddocument.sh
git commit -m "AWS SDK for Android $release_version"
git push -q https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git
- save_cache:
key: API-Reference-{{ .Revision }}
paths:
- docs/reference/



tag_doc:
docker:
- image: circleci/android:api-27-alpha
Expand All @@ -144,12 +157,15 @@ jobs:
release_maven:
macos:
xcode: "10.1.0"

steps:
- checkout
- run:
name: install android sdk tools
command: |
HOMEBREW_LOGS=~/homebrew-logs
HOMEBREW_TEMP=~/homebrew-temp
brew update
brew doctor
brew tap caskroom/cask
brew cask install android-sdk
- run:
Expand Down Expand Up @@ -186,13 +202,11 @@ jobs:
unzip -a gpghome.zip
echo "gpghome contents:"
ls gpghome
- run:
name: install maven
command: |
brew update
brew install maven
- run:
name: publish to maven
command: |
Expand All @@ -210,19 +224,27 @@ jobs:
steps:
- checkout
- run:
name: download sdk resource
name: install aws cli
command: |
version=2.10.0
sudo pip install awscli
- run:
name: copy sdk resource
command: |
release_tag=${CIRCLE_TAG}
version=$(echo "$release_tag" | sed 's|.*v\([0-9\.]*\).*|\1|')
sdkversion="aws-android-sdk-$version"
echo "sdkversion=$sdkversion" >> $BASH_ENV
git checkout resource aws-android-sdk
mv aws-android-sdk "$sdkversion"
mkdir -p "$sdkversion"
cp -R resources/* "$sdkversion/"
ls $sdkversion
- restore_cache:
key: Libs-{{ .Revision }}
- run:
name: copy libs
command:
bash gradlew build -x test
rootfolder=$(pwd)
python3 CircleciScripts/copylibs.py "$sdkversion/lib"
command: |
ls /home/circleci/code/lib
mkdir -p "$sdkversion/lib"
cp -R /home/circleci/code/lib/* "$sdkversion/lib"
- restore_cache:
key: API-Reference-{{ .Revision }}
- run:
Expand All @@ -231,21 +253,21 @@ jobs:
mkdir -p "$sdkversion/documentation/javadoc"
cp -R docs/reference/* "$sdkversion/documentation/javadoc"
- run:
name: zip sdk folder
zip -r "$sdkversion.zip" "$sdkversion"
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 "$sdkversion/third-party"
- run:
name: install aws cli
name: zip sdk folder
command: |
sudo pip install awscli
zip -r "$sdkversion.zip" "$sdkversion"
- run:
name: upload to s3
command: |
aws configure --profile android_stage set region us-east-1
echo -e "[android_stage]\naws_access_key_id=${AWS_ACCESS_KEY_ID_ANDROID}\naws_secret_access_key=${AWS_SECRET_ACCESS_KEY_ANDROID}\n" >> ~/.aws/credentials
aws s3 cp "$sdkversion.zip" s3:///mylistname/test --profile android_stage
aws s3 cp "$sdkversion.zip" "s3://mylistname/test/$sdkversion.zip" --profile android_stage
workflows:
version: 2
build_test:
Expand All @@ -254,26 +276,25 @@ workflows:
- unittest:
requires:
- build

# jobs:
# - build:
# filters:
# branches:
# ignore: /.*/
# tags:
# only: /^release_v[0-9]+.[0-9]+.[0-9]+$/

# - unittest:
# requires:
# - build
# filters:
# branches:
# ignore: /.*/
# tags:
# only: /^release_v[0-9]+.[0-9]+.[0-9]+$/
release_sdk:
jobs:
- release_tag:
- buildforrelease:
filters:
branches:
ignore: /.*/
tags:
only: /^release_v[0-9]+.[0-9]+.[0-9]+$/
- unittest:
requires:
- buildforrelease
filters:
branches:
ignore: /.*/
tags:
only: /^release_v[0-9]+.[0-9]+.[0-9]+$/
- release_tag:
requires:
- unittest
filters:
branches:
ignore: /.*/
Expand All @@ -291,7 +312,7 @@ workflows:

- release_javadoc:
requires:
- release_maven
- release_tag
filters:
branches:
ignore: /.*/
Expand Down
6 changes: 6 additions & 0 deletions .circleci/version: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
jobs:
build:
branches:
ignore:
- gh-pages
29 changes: 15 additions & 14 deletions CircleciScripts/copylibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
root = sys.argv[1]
dest = sys.argv[2]
if not os.path.exists(dest):
os.makedirs(dest)
os.makedirs(dest)
modules = getmodules(root)
print(modules)
for module in modules:
print(module)
jarfile = os.path.join(root,module,"build/libs/{0}.jar".format(module))
if os.path.isfile(jarfile) :
destfile = os.path.join(dest, "{0}.jar".format(module))
copyfile(jarfile, destfile)
else:
aarfile = os.path.join(root,module,"build/outputs/aar/{0}-release.aar".format(module))
if os.path.isfile(aarfile) :
destfile = os.path.join(dest, "{0}.aar".format(module))
copyfile(aarfile, destfile)
else:
print("Did not find build result for {0}".format(module))
exit(1)
print(module)
jarfile = os.path.join(root,module,"build/libs/{0}.jar".format(module))
if os.path.isfile(jarfile) :
destfile = os.path.join(dest, "{0}.jar".format(module))
copyfile(jarfile, destfile)
else:
aarfile = os.path.join(root,module,"build/outputs/aar/{0}-release.aar".format(module))
if os.path.isfile(aarfile) :
destfile = os.path.join(dest, "{0}.aar".format(module))
copyfile(aarfile, destfile)
print("copied {0} to {1}".format(aarfile, destfile))
else:
print("Did not find build result for {0}".format(module))
exit(1)

4 changes: 2 additions & 2 deletions CircleciScripts/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

TestType = namedtuple('TestType', ['value', 'testAction', 'displayString'])
class TestTypes(Enum):
UnitTest = TestType(1, 'test', 'unit test')
UnitTest = TestType(1, 'test -PexcludeTests=**/*IntegrationTest.class', 'unit test')
integration = TestType(2, 'connectedAndroidTest', 'integration test')
@property
def displayString(self):
Expand Down Expand Up @@ -51,7 +51,7 @@ def runtest(module, testtype, results):
print("Running {0} for {1} .......".format(testtype.displayString, module))
exit_code = runcommand(testcommand)
if exit_code != 0 :
print("unit test failed for {0}".format(module))
print("test failed for {0}".format(module))
dest = "{0}/{1}".format(results, module)
runcommand("mkdir {0} ".format(dest))
source = "{0}/build/reports/*".format(module)
Expand Down
9 changes: 7 additions & 2 deletions CircleciScripts/generatejavadoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ def printset(s):
print(e)

def getJARs(root, libs):
sourthpath =os.path.join(root , libs , "*.jar")
return glob.glob(sourthpath)

jars=[]
for path, subdirs, files in os.walk(os.path.join(root, libs)):
for name in files:
if (name.endswith(".jar")):
jars.append(os.path.join(path, name))
return jars


def copylib(root, modules, target):
Expand Down
25 changes: 11 additions & 14 deletions CircleciScripts/run_unittest.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
from functions import runcommand
from functions import runtest
from functions import TestTypes
from functions import getmodules
import sys
import re
import os

with open("settings.gradle") as f:
lines = f.readlines()
# you may also want to remove whitespace characters like `\n` at the end of each line
testmodules = []
for line in lines:
m = re.match(".*':(.*).*'", line)
if m is not None:
testmodules.append(m.group(1))
else:
print(line)
test_results = sys.argv[1]
root = sys.argv[2]
print(root)
testmodules = getmodules(root)


# testmodules = [
Expand All @@ -29,9 +24,11 @@
# ]


test_results = sys.argv[1]

runcommand("rm -rf {0}".format(test_results))
runcommand("mkdir {0}".format(test_results))
for module in testmodules:
if runtest(module, TestTypes.UnitTest, test_results) != 0 :
exit(1)
testfolder = os.path.join(root, module, "src/test")
if (os.path.isdir(testfolder)):
if runtest(module, TestTypes.UnitTest, test_results) != 0 :
exit(1)
Loading

0 comments on commit 75da1d8

Please sign in to comment.