Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into tf_inception_v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Larryjianfeng authored Jul 11, 2019
2 parents 2dd9e00 + d1680e8 commit f1f385f
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 20 deletions.
66 changes: 63 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ steps:
image: gnes/ci-base
environment:
GNES_ENV_SET: orange-ci
CODECOV_TOKEN_PR:
from_secret: CODECOV_TOKEN_PR
CODECOV_TOKEN:
from_secret: CODECOV_TOKEN
commands:
- pip install -e .[all]
- pip install coverage codecov
- coverage run -m unittest discover -s tests/
- coverage report --skip-covered
- codecov --token $CODECOV_TOKEN_PR
- codecov --token $CODECOV_TOKEN

- name: notify the sucess on wechat work
image: byrnedo/alpine-curl
Expand Down Expand Up @@ -138,3 +138,63 @@ trigger:
- master
event:
- push

---
kind: pipeline
name: cron job auto release

clone:
depth: 50

steps:
- name: notify the start on wechat work
image: byrnedo/alpine-curl
environment:
BOT_URL:
from_secret: BOT_URL
commands:
- export MSG_LINK=${DRONE_BUILD_LINK}
- export MSG_TITLE="⌛📜 Auto-bumping version \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
- export MSG_CONTENT="click the link below to see the status"
- ./shell/push-wechatwork.sh

- name: pip-install gnes
image: gnes/ci-base
environment:
GNES_ENV_SET: orange-ci
GITHUB_ACCESS_TOKEN:
from_secret: GITHUB_ACCESS_TOKEN
TWINE_USERNAME:
from_secret: TWINE_USERNAME
TWINE_PASSWORD:
from_secret: TWINE_PASSWORD
commands:
- ./release.sh

- name: notify the sucess on wechat work
image: byrnedo/alpine-curl
environment:
BOT_URL:
from_secret: BOT_URL
commands:
- export MSG_LINK=$DRONE_REPO_LINK
- export MSG_TITLE="✅😃 A new version is generated!"
- export MSG_CONTENT="Github Release, Docker, PyPi will be all updated!"
- ./shell/push-wechatwork.sh

- name: notify the failure on wechat work
image: byrnedo/alpine-curl
environment:
BOT_URL:
from_secret: BOT_URL
commands:
- export MSG_LINK=$DRONE_BUILD_LINK
- export MSG_TITLE="❌😥 Fail to generate new version!"
- export MSG_CONTENT="please inform [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) to modify and fix [\`$DRONE_SOURCE_BRANCH\`]($DRONE_COMMIT_LINK). click the link below to see the details."
- ./shell/push-wechatwork.sh
when:
status:
- failure

trigger:
cron: [ nightly ]
132 changes: 132 additions & 0 deletions .github/release-template.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<%
var groupCommits = [{
name: 'feat',
show: true,
list: []
}, {
name: 'fix',
show: true,
list: []
}, {
name: 'refactor',
show: true,
list: []
}, {
name: 'docs',
show: true,
list: []
}, {
name: 'other',
show: true,
list: []
}]
var all_titles = {};
commits.forEach(function (commit) {
var result = (commit.title).match(/^(\w*)(\((.*)\))?\: (.*)$/);
var type = result && result[1];
var scope = result && result[3];
var title = result && result[4];
if (!(title in all_titles)) {
all_titles[title] = 1
if(type == 'fix' || type == 'fixed'){
groupCommits.find(item => item.name === 'fix').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'feat' || type == 'feature'){
groupCommits.find(item => item.name === 'feat').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'refactor'){
groupCommits.find(item => item.name === 'refactor').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'docs' || type == 'doc'){
groupCommits.find(item => item.name === 'docs').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else {
groupCommits.find(item => item.name === 'other').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
}
}
});
var listCommits = function(list, key){
list.forEach(function (ct) {
var type = ct.type;
var scope = ct.scope;
var title = '';
var commit = ct.commit;
if(type){
if(key != 'other'){
title = (scope? '__'+scope+'__: ':'') + ct.title;
}else{
title = '__' + type + (scope? '('+scope+')':'') + '__ : ' + ct.title;
}
}else{
title = commit.title;
}
%> - <% if(typeof commitHref === 'undefined' || commitHref === '') { %>[```<%=commit.sha1.slice(0,8)%>```]<% } else { %>[[```<%=commit.sha1.slice(0,8)%>```](<%=commitHref%><%=commit.sha1%>)]<%}%> __-__ <%=title%> (<%= commit.authorName %>)
<% })}
%>

# Release Notes

<%
for(var i of groupCommits){
if(i.list.length == 0) continue;
if (i.name === 'fix' && i.show) { %>
### Bug fixes
<% } else if( i.name === 'feat' && i.show) { %>
### New Features
<% } else if(i.name === 'refactor' && i.show) { %>
### Code Refactoring
<% } else if(i.name === 'docs' && i.show) { %>
### Documentation
<% } else if (i.name === 'other' && i.show) { %>
### Other Improvements
<% }
i.show && listCommits(i.list, i);
} %>
4 changes: 3 additions & 1 deletion gnes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@

# pylint: disable=low-comment-ratio

__version__ = '0.0.15'
# do not change this line
# this is managed by git tag and replaced on every release
__version__ = '0.0.0-dev'
34 changes: 18 additions & 16 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

set -e

CODE_BASE='gnes/__init__.py'
INIT_FILE='gnes/__init__.py'
TMP_INIT_FILE='.__init__.py.tmp'
VER_TAG='__version__ = '
SOURCE_ORIGIN='github'
SOURCE_ORIGIN='origin'

function escape_slashes {
sed 's/\//\\\//g'
Expand All @@ -17,7 +18,7 @@ function change_line {

local NEW=$(echo "${NEW_LINE}" | escape_slashes)
sed -i .bak '/'"${OLD_LINE_PATTERN}"'/s/.*/'"${NEW}"'/' "${FILE}"
mv "${FILE}.bak" /tmp/
mv "${FILE}.bak" ${TMP_INIT_FILE}
}


Expand All @@ -36,10 +37,8 @@ function pub_pypi {
}

function pub_gittag {
git add -u
git commit -m "bumping version to $VER"
git push $SOURCE_ORIGIN master
git tag $VER
git tag $VER -m "$(cat ./CHANGELOG.md)"
git remote add $SOURCE_ORIGIN https://hanxiao:${GITHUB_ACCESS_TOKEN}@github.com/gnes-ai/gnes.git
git push $SOURCE_ORIGIN $VER
}

Expand All @@ -54,19 +53,22 @@ fi
VER=$(git tag -l | sort -V |tail -n1)
printf "current version:\t\e[1;33m$VER\e[0m\n"

git-release-notes v$VER..HEAD .github/release-template.ejs > ./CHANGELOG.md

VER=$(echo $VER | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
printf "bump version to:\t\e[1;32m$VER\e[0m\n"

read -p "release this version? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# write back tag to client and server code
VER_VAL=$VER_TAG"'"${VER#"v"}"'"
change_line "$VER_TAG" "$VER_VAL" $CODE_BASE
pub_pypi
pub_gittag
fi
#echo # (optional) move to a new line
#if [[ $REPLY =~ ^[Yy]$ ]]
#then
# write back tag to client and server code
VER_VAL=$VER_TAG"'"${VER#"v"}"'"
change_line "$VER_TAG" "$VER_VAL" $INIT_FILE
pub_pypi
pub_gittag
mv ${TMP_INIT_FILE} $INIT_FILE
#fi



0 comments on commit f1f385f

Please sign in to comment.