From 21023a5eff1a0949fcdb6124705df17d3421c2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Fri, 3 Mar 2017 01:04:35 +0000 Subject: [PATCH 1/9] Experimenting with building a version from tag and travis build number. --- .travis.yml | 11 ++++++----- .travis/create_release.sh | 7 +++++-- .travis/create_release_archive.sh | 14 +++++++------- .travis/install_libraries.sh | 4 ---- .travis/update_version.sh | 16 ++++++++++++++++ .../reporters/ut_coverage_report_html_helper.pkb | 4 ++-- 6 files changed, 36 insertions(+), 20 deletions(-) delete mode 100644 .travis/install_libraries.sh create mode 100644 .travis/update_version.sh diff --git a/.travis.yml b/.travis.yml index d72229770..b68440543 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,18 +58,19 @@ install: 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 - 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/push_docs_to_gh_pages.sh +#moved to before_deploy step +# - bash .travis/create_release.sh - sonar-scanner +before_deploy: + - bash .travis/create_release.sh + deploy: provider: releases api_key: $github_api_token @@ -78,7 +79,7 @@ deploy: - utPLSQL$TRAVIS_TAG.tar.gz skip_cleanup: true on: - repo: utPLSQL/utPLSQL + repo: jgebal/utPLSQL tags: true notifications: diff --git a/.travis/create_release.sh b/.travis/create_release.sh index c9079603c..b9c2bbd26 100644 --- a/.travis/create_release.sh +++ b/.travis/create_release.sh @@ -1,7 +1,10 @@ #!/bin/bash # Change working directory to script directory cd "${0%/*}" +chmod +x ./update_version.sh chmod +x ./build_docs.sh chmod +x ./create_release_archive.sh -./build_docs.sh -./create_release_archive.sh \ No newline at end of file + +bash ./update_version.sh +bash ./build_docs.sh +bash ./create_release_archive.sh diff --git a/.travis/create_release_archive.sh b/.travis/create_release_archive.sh index 489521f75..ad2683c8c 100755 --- a/.travis/create_release_archive.sh +++ b/.travis/create_release_archive.sh @@ -8,14 +8,14 @@ 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/ @@ -23,11 +23,11 @@ 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 +if [ -n "$TRAVIS_TAG" ]; then cd .. cp utPLSQL.zip utPLSQL$TRAVIS_TAG.zip cp utPLSQL.tar.gz utPLSQL$TRAVIS_TAG.tar.gz -fi \ No newline at end of file +fi diff --git a/.travis/install_libraries.sh b/.travis/install_libraries.sh deleted file mode 100644 index 5afb2e913..000000000 --- a/.travis/install_libraries.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -work_dir="$(dirname "$(readlink -f "$0")")" - diff --git a/.travis/update_version.sh b/.travis/update_version.sh new file mode 100644 index 000000000..6faf90461 --- /dev/null +++ b/.travis/update_version.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +version=$TRAVIS_TAG +build_number=$TRAVIS_BUILD_NUMBER +version_placeholder='(utPLSQL - Version )X.X.X.X' +sources_directory='../source' +function build_version_no(){ + version=$1 + build_number=$2 + #split version number and additional stuff after the number + #so that: v3.0.0-develop will be changed to v.3.0.0.build_number-develop + echo `sed -r "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)/\1\2\3\.$build_number\4/" <<< "$version"` +} + +version_with_build=`build_version_no ${version} ${build_number}` + +find ${sources_directory} -type f -name '*' -exec sed -i -r "s/${version_placeholder}/\1${version_with_build}/" {} \; diff --git a/source/reporters/ut_coverage_report_html_helper.pkb b/source/reporters/ut_coverage_report_html_helper.pkb index cff067573..f156031eb 100644 --- a/source/reporters/ut_coverage_report_html_helper.pkb +++ b/source/reporters/ut_coverage_report_html_helper.pkb @@ -16,7 +16,7 @@ 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_version constant varchar2(50) := 'utPLSQL - Version X.X.X.X'; gc_green_coverage_pct constant integer := 90; gc_yellow_coverage_pct constant integer := 80; @@ -239,7 +239,7 @@ create or replace package body ut_coverage_report_html_helper is l_file_part := chr(10)|| '
'; dbms_lob.writeappend(l_result, length(l_file_part), l_file_part); From d9dd6a4342eda1643ce01d793d8a8ef3bcac5276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sat, 4 Mar 2017 13:22:57 +0000 Subject: [PATCH 2/9] Added version constant to ut_utils. Added version function to API packages. --- source/api/ut.pkb | 5 +++++ source/api/ut.pks | 2 ++ source/api/ut_runner.pkb | 5 +++++ source/api/ut_runner.pks | 2 ++ source/core/ut_utils.pks | 1 + source/reporters/ut_coverage_report_html_helper.pkb | 3 +-- 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/source/api/ut.pkb b/source/api/ut.pkb index 41f60f7b8..d80b6dc1c 100644 --- a/source/api/ut.pkb +++ b/source/api/ut.pkb @@ -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); diff --git a/source/api/ut.pks b/source/api/ut.pks index 5958d05fb..c227d13dd 100644 --- a/source/api/ut.pks +++ b/source/api/ut.pks @@ -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; diff --git a/source/api/ut_runner.pkb b/source/api/ut_runner.pkb index b1d083e92..ae59b693a 100644 --- a/source/api/ut_runner.pkb +++ b/source/api/ut_runner.pkb @@ -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; diff --git a/source/api/ut_runner.pks b/source/api/ut_runner.pks index 94dc288bf..2d7445f44 100644 --- a/source/api/ut_runner.pks +++ b/source/api/ut_runner.pks @@ -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: diff --git a/source/core/ut_utils.pks b/source/core/ut_utils.pks index 78843445f..b26c105ea 100644 --- a/source/core/ut_utils.pks +++ b/source/core/ut_utils.pks @@ -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'; diff --git a/source/reporters/ut_coverage_report_html_helper.pkb b/source/reporters/ut_coverage_report_html_helper.pkb index f156031eb..ba05a0908 100644 --- a/source/reporters/ut_coverage_report_html_helper.pkb +++ b/source/reporters/ut_coverage_report_html_helper.pkb @@ -16,7 +16,6 @@ create or replace package body ut_coverage_report_html_helper is limitations under the License. */ - gc_version constant varchar2(50) := 'utPLSQL - Version X.X.X.X'; gc_green_coverage_pct constant integer := 90; gc_yellow_coverage_pct constant integer := 80; @@ -239,7 +238,7 @@ create or replace package body ut_coverage_report_html_helper is l_file_part := chr(10)|| '
'; dbms_lob.writeappend(l_result, length(l_file_part), l_file_part); From d6b66a0981fd0bf13c40460ff00b82c34794ff89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sat, 4 Mar 2017 13:33:51 +0000 Subject: [PATCH 3/9] Cleanup travis config. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b68440543..43e181a38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ deploy: - utPLSQL$TRAVIS_TAG.tar.gz skip_cleanup: true on: - repo: jgebal/utPLSQL + repo: utPLSQL/utPLSQL tags: true notifications: From 36c08e5d0b94ddf965fdb0e0213399ef87a2598d Mon Sep 17 00:00:00 2001 From: Pazus Date: Sat, 4 Mar 2017 18:47:54 +0300 Subject: [PATCH 4/9] changed update_release script to before_script --- .travis.yml | 3 +++ .travis/create_release.sh | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51deff2f1..3247109f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,6 +55,9 @@ install: - sudo pip install -r .travis/python_req.txt - bash .travis/oracle/install.sh +before_script: + - bash .travis/update_version.sh + script: - bash .travis/create_utplsql_owner.sh - bash .travis/create_utplsql_user.sh diff --git a/.travis/create_release.sh b/.travis/create_release.sh index b9c2bbd26..3a250d547 100644 --- a/.travis/create_release.sh +++ b/.travis/create_release.sh @@ -1,10 +1,8 @@ #!/bin/bash # Change working directory to script directory cd "${0%/*}" -chmod +x ./update_version.sh chmod +x ./build_docs.sh chmod +x ./create_release_archive.sh -bash ./update_version.sh bash ./build_docs.sh bash ./create_release_archive.sh From fb06318840e15b7ce6081fd40fa955b087ccae1f Mon Sep 17 00:00:00 2001 From: Pazus Date: Sat, 4 Mar 2017 18:58:31 +0300 Subject: [PATCH 5/9] fix path --- .travis/update_version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/update_version.sh b/.travis/update_version.sh index 6faf90461..040057692 100644 --- a/.travis/update_version.sh +++ b/.travis/update_version.sh @@ -2,7 +2,7 @@ version=$TRAVIS_TAG build_number=$TRAVIS_BUILD_NUMBER version_placeholder='(utPLSQL - Version )X.X.X.X' -sources_directory='../source' +sources_directory='source' function build_version_no(){ version=$1 build_number=$2 From ae8c63b108241cbb5c2c39d46516e206f95d33ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sat, 4 Mar 2017 23:23:36 +0000 Subject: [PATCH 6/9] Added VERSION file to the project. Moved configuration to .travis.yml Added variable version no to sonar-project.properties --- .travis.yml | 32 +++++++++++++++++++---------- .travis/create_release_archive.sh | 7 +++---- .travis/get_full_project_version.sh | 2 ++ .travis/update_project_version.sh | 8 ++++++++ .travis/update_version.sh | 16 --------------- VERSION | 1 + sonar-project.properties | 2 +- 7 files changed, 36 insertions(+), 32 deletions(-) create mode 100644 .travis/get_full_project_version.sh create mode 100644 .travis/update_project_version.sh delete mode 100644 .travis/update_version.sh create mode 100644 VERSION diff --git a/.travis.yml b/.travis.yml index 3247109f4..555d62c02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,29 +17,42 @@ addons: 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" + #Needed for project builds + - UTPLSQL_VERSION_FILE="VERSION" + - UTPLSQL_VERSION="${TRAVIS_TAG:-`cat ${UTPLSQL_VERSION_FILE}`}" + - UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}" + - UTPLSQL_VERSION_PLACEHOLDER='(utPLSQL - Version )X.X.X.X' + - UTPLSQL_SOURCES_DIR='source' + - UTPLSQL_FULL_VERSION="`. .travis/get_full_project_version.sh`" + cache: directories: - .cache @@ -56,21 +69,19 @@ install: - bash .travis/oracle/install.sh before_script: - - bash .travis/update_version.sh - + - bash .travis/update_project_version.sh + script: - bash .travis/create_utplsql_owner.sh - bash .travis/create_utplsql_user.sh - bash .travis/install.sh - bash .travis/grant_user.sh - bash .travis/run_examples_as_owner.sh - - bash .travis/run_test_as_owner.sh - bash .travis/run_examples_as_user.sh + - bash .travis/run_test_as_owner.sh # - bash .travis/push_docs_to_gh_pages.sh -#moved to before_deploy step -# - bash .travis/create_release.sh - sonar-scanner - - bash .travis/coveralls_uploader.sh + - bash .travis/coveralls_uploader.sh before_deploy: - bash .travis/create_release.sh @@ -79,12 +90,11 @@ deploy: provider: releases api_key: $github_api_token file: - - utPLSQL$TRAVIS_TAG.zip - - utPLSQL$TRAVIS_TAG.tar.gz + - utPLSQL${UTPLSQL_FULL_VERSION}.zip + - utPLSQL${UTPLSQL_FULL_VERSION}.tar.gz skip_cleanup: true on: repo: utPLSQL/utPLSQL tags: true - notifications: slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB diff --git a/.travis/create_release_archive.sh b/.travis/create_release_archive.sh index ad2683c8c..b91049a14 100755 --- a/.travis/create_release_archive.sh +++ b/.travis/create_release_archive.sh @@ -26,8 +26,7 @@ cd release 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_FULL_VERSION}.zip +mv utPLSQL.tar.gz utPLSQL${UTPLSQL_FULL_VERSION}.tar.gz + diff --git a/.travis/get_full_project_version.sh b/.travis/get_full_project_version.sh new file mode 100644 index 000000000..bd611792b --- /dev/null +++ b/.travis/get_full_project_version.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo `sed -r "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}"` diff --git a/.travis/update_project_version.sh b/.travis/update_project_version.sh new file mode 100644 index 000000000..22a750149 --- /dev/null +++ b/.travis/update_project_version.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +echo Updating version in project source files + +find ${UTPLSQL_SOURCES_DIR} -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSION_PLACEHOLDER}/\1${UTPLSQL_FULL_VERSION}/" {} \; + +echo Source files updated with version tag: $UTPLSQL_FULL_VERSION + diff --git a/.travis/update_version.sh b/.travis/update_version.sh deleted file mode 100644 index 040057692..000000000 --- a/.travis/update_version.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -version=$TRAVIS_TAG -build_number=$TRAVIS_BUILD_NUMBER -version_placeholder='(utPLSQL - Version )X.X.X.X' -sources_directory='source' -function build_version_no(){ - version=$1 - build_number=$2 - #split version number and additional stuff after the number - #so that: v3.0.0-develop will be changed to v.3.0.0.build_number-develop - echo `sed -r "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)/\1\2\3\.$build_number\4/" <<< "$version"` -} - -version_with_build=`build_version_no ${version} ${build_number}` - -find ${sources_directory} -type f -name '*' -exec sed -i -r "s/${version_placeholder}/\1${version_with_build}/" {} \; diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..df7f8449c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +3.0.0-alpha1 diff --git a/sonar-project.properties b/sonar-project.properties index 008c385f8..eba9af871 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,7 +2,7 @@ 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=${UTPLSQL_FULL_VERSION} # 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. From dee7a198084b0b477c79ad94c9ebe83731dbd35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sun, 5 Mar 2017 01:51:06 +0000 Subject: [PATCH 7/9] Updated the sonar properties file. --- .travis/update_project_version.sh | 1 + sonar-project.properties | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.travis/update_project_version.sh b/.travis/update_project_version.sh index 22a750149..db915052b 100644 --- a/.travis/update_project_version.sh +++ b/.travis/update_project_version.sh @@ -6,3 +6,4 @@ find ${UTPLSQL_SOURCES_DIR} -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSI echo Source files updated with version tag: $UTPLSQL_FULL_VERSION +echo "sonar.projectVersion=${UTPLSQL_FULL_VERSION}" >> sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties index eba9af871..56edabb28 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,6 +2,10 @@ 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 + +# The sonar.projectVersion is appended to this file by CI build process as described at: +# http://stackoverflow.com/questions/38972497/is-it-possible-to-use-environment-variable-in-sonar-project-properties-file +# This is done by .travis/update_project_version.sh script #sonar.projectVersion=${UTPLSQL_FULL_VERSION} # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. From 1cb575d7ce74348acc3744bf5224da6c2f680de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sun, 5 Mar 2017 14:56:34 +0000 Subject: [PATCH 8/9] Change approach to releasing. If building on a branch "release/vX.X.Xsomething" then: File `VERSION` stores the last released version number. - version in files gets updated - tag gets created - a tag build is triggered and assets (zip/gzip) get uploaded to the release tag. --- .travis.yml | 31 +++++++++--------- ...se_archive.sh => build_release_archive.sh} | 5 ++- .travis/get_full_project_version.sh | 2 -- .travis/get_project_version.sh | 10 ++++++ .travis/update_project_version.sh | 32 ++++++++++++++++--- VERSION | 2 +- sonar-project.properties | 5 +-- 7 files changed, 58 insertions(+), 29 deletions(-) rename .travis/{create_release_archive.sh => build_release_archive.sh} (88%) mode change 100755 => 100644 delete mode 100644 .travis/get_full_project_version.sh create mode 100644 .travis/get_project_version.sh diff --git a/.travis.yml b/.travis.yml index 555d62c02..2b4d23b3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,20 +45,22 @@ env: - PAGES_TARGET_BRANCH="gh-pages" - PAGES_VERSION_BASE="version3" - #Needed for project builds - - UTPLSQL_VERSION_FILE="VERSION" - - UTPLSQL_VERSION="${TRAVIS_TAG:-`cat ${UTPLSQL_VERSION_FILE}`}" + #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 )X.X.X.X' + - UTPLSQL_VERSION_PLACEHOLDER='utPLSQL - Version' + - UTPLSQL_VERSION="`. .travis/get_project_version.sh`" - UTPLSQL_SOURCES_DIR='source' - - UTPLSQL_FULL_VERSION="`. .travis/get_full_project_version.sh`" - + - 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 @@ -67,15 +69,12 @@ before_install: install: - sudo pip install -r .travis/python_req.txt - bash .travis/oracle/install.sh - -before_script: - - bash .travis/update_project_version.sh - -script: - bash .travis/create_utplsql_owner.sh - bash .travis/create_utplsql_user.sh - bash .travis/install.sh - bash .travis/grant_user.sh + +script: - bash .travis/run_examples_as_owner.sh - bash .travis/run_examples_as_user.sh - bash .travis/run_test_as_owner.sh @@ -84,17 +83,19 @@ script: - bash .travis/coveralls_uploader.sh before_deploy: - - bash .travis/create_release.sh + - bash .travis/build_docs.sh + - bash .travis/build_release_archive.sh deploy: provider: releases api_key: $github_api_token file: - - utPLSQL${UTPLSQL_FULL_VERSION}.zip - - utPLSQL${UTPLSQL_FULL_VERSION}.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: slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB diff --git a/.travis/create_release_archive.sh b/.travis/build_release_archive.sh old mode 100755 new mode 100644 similarity index 88% rename from .travis/create_release_archive.sh rename to .travis/build_release_archive.sh index b91049a14..0cfe95cf9 --- a/.travis/create_release_archive.sh +++ b/.travis/build_release_archive.sh @@ -26,7 +26,6 @@ cd release zip -r -q ../utPLSQL.zip * tar -zcf ../utPLSQL.tar.gz * #Name of archive will match tag name for a release. -cd .. -mv utPLSQL.zip utPLSQL${UTPLSQL_FULL_VERSION}.zip -mv utPLSQL.tar.gz utPLSQL${UTPLSQL_FULL_VERSION}.tar.gz +mv ../utPLSQL.zip utPLSQL${UTPLSQL_VERSION}.zip +mv ../utPLSQL.tar.gz utPLSQL${UTPLSQL_VERSION}.tar.gz diff --git a/.travis/get_full_project_version.sh b/.travis/get_full_project_version.sh deleted file mode 100644 index bd611792b..000000000 --- a/.travis/get_full_project_version.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo `sed -r "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}"` diff --git a/.travis/get_project_version.sh b/.travis/get_project_version.sh new file mode 100644 index 000000000..091a599c8 --- /dev/null +++ b/.travis/get_project_version.sh @@ -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} diff --git a/.travis/update_project_version.sh b/.travis/update_project_version.sh index db915052b..e73b57f28 100644 --- a/.travis/update_project_version.sh +++ b/.travis/update_project_version.sh @@ -1,9 +1,33 @@ #!/usr/bin/env bash -echo Updating version in project source files +echo Current branch is "${CURRENT_BRANCH}" -find ${UTPLSQL_SOURCES_DIR} -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSION_PLACEHOLDER}/\1${UTPLSQL_FULL_VERSION}/" {} \; +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 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 -echo "sonar.projectVersion=${UTPLSQL_FULL_VERSION}" >> sonar-project.properties + #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 diff --git a/VERSION b/VERSION index df7f8449c..aa6647e80 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha1 +v3.0.0-alpha2 diff --git a/sonar-project.properties b/sonar-project.properties index 56edabb28..de8227ff1 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,10 +3,7 @@ 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 -# The sonar.projectVersion is appended to this file by CI build process as described at: -# http://stackoverflow.com/questions/38972497/is-it-possible-to-use-environment-variable-in-sonar-project-properties-file -# This is done by .travis/update_project_version.sh script -#sonar.projectVersion=${UTPLSQL_FULL_VERSION} +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. From 1a875a68f7c9084fef2e2e97093f580821cec017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Thu, 9 Mar 2017 00:21:55 +0000 Subject: [PATCH 9/9] Documentation directory structure was reworked. HTML generated doc and md doc can coexist now in `docs` directory. All scripts related to release are now in ./travis/release directory The archives generated for releases on github exclude non-client code (CI build configuration and unit tests) Changed the way releases are handled. Documented steps to create new release. --- .gitattributes | 19 ++--- .gitignore | 4 +- .travis.yml | 26 +++---- .travis/build_docs.sh | 6 -- .travis/build_release_archive.sh | 31 -------- .travis/create_release.sh | 8 --- .travis/push_docs_to_gh_pages.sh | 68 +++++++++--------- .travis/python_req.txt | 1 - .travis/release/build_docs.sh | 4 ++ .travis/release/commit_and_push.sh | 24 +++++++ .travis/release/create_tag.sh | 8 +++ .travis/release/make_release.sh | 20 ++++++ .travis/release/readme.md | 33 +++++++++ .travis/release/update_project_version.sh | 9 +++ .travis/update_project_version.sh | 33 --------- .../md/about/CONTRIBUTING.md | 0 authors.md => docs/md/about/authors.md | 0 docs/{ => md}/about/license.md | 0 docs/{ => md}/about/project-details.md | 3 +- docs/{ => md}/about/support.md | 0 docs/{ => md}/index.md | 0 docs/{ => md}/userguide/annotations.md | 0 docs/{ => md}/userguide/best-practices.md | 0 docs/{ => md}/userguide/coverage.md | 0 .../{ => md}/userguide/exception-reporting.md | 0 docs/{ => md}/userguide/expectations.md | 0 docs/{ => md}/userguide/getting-started.md | 0 .../images/coverage_html_details.png | Bin .../images/coverage_html_summary.png | Bin docs/{ => md}/userguide/install.md | 0 docs/{ => md}/userguide/reporters.md | 0 docs/{ => md}/userguide/running-unit-tests.md | 0 docs/{ => md}/userguide/upgrade.md | 0 mkdocs.yml | 15 +++- readme.md | 26 ++++--- source/readme.md | 2 +- 36 files changed, 183 insertions(+), 157 deletions(-) delete mode 100644 .travis/build_docs.sh delete mode 100644 .travis/build_release_archive.sh delete mode 100644 .travis/create_release.sh delete mode 100644 .travis/python_req.txt create mode 100644 .travis/release/build_docs.sh create mode 100644 .travis/release/commit_and_push.sh create mode 100644 .travis/release/create_tag.sh create mode 100644 .travis/release/make_release.sh create mode 100644 .travis/release/readme.md create mode 100644 .travis/release/update_project_version.sh delete mode 100644 .travis/update_project_version.sh rename CONTRIBUTING.md => docs/md/about/CONTRIBUTING.md (100%) rename authors.md => docs/md/about/authors.md (100%) rename docs/{ => md}/about/license.md (100%) rename docs/{ => md}/about/project-details.md (83%) rename docs/{ => md}/about/support.md (100%) rename docs/{ => md}/index.md (100%) rename docs/{ => md}/userguide/annotations.md (100%) rename docs/{ => md}/userguide/best-practices.md (100%) rename docs/{ => md}/userguide/coverage.md (100%) rename docs/{ => md}/userguide/exception-reporting.md (100%) rename docs/{ => md}/userguide/expectations.md (100%) rename docs/{ => md}/userguide/getting-started.md (100%) rename docs/{ => md}/userguide/images/coverage_html_details.png (100%) rename docs/{ => md}/userguide/images/coverage_html_summary.png (100%) rename docs/{ => md}/userguide/install.md (100%) rename docs/{ => md}/userguide/reporters.md (100%) rename docs/{ => md}/userguide/running-unit-tests.md (100%) rename docs/{ => md}/userguide/upgrade.md (100%) diff --git a/.gitattributes b/.gitattributes index 06ec93914..f164b75ac 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,9 +1,10 @@ - -.gitattributes export-ignore -.gitignore export-ignore -.gitmodules export-ignore -.travis.yml export-ignore - -.travis export-ignore - -^docs/* linguist-documentation +.travis export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.gitmodules export-ignore +.travis.yml export-ignore +mkdocs.yml export-ignore +tests export-ignore +development export-ignore +sonar-project.properties export-ignore +^docs/* linguist-documentation diff --git a/.gitignore b/.gitignore index 126d93d97..ec683870f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,8 @@ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff: .idea/ -site/ +.sonar/ pages/ -release/ +release/* *.gz *.zip diff --git a/.travis.yml b/.travis.yml index 20909aeb4..1ff9d8fae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,9 @@ env: #Environment for building a release # File containing new version number - - CURRENT_BRANCH=${TRAVIS_BRANCH} + - CURRENT_BRANCH="${TRAVIS_BRANCH}" + - IS_RELEASE_BRANCH="`if [[ $CURRENT_BRANCH =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then echo true; fi`" + - UTPLSQL_PROJECT_ROOT=${TRAVIS_BUILD_DIR} - UTPLSQL_REPO="utPLSQL/utPLSQL" - UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}" - UTPLSQL_VERSION_PLACEHOLDER='utPLSQL - Version' @@ -62,14 +64,13 @@ 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 - test -f "$ORACLE_ZIP_DIR"/$(basename $ORACLE_FILE) || bash .travis/oracle/download.sh install: - - sudo pip install -r .travis/python_req.txt + - sudo pip install mkdocs - bash .travis/oracle/install.sh - bash .travis/create_utplsql_owner.sh - bash .travis/create_utplsql_user.sh @@ -80,24 +81,23 @@ script: - bash .travis/run_examples_as_owner.sh - bash .travis/run_examples_as_user.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 + - git clean -d -f -q + - bash .travis/release/update_project_version.sh + - bash .travis/release/build_docs.sh +# - bash .travis/push_docs_to_gh_pages.sh deploy: - provider: releases - api_key: $github_api_token - file: - - release/utPLSQL${UTPLSQL_VERSION}.zip - - release/utPLSQL${UTPLSQL_VERSION}.tar.gz + provider: script + script: bash .travis/release/make_release.sh skip_cleanup: true on: - repo: ${UTPLSQL_REPO} - tags: true + repo: ${UTPLSQL_REPO} + condition: ${IS_RELEASE_BRANCH} == true + all_branches: true notifications: slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB diff --git a/.travis/build_docs.sh b/.travis/build_docs.sh deleted file mode 100644 index db43d7ca9..000000000 --- a/.travis/build_docs.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Change working directory to script directory -cd "${0%/*}" -# Change back to root -cd .. -mkdocs build --clean --strict diff --git a/.travis/build_release_archive.sh b/.travis/build_release_archive.sh deleted file mode 100644 index 0cfe95cf9..000000000 --- a/.travis/build_release_archive.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Change working directory to script directory -cd "${0%/*}" -# Change back to root -cd .. -# Remove old release directory (Typically only on developer machine) -rm -rf release -# Create needed directories -mkdir -p release/docs/html -mkdir release/docs/markdown - -# Copy files to various directories -cp -r docs release/docs/markdown -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 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 -q ../utPLSQL.zip * -tar -zcf ../utPLSQL.tar.gz * -#Name of archive will match tag name for a release. -mv ../utPLSQL.zip utPLSQL${UTPLSQL_VERSION}.zip -mv ../utPLSQL.tar.gz utPLSQL${UTPLSQL_VERSION}.tar.gz - diff --git a/.travis/create_release.sh b/.travis/create_release.sh deleted file mode 100644 index 3a250d547..000000000 --- a/.travis/create_release.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Change working directory to script directory -cd "${0%/*}" -chmod +x ./build_docs.sh -chmod +x ./create_release_archive.sh - -bash ./build_docs.sh -bash ./create_release_archive.sh diff --git a/.travis/push_docs_to_gh_pages.sh b/.travis/push_docs_to_gh_pages.sh index 1d2f5648f..4c8ee918b 100644 --- a/.travis/push_docs_to_gh_pages.sh +++ b/.travis/push_docs_to_gh_pages.sh @@ -1,24 +1,24 @@ #!/bin/bash - + # Many aspsects of this came from https://gist.github.com/domenic/ec8b0fc8ab45f39403dd # Significant alterations -# - Avoid pulling all history for cloned repo -# - Support for multiple copies of documenation, +# - Avoid pulling all history for cloned repo +# - Support for multiple copies of documenation, # - only clearing out latest # - doc-history.md logging doc history # - Wrapped calls with actual encrypt keys with > /dev/null 2> /dev/null4 -# How to run: +# How to run: # - From repository root .travis/push_docs_to_gh_pages.sh # Required files / directories (relative from repo root) # - Folder : "site" with that contains latest docs -# - File : ".travis/deploy_key.enc" SSH deployment key encrypted by Travis command line tool +# - File : ".travis/deploy_key.enc" SSH deployment key encrypted by Travis command line tool # Required ENV Variables # ENCRYPTION_LABEL - Manually Set in travis web settings. Value can be displayed in LOG # encrypted_${ENCRYPTION_LABEL}_key - Set in web settings using travis cmdline encryption -# encrypted_${ENCRYPTION_LABEL}_iv - Set in web settings using travis cmdline encryption +# encrypted_${ENCRYPTION_LABEL}_iv - Set in web settings using travis cmdline encryption # PAGES_TARGET_BRANCH="gh-pages" - Set in .travis.yml, branch were pages will be deployed # PAGES_VERSION_BASE="version3" -Set in .travis.yml, directory for pages deployment # TRAVIS_* variables are set by travis directly and only need to be if testing externally @@ -26,20 +26,20 @@ # Pull requests are special... # They won't have acceess to the encrypted variables. # This prevent access to the Encrypted SSH Key -# Regardless we don't want a pull request automatically updating the repository -if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then +# Regardless we don't want a pull request automatically updating the repository +if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then # ENV Variable checks are to help with configuration troubleshooting # they silently exit with unique message. Anyone one of them not set - # can be used to turn off this functionality. - # For example a feature branch in the master repository that we don't want docs produced for yet. + # can be used to turn off this functionality. + # For example a feature branch in the master repository that we don't want docs produced for yet. [[ -n "$PAGES_VERSION_BASE" ]] || { echo "PAGES_VERSION_BASE Missing"; exit 0; } [[ -n "$PAGES_TARGET_BRANCH" ]] || { echo "PAGES_TARGET_BRANCH Missing"; exit 0; } [[ -n "$ENCRYPTION_LABEL" ]] || { echo "ENCRYPTION_LABEL Missing"; exit 0; } - + # Fail because required script to generate documenation must have not been run, or was changed. [[ -d ./site ]] || { echo "site directory not found"; exit 1; } - + # Save some useful information REPO=`git config remote.origin.url` SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} @@ -50,32 +50,32 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then cd pages git clone --depth 1 $REPO . PAGES_BRANCH_EXISTS=$(git ls-remote --heads $REPO $PAGES_TARGET_BRANCH) - + if [ -n "$PAGES_BRANCH_EXISTS" ] ; then echo "Pages Branch Found" echo "-$PAGES_BRANCH_EXISTS-" git remote set-branches origin $PAGES_TARGET_BRANCH - git fetch --depth 1 origin $PAGES_TARGET_BRANCH - git checkout $PAGES_TARGET_BRANCH + git fetch --depth 1 origin $PAGES_TARGET_BRANCH + git checkout $PAGES_TARGET_BRANCH else echo "Creating Pages Branch" - git checkout --orphan $PAGES_TARGET_BRANCH - git rm -rf . - fi - - #clear out latest and copy site contents to it. + git checkout --orphan $PAGES_TARGET_BRANCH + git rm -rf . + fi + + #clear out latest and copy site contents to it. echo "updating $VERSION_BASE/latest" - mkdir -p $PAGES_VERSION_BASE/latest + mkdir -p $PAGES_VERSION_BASE/latest rm -rf $PAGES_VERSION_BASE/latest/**./* || exit 0 - cp -a ../site/. $PAGES_VERSION_BASE/latest - + cp -a ../docs/html/. $PAGES_VERSION_BASE/latest + # If a Tagged Build then copy to it's own directory as well. if [ -n "$TRAVIS_TAG" ]; then echo "Creating $PAGES_VERSION_BASE/$TRAVIS_TAG" mkdir -p $PAGES_VERSION_BASE/$TRAVIS_TAG || exit 0 - cp -a ../site/. $PAGES_VERSION_BASE/$TRAVIS_TAG + cp -a ../docs/html/. $PAGES_VERSION_BASE/$TRAVIS_TAG fi - + #Check if there are doc changes, if none exit the script if [[ -z `git diff --exit-code` ]] && [ -n "$PAGES_BRANCH_EXISTS" ] ; then echo "No changes to docs detected." @@ -84,7 +84,7 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then #Chganges where detected, so it's safe to write to log. now=$(date +"%d %b %Y - %r") - export latest=" - [Latest Doc Change]($PAGES_VERSION_BASE/latest/) - Created $now" + export latest=" - [Latest Doc Change]($PAGES_VERSION_BASE/latest/) - Created $now" if [ ! -f doc-history.md ]; then echo "" >doc-history.md echo "#Doc Generation Log" >>doc-history.md @@ -93,13 +93,13 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "" >>doc-history.md echo "##Released Version Doc History" >>doc-history.md echo "" >>doc-history.md - fi + fi if [ -n "$TRAVIS_TAG" ]; then echo " - [$TRAVIS_TAG]($PAGES_VERSION_BASE/$TRAVIS_TAG/) - Created $now" >>doc-history.md - fi - + fi + #replace 4th line in log - sed -i '4s@.*@'"$latest"'@' doc-history.md + sed -i '4s@.*@'"$latest"'@' doc-history.md #Setup Git with Commiter info git config user.name "Travis CI" @@ -108,7 +108,7 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then #Add and Commit the changes back to pages repo. git add . git commit -m "Deploy to GitHub Pages: ${SHA}" - + #unencrypt and configure deployment key [[ -e ../.travis/deploy_key.enc ]] || { echo ".travis/deploy_key.enc file not found"; exit 1; } ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" @@ -118,9 +118,9 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../.travis/deploy_key.enc -out ../.travis/deploy_key -d > /dev/null 2> /dev/null chmod 600 ../.travis/deploy_key eval `ssh-agent -s` - ssh-add ../.travis/deploy_key - + ssh-add ../.travis/deploy_key + # Now that we're all set up, we can push. echo "git push $SSH_REPO $PAGES_TARGET_BRANCH" - git push $SSH_REPO $PAGES_TARGET_BRANCH + git push $SSH_REPO $PAGES_TARGET_BRANCH fi diff --git a/.travis/python_req.txt b/.travis/python_req.txt deleted file mode 100644 index 016bb16df..000000000 --- a/.travis/python_req.txt +++ /dev/null @@ -1 +0,0 @@ -mkdocs diff --git a/.travis/release/build_docs.sh b/.travis/release/build_docs.sh new file mode 100644 index 000000000..fd5a40a3b --- /dev/null +++ b/.travis/release/build_docs.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# Change working directory to project root +cd "${UTPLSQL_PROJECT_ROOT}" +mkdocs build --clean --strict diff --git a/.travis/release/commit_and_push.sh b/.travis/release/commit_and_push.sh new file mode 100644 index 000000000..48cb81553 --- /dev/null +++ b/.travis/release/commit_and_push.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +#inspired by: +# https://github.com/travis-ci/travis-ci/issues/1476 +# http://stackoverflow.com/questions/36915499/push-to-git-master-branch-from-travis-ci +current_dir=`pwd` +commit_message="${1}" + +cd "${UTPLSQL_PROJECT_ROOT}" + +git config --global user.email "builds@travis-ci.com" +git config --global user.name "${UTPLSQL_BUILD_USER_NAME}" + +echo Adding new/modified/removed files +git add --all . +echo Commiting changes +git commit --quiet -m "${commit_message}" +echo Pushing + +# As suggested here: https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth +# "To avoid writing tokens to disk, don't clone. Instead, just use the full git URL in your push/pull operations (with `.git` suffix)" +git push --quiet https://${github_api_token}@github.com/${UTPLSQL_REPO}.git HEAD:${CURRENT_BRANCH} + +cd "${current_dir}" diff --git a/.travis/release/create_tag.sh b/.travis/release/create_tag.sh new file mode 100644 index 000000000..fbc0b2553 --- /dev/null +++ b/.travis/release/create_tag.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +COMMIT_SHA=`git rev-parse HEAD` + +#github API documentation: https://developer.github.com/v3/repos/releases/#create-a-release +#using https://stedolan.github.io/jq/ +curl -H "Authorization: token ${github_api_token}" \ +-X POST --data '{"name":"'${UTPLSQL_VERSION}'","tag_name":"'${UTPLSQL_VERSION}'","target_commitish":"'${COMMIT_SHA}'","prerelease":true' "https://api.github.com/repos/${UTPLSQL_REPO}/releases" diff --git a/.travis/release/make_release.sh b/.travis/release/make_release.sh new file mode 100644 index 000000000..8b88c8dbb --- /dev/null +++ b/.travis/release/make_release.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +cd "${0%/*}" + +#Assumptions: +# - update project version was executed using update_project_version.sh +# - docs were build and committed using build_docs.sh + +echo Committing project version update and html docs +. ./commit_and_push.sh "Updated project version (${UTPLSQL_VERSION}) and added html docs [skip ci]" + +echo Creating a release tag "${UTPLSQL_VERSION}" +. ./create_tag.sh + +echo Preparing release branch for merge to develop +echo Removing generated html doc +rm -rf ${UTPLSQL_PROJECT_ROOT}/docs/html + +echo Committing html docs cleanup +. ./commit_and_push.sh "Cleanup of release of version (${UTPLSQL_VERSION}) [skip ci]" diff --git a/.travis/release/readme.md b/.travis/release/readme.md new file mode 100644 index 000000000..3e9ce6674 --- /dev/null +++ b/.travis/release/readme.md @@ -0,0 +1,33 @@ +#Creating a release + +To build a new release from a branch of utPLSQL project do the following: + +- Decide on the version number to be created follow the [semantic versioning](http://semver.org/) +- Create a new branch named in one of the following formats: + - `release/vMAJOR.MINOR.PATCH` + - `release/vMAJOR.MINOR.PATCH-alpha` + - `release/vMAJOR.MINOR.PATCH-beta` + - `release/vMAJOR.MINOR.PATCH-something` + +The naming convention is there to instruct Travis to do a release from build on that branch. + +Version to be built is extracted from the branch name. + +The list of project files to be excluded from a release is controlled by content of `.gitattributes` file. + + +#The Release build + +Release build is performing all the activities of regular build and additionally dose the following: +- Cleans the working copy +- Updates all project files with new version number +- Generates html documentation +- Commits and pushes +- Creates a release tag and publishes the release artifacts +- Removes generated documentation +- Commits and pushes + + +#Post release tasks + +Once the release is published, it is recommended to merge it to the develop branch and delete it after. diff --git a/.travis/release/update_project_version.sh b/.travis/release/update_project_version.sh new file mode 100644 index 000000000..f3632f339 --- /dev/null +++ b/.travis/release/update_project_version.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +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 Update of sonar-project.properties sonar.projectVersion +sed -i -r "s/(sonar\.projectVersion=).*?/\1${UTPLSQL_VERSION}/" sonar-project.properties +echo Setting project version in VERSION file +echo ${UTPLSQL_VERSION} > VERSION diff --git a/.travis/update_project_version.sh b/.travis/update_project_version.sh deleted file mode 100644 index e73b57f28..000000000 --- a/.travis/update_project_version.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/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 diff --git a/CONTRIBUTING.md b/docs/md/about/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to docs/md/about/CONTRIBUTING.md diff --git a/authors.md b/docs/md/about/authors.md similarity index 100% rename from authors.md rename to docs/md/about/authors.md diff --git a/docs/about/license.md b/docs/md/about/license.md similarity index 100% rename from docs/about/license.md rename to docs/md/about/license.md diff --git a/docs/about/project-details.md b/docs/md/about/project-details.md similarity index 83% rename from docs/about/project-details.md rename to docs/md/about/project-details.md index 56e216f00..53bc1bedb 100644 --- a/docs/about/project-details.md +++ b/docs/md/about/project-details.md @@ -8,8 +8,7 @@ utPLSQL is hosted on [hosted on GitHub](https://github.com/utPLSQL/utPLSQL) and open source project. -Community help on this project is always appreciated, if your interested in helping please read our [guide to contributing](https://github.com/utPLSQL/utPLSQL/blob/master/CONTRIBUTING.md) +Community help on this project is always appreciated, if your interested in helping please read our [guide to contributing](CONTRIBUTING.md) - \ No newline at end of file diff --git a/docs/about/support.md b/docs/md/about/support.md similarity index 100% rename from docs/about/support.md rename to docs/md/about/support.md diff --git a/docs/index.md b/docs/md/index.md similarity index 100% rename from docs/index.md rename to docs/md/index.md diff --git a/docs/userguide/annotations.md b/docs/md/userguide/annotations.md similarity index 100% rename from docs/userguide/annotations.md rename to docs/md/userguide/annotations.md diff --git a/docs/userguide/best-practices.md b/docs/md/userguide/best-practices.md similarity index 100% rename from docs/userguide/best-practices.md rename to docs/md/userguide/best-practices.md diff --git a/docs/userguide/coverage.md b/docs/md/userguide/coverage.md similarity index 100% rename from docs/userguide/coverage.md rename to docs/md/userguide/coverage.md diff --git a/docs/userguide/exception-reporting.md b/docs/md/userguide/exception-reporting.md similarity index 100% rename from docs/userguide/exception-reporting.md rename to docs/md/userguide/exception-reporting.md diff --git a/docs/userguide/expectations.md b/docs/md/userguide/expectations.md similarity index 100% rename from docs/userguide/expectations.md rename to docs/md/userguide/expectations.md diff --git a/docs/userguide/getting-started.md b/docs/md/userguide/getting-started.md similarity index 100% rename from docs/userguide/getting-started.md rename to docs/md/userguide/getting-started.md diff --git a/docs/userguide/images/coverage_html_details.png b/docs/md/userguide/images/coverage_html_details.png similarity index 100% rename from docs/userguide/images/coverage_html_details.png rename to docs/md/userguide/images/coverage_html_details.png diff --git a/docs/userguide/images/coverage_html_summary.png b/docs/md/userguide/images/coverage_html_summary.png similarity index 100% rename from docs/userguide/images/coverage_html_summary.png rename to docs/md/userguide/images/coverage_html_summary.png diff --git a/docs/userguide/install.md b/docs/md/userguide/install.md similarity index 100% rename from docs/userguide/install.md rename to docs/md/userguide/install.md diff --git a/docs/userguide/reporters.md b/docs/md/userguide/reporters.md similarity index 100% rename from docs/userguide/reporters.md rename to docs/md/userguide/reporters.md diff --git a/docs/userguide/running-unit-tests.md b/docs/md/userguide/running-unit-tests.md similarity index 100% rename from docs/userguide/running-unit-tests.md rename to docs/md/userguide/running-unit-tests.md diff --git a/docs/userguide/upgrade.md b/docs/md/userguide/upgrade.md similarity index 100% rename from docs/userguide/upgrade.md rename to docs/md/userguide/upgrade.md diff --git a/mkdocs.yml b/mkdocs.yml index 0ae687e2e..f8a79c49f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,8 +4,10 @@ site_name: utPLSQL site_description: utPLSQL Documenation Powerful Unit Testing Framework for Oracle PL/SQL copyright: Copyright © 2016 - utPLSQL Team -repo_url: https://github.com/utplsql/utplsql/ +repo_url: https://github.com/utPLSQL/utPLSQL theme: mkdocs +site_dir: docs/html +docs_dir: docs/md use_directory_urls: false strict: true @@ -16,9 +18,16 @@ pages: - Getting Started: userguide/getting-started.md - Annotations: userguide/annotations.md - Expectations: userguide/expectations.md - - Testing Best Pracitces: userguide/best-practices.md - - Upgrade utPLSQL : userguide/upgrade.md + - Running unit tests: userguide/running-unit-tests.md + - Testing best pracitces: userguide/best-practices.md + - Upgrade utPLSQL: userguide/upgrade.md + - Reporting: + - Using reporters: userguide/reporters.md + - Reporting errors: userguide/exception-reporting.md + - Code coverage: userguide/coverage.md - About: - Project Details: about/project-details.md - License: about/license.md - Support: about/support.md + - Authors: about/authors.md + - Contributing: about/CONTRIBUTING.md diff --git a/readme.md b/readme.md index 0ff69a258..3d72c3f2d 100644 --- a/readme.md +++ b/readme.md @@ -24,8 +24,8 @@ Primary features: - Support for User Defined Object Types and Collections - Support for native cursors both strong and weak - Data-type aware testing - - [Annotations](docs/userguide/annotations.md) based test definitions - - Extensible [matchers](docs/userguide/expectations.md) + - [Annotations](docs/md/userguide/annotations.md) based test definitions + - Extensible [matchers](docs/md/userguide/expectations.md) - Extensible reporting formats - Extensible output providers - Support for multi-reporting @@ -43,6 +43,7 @@ __Download__ Published releases are available for download on the [utPLSQL GitHub Releases Page.](https://github.com/utPLSQL/utPLSQL/releases) +[__Authors__](docs/md/about/authors.md) __Version 2 to Version 3 Comparison__ @@ -104,14 +105,14 @@ cd source sqlplus admin/admins_password@xe @@install_headless.sql ``` -For detailed instructions on other install options see the [Install Guide](docs/userguide/install.md) +For detailed instructions on other install options see the [Install Guide](docs/md/userguide/install.md) # Example test package The below test package is a fully-functional Unit Test package for testing a function `betwnstr`. -Package specification is annotated with special comments ([annotations](docs/userguide/annotations.md)). +Package specification is annotated with special comments ([annotations](docs/md/userguide/annotations.md)). Annotations define that a package is a unit test suite, they also allow defining a description for the suite as well as the test itself. -Package body consists of procedures containing unit test code. To validate [an expectation](docs/userguide/expectations.md) in test, use `ut.expect( actual_data ).to_( ... )` syntax. +Package body consists of procedures containing unit test code. To validate [an expectation](docs/md/userguide/expectations.md) in test, use `ut.expect( actual_data ).to_( ... )` syntax. ```sql @@ -194,19 +195,16 @@ c:\my_work\>sqlplus /nolog @ut_run hr/hr@xe Will run all the suites in the current schema (hr) and provide documentation report into screen. Invoking this script will show the progress after each test. +# Contributing to the project -__Primary Directories__ +Community help on is always appreciated, if your interested in helping please read our [guide to contributing](docs/md/about/CONTRIBUTING.md) + +__Project Directories__ * .travis - contains files needed for travis-ci integration * client_source - Sources to be used on the client-side. Developer workstation or CI platform to run the tests. * development - Set of useful scripts and utilities for development and debugging of utPLSQL -* docs - Markdown version of the documentation +* docs/md - Markdown version of the documentation * examples - contains example unit tests. * source - contains the installation code for utPLSQL -* tests - contains the tests written to test utPLSQL - - - - - - +* tests - contains the tests for utPLSQL framework diff --git a/source/readme.md b/source/readme.md index dad875b06..a4585d6fe 100644 --- a/source/readme.md +++ b/source/readme.md @@ -12,4 +12,4 @@ cd source sqlplus admin/admins_password@xe @@install_headless.sql ``` -For detailed instructions on other install options see the [Install Guide](../docs/userguide/install.md) +For detailed instructions on other install options see the [Install Guide](../docs/md/userguide/install.md)