diff --git a/.github/run.sh b/.github/run.sh new file mode 100755 index 0000000000..da3e2e6c12 --- /dev/null +++ b/.github/run.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +docker run --rm -t \ + -v $(pwd):/src \ + -w /src \ + -e PYTHONPATH=/src \ + "$IMAGE" \ + "$@" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000000..4fc0d28019 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,37 @@ +name: 'coverage' + +on: + push: + schedule: + - cron: '0 0 * * 5' + +jobs: + + coverage: + runs-on: ubuntu-latest + env: + DOCKER_REGISTRY: docker.pkg.github.com + IMAGE: docker.pkg.github.com/vunit/vunit/dev:llvm + steps: + - uses: actions/checkout@v1 + - run: git submodule update --init --recursive + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Docker login + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "$GITHUB_TOKEN" | docker login -u vunit-gha --password-stdin "$DOCKER_REGISTRY" + docker pull $IMAGE + docker logout "$DOCKER_REGISTRY" + - name: Run coverage + run: | + ./.github/run.sh tox -e coverage + ./.github/run.sh coverage html --directory=htmlcov + - name: Report coverage + run: ./.github/run.sh coverage report -m --skip-covered + - uses: actions/upload-artifact@master + with: + name: VUnit_coverage + path: htmlcov diff --git a/tox.ini b/tox.ini index c34c5ada49..2e54f41f85 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{36,37,38}-fmt, py{35,36,37,38}-{unit}, py{35,36,37,38}-{lint,docs}, py{35,36,37,38}-{acceptance,vcomponents}-{activehdl,ghdl,modelsim,rivierapro} +envlist = py{36,37,38}-fmt, py{35,36,37,38}-{unit}, py{35,36,37,38}-{lint,docs}, py{35,36,37,38}-{acceptance,vcomponents}-{activehdl,ghdl,modelsim,rivierapro}, py{36,37,38}-coverage skip_missing_interpreters = True [testenv] @@ -11,6 +11,9 @@ deps= pytest lint: pycodestyle lint: pylint + coverage: coverage + coverage: pycodestyle + coverage: pylint docs: docutils docs: sphinx docs: sphinx-argparse @@ -29,3 +32,4 @@ commands= docs: {envpython} tools/build_docs.py {envtmpdir}/docsbuild acceptance: {envpython} -m pytest -v tests/acceptance vcomponents: {envpython} vunit/vhdl/verification_components/run.py --clean + coverage: {envpython} -m coverage run --branch --source vunit/ -m unittest discover tests/