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

Commit

Permalink
ci: add code coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Jul 11, 2019
1 parent d7d72e9 commit 5e9c048
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 41 deletions.
13 changes: 13 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[run]
branch = True
source = gnes

[report]
exclude_lines =
if self.debug:
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
ignore_errors = True
omit =
tests/*
128 changes: 87 additions & 41 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,99 @@
#kind: pipeline
#name: default
#
#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="⌛🏗 Start a CI pipeline \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
# - export MSG_CONTENT="submit by [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL), click the link below to see the status"
# - ./shell/push-wechatwork.sh
#
#- name: check commit style
# image: node:alpine
# commands:
# - npm install --global --save-dev @commitlint/config-conventional @commitlint/cli
# - "echo \"module.exports = {extends: ['@commitlint/config-conventional']}\" > commitlint.config.js"
# - echo $DRONE_COMMIT_MESSAGE | commitlint
#
#- name: setup ci environment
# image: gnes/ci-base
# commands:
# - mkdir -p .cache && ln -snf $(pwd)/.cache $HOME/.cache
# - export PIP_DOWNLOAD_CACHE=${pwd}.cache/pip_download_cache && export XDG_CACHE_HOME=${pwd}.cache/pip
# - printf "XDG_CACHE_HOME=$XDG_CACHE_HOME\nPIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE\n"
# - cat /proc/cpuinfo | grep flags
# - "python -c 'import tensorflow as tf; print(tf.__version__); a=tf.constant(1, tf.int32); print(tf.Session().run(a))'"
#
#- name: pip-install gnes
# image: gnes/ci-base
# environment:
# GNES_ENV_SET: orange-ci
# commands:
# - pip install -e .[all]
# - pylint gnes/**/*.py --exit-zero
# - python -m unittest tests/*.py
#
#
#- 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="✅😃 All tests passed, good job! \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
# - export MSG_CONTENT="the branch \`$DRONE_SOURCE_BRANCH\` submit by [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) is ready to merge to master"
# - ./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="❌😥 CI pipeline \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`) is failed!"
# - 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:
# branch:
# - master
# event:
# - pull_request
#
#---

kind: pipeline
name: default
name: master-coverity

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="⌛🏗 Start a CI pipeline \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
- export MSG_TITLE="⌛🏗 Start to generate \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
- export MSG_CONTENT="submit by [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL), click the link below to see the status"
- ./shell/push-wechatwork.sh

- name: check commit style
image: node:alpine
commands:
- npm install --global --save-dev @commitlint/config-conventional @commitlint/cli
- "echo \"module.exports = {extends: ['@commitlint/config-conventional']}\" > commitlint.config.js"
- echo $DRONE_COMMIT_MESSAGE | commitlint

- name: setup ci environment
image: gnes/ci-base
commands:
Expand All @@ -37,40 +107,16 @@ steps:
image: gnes/ci-base
environment:
GNES_ENV_SET: orange-ci
CODECOV_TOKEN_PR:
from_secret: CODECOV_TOKEN_PR
commands:
- pip install -e .[all]
- pylint gnes/**/*.py --exit-zero
- python -m unittest tests/*.py


- 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="✅😃 All tests passed, good job! \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
- export MSG_CONTENT="the branch \`$DRONE_SOURCE_BRANCH\` submit by [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) is ready to merge to master"
- ./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="❌😥 CI pipeline \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`) is failed!"
- 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
- pip install coverage codecov
- coverage run tests/*.py
- codecov --token $CODECOV_TOKEN_PR

trigger:
branch:
- master
event:
- pull_request
- pull_request
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<a href="https://www.codacy.com/app/gnes-ai/gnes?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=gnes-ai/gnes&amp;utm_campaign=Badge_Grade">
<img src="https://api.codacy.com/project/badge/Grade/a9ce545b9f3846ba954bcd449e090984"/>
</a>
<a href="https://codecov.io/gh/gnes-ai/gnes">
<img src="https://codecov.io/gh/gnes-ai/gnes/branch/master/graph/badge.svg" />
</a>
<a href='https://github.com/gnes-ai/gnes/blob/master/LICENSE'>
<img alt="PyPI - License" src="https://img.shields.io/pypi/l/gnes.svg">
</a>
Expand Down

0 comments on commit 5e9c048

Please sign in to comment.