Skip to content

Commit

Permalink
Merge 849b837 into abce191
Browse files Browse the repository at this point in the history
  • Loading branch information
jgebal committed Mar 6, 2017
2 parents abce191 + 849b837 commit 4d9d86f
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 31 deletions.
39 changes: 27 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,50 @@ addons:
- master
env:
global:
#Needed to install Oracle
- ORACLE_COOKIE=sqldev
- ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
#Needed to run and access Oracle db
- ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
- NLS_LANG=AMERICAN_AMERICA.AL32UTF8
- ORACLE_BASE=/u01/app/oracle
- LD_LIBRARY_PATH=$ORACLE_HOME/lib
- PATH=$PATH:$ORACLE_HOME/jdbc/lib:$ORACLE_HOME/bin
- JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
- DATABASE_VERSION=11.2.0.2
- ORACLE_SID=XE
- DATABASE_NAME=XE
- ORA_SDTZ='Europe/London' #Needed as a client parameter
- TZ='Europe/London' #Needed as a DB Server parameter
#Needed for Sonar integration - as it runs on Java8
- JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
#utPLSQL install user
- UT3_OWNER=ut3
- UT3_OWNER_PASSWORD=ut3
- UT3_OWNER_TABLESPACE=users
#utPLSQL another user - for testing utPLSQL runability from other schema
- UT3_USER=ut3_user
- UT3_USER_PASSWORD=ut3
- UT3_USER_TABLESPACE=users
# Target Branch and Directory for Deployment of Docs
# Target Branch and Directory for Deployment of Docs
- PAGES_TARGET_BRANCH="gh-pages"
- PAGES_VERSION_BASE="version3"

#Environment for building a release
# File containing new version number
- CURRENT_BRANCH=${TRAVIS_BRANCH}
- UTPLSQL_REPO="utPLSQL/utPLSQL"
- UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}"
- UTPLSQL_VERSION_PLACEHOLDER='utPLSQL - Version'
- UTPLSQL_VERSION="`. .travis/get_project_version.sh`"
- UTPLSQL_SOURCES_DIR='source'
- UTPLSQL_BUILD_USER_NAME="Travis CI"
cache:
directories:
- .cache
- $HOME/.cache

before_install:
- bash .travis/update_project_version.sh
# On trusty, download the zip file into a cachable directory
- test "$DIST" = precise || export ORACLE_ZIP_DIR=$HOME/.cache
# If the zip file already exists, do not download it again
Expand All @@ -56,32 +71,32 @@ before_install:
install:
- sudo pip install -r .travis/python_req.txt
- bash .travis/oracle/install.sh

script:
- bash .travis/create_utplsql_owner.sh
- bash .travis/create_utplsql_user.sh
- bash .travis/install_libraries.sh
- bash .travis/install.sh
- bash .travis/grant_user.sh

script:
- bash .travis/run_examples_as_owner.sh
- bash .travis/run_test_as_owner.sh
- bash .travis/run_examples_as_user.sh
- bash .travis/create_release.sh
# - bash .travis/run_test_as_user.sh
# - bash .travis/build_docs.sh
- bash .travis/run_test_as_owner.sh
# - bash .travis/push_docs_to_gh_pages.sh
- sonar-scanner
- bash .travis/coveralls_uploader.sh

before_deploy:
- bash .travis/build_docs.sh
- bash .travis/build_release_archive.sh

deploy:
provider: releases
api_key: $github_api_token
file:
- utPLSQL$TRAVIS_TAG.zip
- utPLSQL$TRAVIS_TAG.tar.gz
- release/utPLSQL${UTPLSQL_VERSION}.zip
- release/utPLSQL${UTPLSQL_VERSION}.tar.gz
skip_cleanup: true
on:
repo: utPLSQL/utPLSQL
repo: ${UTPLSQL_REPO}
tags: true

notifications:
Expand Down
18 changes: 8 additions & 10 deletions .travis/create_release_archive.sh → .travis/build_release_archive.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,24 @@ rm -rf release
# Create needed directories
mkdir -p release/docs/html
mkdir release/docs/markdown
mkdir release/source

# Copy files to various directories
cp -r docs release/docs/markdown
cp -r site release/docs/html
cp -r site release/docs/html
cp -r client_source release/client_source
cp -r source release/source
cp -r examples release/examples
cp -r readme.md release/
cp -r readme.md release/
cp -r LICENSE release/
cp -r authors.md release/
cp -r CONTRIBUTING.md release/
cd release
#Although the $TRAVIS_TAG versions are the only one used. They are conditional,
#and we want the process always run to insure we don't have problems with building archive
#when we finally tag a release
zip -r ../utPLSQL.zip *
tar -zcvf ../utPLSQL.tar.gz *
zip -r -q ../utPLSQL.zip *
tar -zcf ../utPLSQL.tar.gz *
#Name of archive will match tag name for a release.
if [ -n "$TRAVIS_TAG" ]; then
cd ..
cp utPLSQL.zip utPLSQL$TRAVIS_TAG.zip
cp utPLSQL.tar.gz utPLSQL$TRAVIS_TAG.tar.gz
fi
mv ../utPLSQL.zip utPLSQL${UTPLSQL_VERSION}.zip
mv ../utPLSQL.tar.gz utPLSQL${UTPLSQL_VERSION}.tar.gz

5 changes: 3 additions & 2 deletions .travis/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
cd "${0%/*}"
chmod +x ./build_docs.sh
chmod +x ./create_release_archive.sh
./build_docs.sh
./create_release_archive.sh

