Skip to content

Commit

Permalink
Merge pull request #11 from Kevin-Lee/prepare-for-0.0.12
Browse files Browse the repository at this point in the history
Preparation for 0.0.12
  • Loading branch information
kevin-lee committed Jul 5, 2015
2 parents b7d608c + a1f8596 commit 0916cb9
Show file tree
Hide file tree
Showing 18 changed files with 1,353 additions and 118 deletions.
43 changes: 43 additions & 0 deletions .before-deploy.sh
@@ -0,0 +1,43 @@
#!/bin/bash

if [ -n "$1" ]
then
export GIT_TAG="v$1"
else
export GIT_TAG="v$TRAVIS_BUILD_NUMBER"
fi
echo "GIT_TAG=$GIT_TAG"

echo "check: git ls-remote --exit-code --tags origin $GIT_TAG 2>&1 > /dev/null"

if git ls-remote --exit-code --tags origin $GIT_TAG 2>&1 > /dev/null ; then
echo "the given tag: '$GIT_TAG' already exists so skip it!"
else
echo "the given tag: '$GIT_TAG' does not exist so run it!"
git config --global user.email "kevin.code@lckymn.com"
git config --global user.name "Kecin-CI"

git tag $GIT_TAG -a -m "Automatically generated tag by Travis CI for build $TRAVIS_BUILD_NUMBER"
git push git@github.com:Kevin-Lee/j8plus --tags

echo "======================================================"
echo "ls -l target/scala-2.11/j8plus_*.jar"
ls -l target/scala-2.11/j8plus_*.jar
echo "======================================================"
echo "Create a folder to put all the binary files."
echo "------------------------------------------------------"
echo "mkdir -p target/all-bin"
mkdir -p target/all-bin
echo "ls -l target/all-bin"
ls -l target/all-bin

echo "------------------------------------------------------"
echo "cp target/scala-2.11/j8plus_*.jar target/all-bin/"
cp target/scala-2.11/j8plus_*.jar target/all-bin/
echo "------------------------------------------------------"
echo "ls -lR target/all-bin"
ls -lR target/all-bin
echo "------------------------------------------------------"
echo "Copying all binary files to 'target/all-bin': Done!"
echo "======================================================"
fi
23 changes: 23 additions & 0 deletions .build-packages.sh
@@ -0,0 +1,23 @@
#!/bin/bash -e

echo "======================================================"
echo "Build packages"
echo "------------------------------------------------------"

echo ""
echo "======================================================"
echo "Run: sbt package writeVersion "
echo "------------------------------------------------------"
if sbt clean package writeVersion ; then
echo "Done: sbt clean package writeVersion "
echo "======================================================"
else
echo "Failed: sbt package" 1>&2
echo "======================================================"
exit 1
fi

echo ""
echo "======================================================"
echo "Building Packages: Done"
echo "======================================================"
35 changes: 35 additions & 0 deletions .build-project.sh
@@ -0,0 +1,35 @@
#!/bin/bash -e

echo "============================================"
echo "Build projects"
echo "--------------------------------------------"
echo ""
echo "============================================"
echo "Run: sbt clean coverage test package"
echo "--------------------------------------------"
if sbt clean coverage test package ; then
echo "Done: sbt clean coverage test package"
echo "============================================"
else
echo "Failed: sbt clean coverage test package" 1>&2
echo "============================================"
exit 1
fi

echo ""

# echo "============================================"
# echo "Run: sbt coveralls"
# echo "--------------------------------------------"
# if sbt coveralls ; then
# echo "Done: sbt coveralls"
# echo "============================================"
# else
# echo "Failed: sbt coveralls" 1>&2
# echo "============================================"
# exit 1
# fi
# echo ""
echo "============================================"
echo "Building projects: Done"
echo "============================================"
26 changes: 26 additions & 0 deletions .deploy-to-github.sh
@@ -0,0 +1,26 @@
#!/bin/bash -e

echo "======================================================"
echo "Deploying to GitHub"
if sbt checkGithubCredentials releaseOnGithub ; then
echo "------------------------------------------------------"
echo "Deploying to GitHub: Done"
echo "======================================================"
# echo "======================================================"
# echo "Uploading to S3"
# if sbt s3-upload ; then
# echo "------------------------------------------------------"
# echo "Uploading to S3: Done"
# echo "======================================================"
# else
# echo "======================================================"
# echo "Build and Deploy: Failed" 1>&2
# echo "======================================================"
# exit 1
# fi
else
echo "======================================================"
echo "Build and Deploy: Failed" 1>&2
echo "======================================================"
exit 1
fi
20 changes: 20 additions & 0 deletions .env-info.sh
@@ -0,0 +1,20 @@
#!/bin/bash -e

