From 6145f463a86bc387d01fd74c64f6389d02d2eba9 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Thu, 5 Nov 2020 22:00:47 +0100 Subject: [PATCH 1/6] Experiment with different install mechanism to get coverage --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e6de4dc..340e5409 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,7 +106,8 @@ jobs: pip install --upgrade setuptools pip wheel pip install --upgrade -r dev-requirements.txt python setup.py bdist_wheel - pip install dist/*.whl + #pip install dist/*.whl + pip install -e. pip freeze # hg-evolve pinned to 9.2 because hg-evolve dropped support for # hg 4.5, installed with apt in Ubuntu 18.04 From b96412bd338917f1f919fe4f7c349b8f34e0cbda Mon Sep 17 00:00:00 2001 From: Tim Head Date: Thu, 5 Nov 2020 22:14:30 +0100 Subject: [PATCH 2/6] Specify coverage rule to combine results We can specify a rule to map different source files from which coverage stats were collected to the same source file in our repository. --- .coveragerc | 8 ++++++++ .github/workflows/test.yml | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.coveragerc b/.coveragerc index f2a1e5ce..62e14303 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,11 @@ [run] # this file comes from versioneer and we don't test it omit = */_version.py + +[paths] +# This tells coverage how to combine results together or said differently +# which files at different paths are actually the same file +# documented at https://coverage.readthedocs.io/en/latest/config.html#paths +source = + repo2docker/ + /opt/hostedtoolcache/Python/*/site-packages/repo2docker diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 340e5409..4e6de4dc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,8 +106,7 @@ jobs: pip install --upgrade setuptools pip wheel pip install --upgrade -r dev-requirements.txt python setup.py bdist_wheel - #pip install dist/*.whl - pip install -e. + pip install dist/*.whl pip freeze # hg-evolve pinned to 9.2 because hg-evolve dropped support for # hg 4.5, installed with apt in Ubuntu 18.04 From d56deb02dd4fa6804b39636713587fbdef3b3a7e Mon Sep 17 00:00:00 2001 From: Tim Head Date: Fri, 6 Nov 2020 07:44:53 +0100 Subject: [PATCH 3/6] Changeg source file aliasing --- .coveragerc | 9 +++++++-- .github/workflows/test.yml | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.coveragerc b/.coveragerc index 62e14303..937d6069 100644 --- a/.coveragerc +++ b/.coveragerc @@ -6,6 +6,11 @@ omit = */_version.py # This tells coverage how to combine results together or said differently # which files at different paths are actually the same file # documented at https://coverage.readthedocs.io/en/latest/config.html#paths +# Yes, we list repo2docker twice here. This allows you to install repo2docker +# with `pip install -e.` for local development and from the wheel (as done on +# CI) and get `repo2docker/foo.py` as paths in the coverage report source = - repo2docker/ - /opt/hostedtoolcache/Python/*/site-packages/repo2docker + repo2docker + repo2docker + ../repo2docker + */site-packages/repo2docker diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e6de4dc..d5a1eddb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,7 +114,10 @@ jobs: - name: "Run tests" run: | - pytest --durations 10 --cov repo2docker -v tests/${{ matrix.repo_type }} + cd tests + pytest --durations 10 --cov repo2docker -v ${{ matrix.repo_type }} # Action Repo: https://github.com/codecov/codecov-action - uses: codecov/codecov-action@v1 + with: + directory: ./tests From 79325be491301e2049ebf3a9793dc80d84400b2b Mon Sep 17 00:00:00 2001 From: Tim Head Date: Fri, 6 Nov 2020 09:22:05 +0100 Subject: [PATCH 4/6] Set working directory for codecov action --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5a1eddb..ceb6ea1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -119,5 +119,6 @@ jobs: # Action Repo: https://github.com/codecov/codecov-action - uses: codecov/codecov-action@v1 + working-directory: ./tests with: directory: ./tests From da6e08aec08188368e3c61295f29789e4aa3f31f Mon Sep 17 00:00:00 2001 From: Tim Head Date: Fri, 6 Nov 2020 09:48:39 +0100 Subject: [PATCH 5/6] Use Python codecov package instead of GH action We can't set the working directory of the GH Action which means we need to install codecov ourselves and run it in the `tests/` sub-directory. --- .github/workflows/test.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ceb6ea1a..424cf37b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -117,8 +117,7 @@ jobs: cd tests pytest --durations 10 --cov repo2docker -v ${{ matrix.repo_type }} - # Action Repo: https://github.com/codecov/codecov-action - - uses: codecov/codecov-action@v1 - working-directory: ./tests - with: - directory: ./tests + - name: "Upload code coverage stats" + run: | + pip install codecov + pushd tests && codecov && popd From 3e6f99cefe624c73771463407bf885d918f77dc2 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Fri, 6 Nov 2020 11:11:32 +0100 Subject: [PATCH 6/6] Fix/rewrite paths for codecov filename matching --- .codecov.yml | 6 ++++-- .github/workflows/test.yml | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 62be777b..8836913f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,5 +1,7 @@ -# show coverage in CI status, not as a comment. +# show coverage in CI status, not as a comment. comment: off +fixes: + - "*/site-packages/::" coverage: status: project: @@ -7,4 +9,4 @@ coverage: target: auto patch: default: - target: 20% + target: 20% diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 424cf37b..5362a497 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -120,4 +120,5 @@ jobs: - name: "Upload code coverage stats" run: | pip install codecov - pushd tests && codecov && popd + pushd tests && codecov && cat + cat /home/runner/work/repo2docker/repo2docker/tests/coverage.xml