Skip to content

Commit

Permalink
Store code cov percentage for badge display and flip pypi pointer (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
schahal authored Jul 16, 2020
1 parent 9be9dfd commit c029385
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ jobs:
- name: Build and publish
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }}
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
export PROTOC=$(pwd)/bin/protoc
export VERSION=$(./GENVER --pep440)
HOME=$(pwd) python setup.py sdist bdist_wheel
ls -ltr dist/
python -m twine upload --repository-url=https://test.pypi.org/legacy/ dist/*
python -m twine upload dist/*
- name: Bump VERSION file and commit
run: |
Expand Down
25 changes: 19 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pipeline {
}
}
steps{
/* .. remove "--run-integration" to have a mini test ..*/
// .. remove "--run-integration" to have a mini test ..
sh "cd tests && python3 -m pytest -s --run-integration --junitxml=test_local.xml --cov=autodist --cov-branch --cov-report term-missing --ignore=integration/test_dist.py . && mv .coverage .coverage.local.tf1"
}
post {
Expand All @@ -73,7 +73,7 @@ pipeline {
}
}
steps{
/* .. remove "--run-integration" to have a mini test ..*/
// .. remove "--run-integration" to have a mini test ..
sh "cd tests && python3 -m pytest -s --run-integration --junitxml=test_local.xml --cov=autodist --cov-branch --cov-report term-missing --ignore=integration/test_dist.py . && mv .coverage .coverage.local.tf2"
}
post {
Expand Down Expand Up @@ -141,15 +141,28 @@ pipeline {
unstash 'testcov_local_tf2'
unstash 'testcov_distributed_chief'
unstash 'testcov_distributed_worker'
sh 'coverage combine tests/'
sh 'coverage report'
sh 'coverage html -d htmlcov'
sh "tar -zcvf htmlcov.tar.gz htmlcov"

sh """#!/bin/bash
coverage combine tests/
coverage report
coverage html -d htmlcov
tar -zcvf htmlcov.tar.gz htmlcov
# Create JSON to dynamically get total coverage percentage
total_coverage_line=\$(grep '<span class="pc_cov">.*%</span>' htmlcov/index.html | head -n 1)
capture_regex='<span class="pc_cov">(.*)?</span>'
if [[ \${total_coverage_line} =~ \${capture_regex} ]]; then
pct="\${BASH_REMATCH[@]:1}"
echo '{"total_coverage_pct":"'\${pct}'"}' > jenkinscovdata.json
fi
"""
}
}
post {
success {
archiveArtifacts allowEmptyArchive: true, artifacts: 'coverage-report/htmlcov.tar.gz', fingerprint: true
archiveArtifacts allowEmptyArchive: true, artifacts: 'coverage-report/jenkinscovdata.json', fingerprint: true
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

<p align="center"><img src="docs/_static/img/logo.png" width=400 /></p>

[![pipeline status](https://gitlab.int.petuum.com/internal/scalable-ml/autodist/badges/master/pipeline.svg)](https://gitlab.int.petuum.com/internal/scalable-ml/autodist/commits/master)
[![coverage report](https://gitlab.int.petuum.com/internal/scalable-ml/autodist/badges/master/coverage.svg)](https://gitlab.int.petuum.com/internal/scalable-ml/autodist/commits/master)
[![pipeline status](https://img.shields.io/badge/dynamic/json?url=https://jenkins.petuum.io/job/AutoDist/job/master/lastBuild/api/json&label=build&query=$.result&color=important)](https://github.com/petuum/autodist/commits/master)
[![coverage report](https://img.shields.io/badge/dynamic/json?url=https://jenkins.petuum.io/job/AutoDist/job/master/lastSuccessfulBuild/artifact/coverage-report/jenkinscovdata.json&label=coverage&query=$.total_coverage_pct&color=important)](https://github.com/petuum/autodist/commits/master)

[Documentation](https://petuum.github.io/autodist) |
[Examples](https://github.com/petuum/autodist/tree/master/examples/benchmark)
Expand Down

0 comments on commit c029385

Please sign in to comment.