echo "============================================"
echo "Java Info"
java -version
echo "--------------------------------------------"
echo "Scala Info"
scala -version
echo "--------------------------------------------"
echo "SBT Info"
sbt --version || :
echo "--------------------------------------------"
echo "Memory Info"
echo "--------------------------------------------"
echo "free -m"
free -m
echo "--------------------------------------------"
echo "grep MemTotal /proc/meminfo"
grep MemTotal /proc/meminfo
echo "--------------------------------------------"
52 changes: 52 additions & 0 deletions .release-files-copy.sh
@@ -0,0 +1,52 @@
#!/bin/bash

if [ ! -n "$PROJECT_BUILD_NAME" ]
then
echo "NO PROJECT_BUILD_NAME is found so quit!" 1>&2
exit 1
fi

echo "======================================================"
echo "Release to Bintray"
echo "======================================================"
echo ""
echo "Run: sbt publish"
echo "------------------------------------------------------"
if sbt publish ; then
echo "Done: sbt publish"
else
echo "Failed: sbt publish" 1>&2
exit 1
fi
echo "======================================================"


echo "======================================================"
echo "Copy packaged files to deploy"
echo "======================================================"
echo "ls -l target/*.jar"
ls -l target/*.jar
echo ""
echo "======================================================"
if [ -d "target/ci" ]; then
echo "Clean up existing target/ci/*"
echo "rm -R target/ci/*"
rm -R target/ci/*
echo "------------------------------------------------------"
fi
echo "Create a folder to put all the binary files."
echo "------------------------------------------------------"
echo "mkdir -p target/ci/$PROJECT_BUILD_NAME"
mkdir -p "target/ci/$PROJECT_BUILD_NAME"
echo "ls -l target/ci/$PROJECT_BUILD_NAME"
ls -l "target/ci/$PROJECT_BUILD_NAME"

echo "------------------------------------------------------"
echo "cp target/*.jar target/ci/$PROJECT_BUILD_NAME/"
cp target/*.jar "target/ci/$PROJECT_BUILD_NAME/"
echo "------------------------------------------------------"
echo "ls -lR target/ci/$PROJECT_BUILD_NAME/"
ls -lR "target/ci/$PROJECT_BUILD_NAME"
echo "------------------------------------------------------"
echo "Copying all binary files to 'target/ci', Done!"
echo "======================================================"
45 changes: 45 additions & 0 deletions .restore-cache.sh
@@ -0,0 +1,45 @@
#!/bin/bash

echo "Create $HOME/.ivy2 if not exists"
mkdir -p "$HOME/.ivy2"
echo "Done"
# ls -l "$HOME/.ivy2"
# ls -l "$HOME/.ivy2/cache"
echo ""
echo "Create $HOME/.sbt if not exists"
mkdir -p "$HOME/.sbt"
echo "Done"
# ls -l "$HOME/.sbt"

if [ -d "$SEMAPHORE_CACHE_DIR/app-ivy2-cache" ];
then
echo "============================================"
echo "Ivy Cache exists so copy it"
echo "--------------------------------------------"
echo "cp -Rp $SEMAPHORE_CACHE_DIR/app-ivy2-cache/cache $HOME/.ivy2/"
cp -Rp "$SEMAPHORE_CACHE_DIR/app-ivy2-cache/cache" "$HOME/.ivy2/"

echo "ls -ld $HOME/.ivy2/cache"
ls -ld "$HOME/.ivy2/cache"
echo "ls -l $HOME/.ivy2/cache"
ls -l "$HOME/.ivy2/cache"
echo "--------------------------------------------"
echo "Ivy Cache Copying: Done"
echo "============================================"
fi
if [ -d "$SEMAPHORE_CACHE_DIR/app-sbt-cache" ];
then
echo "============================================"
echo "SBT Cache exists so copy it"
echo "--------------------------------------------"
echo "cp -Rp $SEMAPHORE_CACHE_DIR/app-sbt-cache/boot $HOME/.sbt/"
cp -Rp "$SEMAPHORE_CACHE_DIR/app-sbt-cache/boot" "$HOME/.sbt/"

echo "ls -ld $HOME/.sbt/boot"
ls -ld "$HOME/.sbt/boot"
echo "ls -l $HOME/.sbt/boot"
ls -l "$HOME/.sbt/boot"
echo "--------------------------------------------"
echo "SBT Cache Copying: Done"
echo "============================================"
fi
91 changes: 91 additions & 0 deletions .semaphore-deploy.sh
@@ -0,0 +1,91 @@
#!/bin/bash -e

echo ""
echo "======================================================"
echo "Start to deploy packages"
echo "------------------------------------------------------"

export THIS_BRANCH="$BRANCH_NAME"
if [ "$THIS_BRANCH" == "release" ];
then

export VERSION_FILE="target/version.tmp"
echo "Version File=$VERSION_FILE"

if [ ! -f "$VERSION_FILE" ]
then
echo "NO version file, '$VERSION_FILE', exists so quit!" 1>&2
exit 1
fi

export PROJECT_VERSION=`cat $VERSION_FILE`
echo "PROJECT_VERSION=$PROJECT_VERSION"

if [ ! -n "$PROJECT_VERSION" ]
then
echo "NO PROJECT_VERSION is found so quit!" 1>&2
exit 1
fi

export GIT_TAG="v$PROJECT_VERSION"
echo "GIT_TAG=$GIT_TAG"
export PROJECT_BUILD_NAME="$GIT_TAG"
echo "PROJECT_BUILD_NAME=$PROJECT_BUILD_NAME"

echo "======================================================"
echo "Running: git tag | xargs -n1 git tag -d"
echo "------------------------------------------------------"
git tag | xargs -n1 git tag -d
echo "======================================================"
echo "Running: git fetch --tags"
echo "------------------------------------------------------"
git fetch --tags
echo "======================================================"

echo "check git ls-remote --exit-code --tags origin $GIT_TAG 2>&1 > /dev/null"

if git ls-remote --exit-code --tags origin $GIT_TAG 2>&1 > /dev/null ; then
echo "------------------------------------------------------"
echo "[ERROR] the given tag '$GIT_TAG' already exists!" 2>&1
echo "======================================================"
exit 1
else
echo "------------------------------------------------------"
echo "the given tag '$GIT_TAG' does not exist so run it!"

export REPO_LOCATION="git@github.com:Kevin-Lee/j8plus.git"
echo "REPO_LOCATION=$REPO_LOCATION"

export USER_EMAIL="builder+github@lckymn.com"
echo "USER_EMAIL=$USER_EMAIL"

export USER_NAME="Kevin-App-Builder"
echo "USER_NAME=$USER_NAME"

git config --global user.email "$USER_EMAIL"
git config --global user.name "$USER_NAME"

echo "======================================================"
echo "Running: git tag $GIT_TAG -a -m Automatically generated tag by Semaphore CI for $GIT_TAG"
echo "------------------------------------------------------"
git tag "$GIT_TAG" -a -m "Automatically generated tag by Semaphore CI for $GIT_TAG"
echo "======================================================"
echo "git push $REPO_LOCATION --tags"
echo "------------------------------------------------------"
git push "$REPO_LOCATION" --tags
echo "======================================================"

fi

./.release-files-copy.sh
./.deploy-to-github.sh

echo "======================================================"
echo "Build and Deploy: Done"
echo "======================================================"
else
echo "======================================================"
echo "It is not release branch so skip deployment."
echo "Build: Done"
echo "======================================================"
fi
26 changes: 26 additions & 0 deletions .store-cache.sh
@@ -0,0 +1,26 @@
#!/bin/bash

find $HOME/.sbt -name "*.lock" | xargs rm
find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm

echo "============================================"
echo "Copy Ivy cache to $SEMAPHORE_CACHE_DIR/app-ivy2-cache"
echo "--------------------------------------------"
if [ ! -d "$SEMAPHORE_CACHE_DIR/app-ivy2-cache" ];
then
echo "mkdir -p $SEMAPHORE_CACHE_DIR/app-ivy2-cache"
mkdir -p "$SEMAPHORE_CACHE_DIR/app-ivy2-cache"
fi
cp -Rp "$HOME/.ivy2/cache" "$SEMAPHORE_CACHE_DIR/app-ivy2-cache/"
echo "Copy Ivy cache to $SEMAPHORE_CACHE_DIR/app-ivy2-cache: Done"
echo "============================================"
echo "Copy Sbt cache to $SEMAPHORE_CACHE_DIR/app-sbt-cache"
echo "--------------------------------------------"
if [ ! -d "$SEMAPHORE_CACHE_DIR/app-sbt-cache" ];
then
echo "mkdir -p $SEMAPHORE_CACHE_DIR/app-sbt-cache "
mkdir -p "$SEMAPHORE_CACHE_DIR/app-sbt-cache"
fi
cp -Rp "$HOME/.sbt/boot" "$SEMAPHORE_CACHE_DIR/app-sbt-cache/"
echo "Copy Sbt cache to $SEMAPHORE_CACHE_DIR/app-sbt-cache: Done"
echo "============================================"

0 comments on commit 0916cb9

Please sign in to comment.