bash ./build_docs.sh
bash ./create_release_archive.sh
10 changes: 10 additions & 0 deletions .travis/get_project_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
#If building a new version from a release branch - then version is taken from release branch name
if [[ "${CURRENT_BRANCH}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
version=${CURRENT_BRANCH#release\/}
version=`sed -r "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${version}"`
echo ${version} > VERSION
else
version=`cat VERSION`
fi
echo ${version}
4 changes: 0 additions & 4 deletions .travis/install_libraries.sh

This file was deleted.

33 changes: 33 additions & 0 deletions .travis/update_project_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

echo Current branch is "${CURRENT_BRANCH}"

last_commit_user=`git log -1 --format=%an`
if [[ "${last_commit_user}" != "${UTPLSQL_BUILD_USER_NAME}" ]]; then
if [[ "${CURRENT_BRANCH}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
echo Updating version in project source files
find ${UTPLSQL_SOURCES_DIR} -type f -name '*' -exec sed -i -r "s/(${UTPLSQL_VERSION_PLACEHOLDER} )[^']*(')?/\1${UTPLSQL_VERSION}\2/" {} \;
echo Source files updated with version tag: $UTPLSQL_FULL_VERSION

echo Update of sonar-project.properties sonar.projectVersion
sed -i -r "s/(sonar\.projectVersion=).*?/\1${UTPLSQL_VERSION}/" sonar-project.properties
echo ${UTPLSQL_VERSION} > VERSION

#inspired by:
# https://github.com/travis-ci/travis-ci/issues/1476
# http://stackoverflow.com/questions/36915499/push-to-git-master-branch-from-travis-ci
git config --global user.email "builds@travis-ci.com"
git config --global user.name "${UTPLSQL_BUILD_USER_NAME}"

git add .
git commit -m 'Updated project version after building a release'
echo pushing
git push --quiet https://${github_api_token}@github.com/${UTPLSQL_REPO} HEAD:${CURRENT_BRANCH}
echo Creating tag
git tag ${UTPLSQL_VERSION} -a -m "Generated tag from TravisCI build $TRAVIS_BUILD_NUMBER"
echo pushing tag
git push --quiet https://${github_api_token}@github.com/${UTPLSQL_REPO} ${UTPLSQL_VERSION}
else
echo Not on a release branch, skipping project version update
fi
fi
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v3.0.0-alpha2
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
sonar.projectKey=utPLSQL:utPLSQL
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=utPLSQL
sonar.projectVersion=3.0.0.Alpha

sonar.projectVersion=v3.0.0-Alpha1

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
Expand Down
5 changes: 5 additions & 0 deletions source/api/ut.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ create or replace package body ut is
limitations under the License.
*/

function version return varchar2 is
begin
return ut_utils.gc_version;
end;

function expect(a_actual in anydata, a_message varchar2 := null) return ut_expectation_anydata is
begin
return ut_expectation_anydata(ut_data_value_anydata(a_actual), a_message);
Expand Down
2 changes: 2 additions & 0 deletions source/api/ut.pks
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ create or replace package ut authid current_user as
limitations under the License.
*/

function version return varchar2;

function expect(a_actual in anydata, a_message varchar2 := null) return ut_expectation_anydata;

function expect(a_actual in blob, a_message varchar2 := null) return ut_expectation_blob;
Expand Down
5 changes: 5 additions & 0 deletions source/api/ut_runner.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ create or replace package body ut_runner is
limitations under the License.
*/

function version return varchar2 is
begin
return ut_utils.gc_version;
end;

procedure run(a_paths ut_varchar2_list, a_reporters ut_reporters, a_color_console boolean := false) is
l_items_to_run ut_run;
l_listener ut_event_listener;
Expand Down
2 changes: 2 additions & 0 deletions source/api/ut_runner.pks
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ create or replace package ut_runner authid current_user is
limitations under the License.
*/

function version return varchar2;

/**
* Run suites/tests by path
* Accepts value of the following formats:
Expand Down
1 change: 1 addition & 0 deletions source/core/ut_utils.pks
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ create or replace package ut_utils authid definer is

*/

gc_version constant varchar2(50) := 'utPLSQL - Version X.X.X.X';

/* Constants: Event names */
gc_run constant varchar2(12) := 'run';
Expand Down
3 changes: 1 addition & 2 deletions source/reporters/ut_coverage_report_html_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ create or replace package body ut_coverage_report_html_helper is
limitations under the License.
*/

gc_version constant varchar2(50) := '3.0.0.0-Alpha-1';
gc_green_coverage_pct constant integer := 90;
gc_yellow_coverage_pct constant integer := 80;

Expand Down Expand Up @@ -244,7 +243,7 @@ create or replace package body ut_coverage_report_html_helper is
l_file_part :=
chr(10)||
'</div><div id="footer">' ||
'Generated by <a href="http://github.com/utPLSQL/utPLSQL">utPLSQL</a> v'||gc_version||'<br/>' ||
'Generated by <a href="http://github.com/utPLSQL/utPLSQL">'||ut_utils.gc_version||'</a><br/>' ||
'Based on <a href="http://github.com/colszowka/simplecov-html">simplecov-html</a> v0.10.0 '||l_using||'' ||
'</div><div class="source_files">';
dbms_lob.writeappend(l_result, length(l_file_part), l_file_part);
Expand Down

0 comments on commit 4d9d86f

Please sign in to comment.