Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github-actions: add codecov upload #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Jul 7, 2020

This adds an upload of the coverage report to codecov. This way, we can track if a PR increases or decreases test coverage.

Requires #2 to be mergable into protected branch 😅

@miri64 miri64 added the enhancement New feature or request label Jul 7, 2020
@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch 6 times, most recently from 938c854 to 2be5a27 Compare July 7, 2020 07:48
tox.ini Outdated Show resolved Hide resolved
@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch from 2be5a27 to d59e4e8 Compare July 7, 2020 08:13
@miri64
Copy link
Member Author

miri64 commented Jul 7, 2020

Rebased to current master and squashed comments

@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2020

Codecov Report

❗ No coverage uploaded for pull request head (gh-actions/enh/codecov-upload@eb339aa). Click here to learn what that means.
The diff coverage is n/a.

@miri64
Copy link
Member Author

miri64 commented Jul 7, 2020

@aabadie
Copy link
Contributor

aabadie commented Jul 7, 2020

Maybe try with a new version of the codecov action. On riot-generator, the version is 1.0.7.

.github/workflows/tox.yml Outdated Show resolved Hide resolved
@miri64
Copy link
Member Author

miri64 commented Jul 7, 2020

I have the feeling this might be because it is not in the master branch :-/.

@miri64
Copy link
Member Author

miri64 commented Jul 7, 2020

From the PR's report

#1 updated by miri64 Missing base report.

@miri64
Copy link
Member Author

miri64 commented Jul 7, 2020

I deactivated branch protection and directly pushed to master to test my hypothesis. Will clean-up after.

@miri64
Copy link
Member Author

miri64 commented Jul 7, 2020

(pushing to a test branch did not work as that branch then is ignored by Github Actions)

@miri64 miri64 force-pushed the master branch 5 times, most recently from d6a343e to 4b57c84 Compare July 7, 2020 13:39
@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch from 56c64cf to 96642be Compare July 7, 2020 13:40
@miri64
Copy link
Member Author

miri64 commented Jul 7, 2020

It's an issue with the codecov-action workflow -.- codecov/codecov-action#85. I'll apply the workaround there in an extra commit.

@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch 3 times, most recently from da5cfef to fde0768 Compare July 7, 2020 14:00
.github/workflows/tox.yml Outdated Show resolved Hide resolved
@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch from e4feb0d to eb339aa Compare September 24, 2020 15:12
@miri64
Copy link
Member Author

miri64 commented Sep 24, 2020

Still doesn't work :(

@miri64
Copy link
Member Author

miri64 commented Sep 24, 2020

@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch 2 times, most recently from 147e9a4 to 82349b8 Compare January 22, 2021 11:14
@miri64
Copy link
Member Author

miri64 commented Jan 22, 2021

Let's give this another chance

@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch from 82349b8 to 2381524 Compare January 22, 2021 11:49
@codecov-io
Copy link

codecov-io commented Jan 22, 2021

Codecov Report

Merging #1 (413badb) into master (c141a9b) will increase coverage by 19.33%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           master        #1       +/-   ##
============================================
+ Coverage   80.66%   100.00%   +19.33%     
============================================
  Files           9         2        -7     
  Lines         269        60      -209     
  Branches        0         4        +4     
============================================
- Hits          217        60      -157     
+ Misses         52         0       -52     
Flag Coverage Δ
3.5 ?
3.6 98.30% <96.15%> (+17.63%) ⬆️
3.7 98.30% <96.15%> (+17.63%) ⬆️
3.8 98.33% <96.15%> (?)
3.9 98.33% <96.15%> (?)
test 98.33% <96.15%> (?)
test-rapidjson 61.66% <76.92%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
riotctrl/shell/__init__.py 100.00% <100.00%> (ø)
riotctrl/shell/json.py 100.00% <100.00%> (ø)
riotctrl/tests/utils/application/echo.py
riotctrl/tests/utils/application/create_file.py
riotctrl/tests/utils/application/ctrl.py
riotctrl/tests/riotctrl_test.py
riotctrl/tests/utils/application/sigkill_script.py
riotctrl/tests/utils/application/shell.py
riotctrl/tests/utils/application/hello.py
riotctrl/tests/ctrl_test.py
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b30a25...413badb. Read the comment docs.

@miri64
Copy link
Member Author

miri64 commented Jan 22, 2021

That seemed to have triggered something. At least now it does not insist on measuring the coverage of the tests and nothing of the module. ^^

setup.cfg Outdated Show resolved Hide resolved
@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch from e7aae72 to 413badb Compare January 23, 2021 12:07
@miri64
Copy link
Member Author

miri64 commented Jan 23, 2021

Rebased and squashed to current master.

@miri64 miri64 force-pushed the gh-actions/enh/codecov-upload branch from 413badb to 7614f30 Compare September 23, 2021 18:21
@miri64
Copy link
Member Author

miri64 commented Sep 23, 2021

Rebased and squashed to current master.

Again.

@fjmolinas
Copy link
Contributor

Rebased and squashed to current master.

Again.

How to I verify this is working?

@miri64
Copy link
Member Author

miri64 commented Sep 23, 2021

Appearently it is not working at all, atm, see current build status. Also, I am not sure how @aabadie's recent tox rework factors into this... :-/

.github/workflows/tox.yml Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2021

Codecov Report

Merging #1 (89d86af) into master (c141a9b) will increase coverage by 15.28%.
The diff coverage is 94.87%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master       #1       +/-   ##
===========================================
+ Coverage   80.66%   95.95%   +15.28%     
===========================================
  Files           9        4        -5     
  Lines         269      173       -96     
  Branches        0       11       +11     
===========================================
- Hits          217      166       -51     
+ Misses         52        6       -46     
- Partials        0        1        +1     
Flag Coverage Δ
3.5 ?
3.6 ?
3.7 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
riotctrl/ctrl.py 93.45% <90.69%> (ø)
riotctrl/__init__.py 100.00% <100.00%> (ø)
riotctrl/shell/__init__.py 100.00% <100.00%> (ø)
riotctrl/shell/json.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee12bb5...89d86af. Read the comment docs.

@miri64
Copy link
Member Author

miri64 commented Sep 24, 2021

That's exactly as I feared: Now it is only showing the coverage results of rapidjson, the testenv that ran last.

@aabadie
Copy link
Contributor

aabadie commented Sep 24, 2021

Normally codecov is supposed to merge results from different testenv (that's one of it's strength).

@miri64
Copy link
Member Author

miri64 commented Sep 24, 2021

Normally codecov is supposed to merge results from different testenv (that's one of it's strength).

But only if you use --cov-append with pytest-cov. Did that in ef0f6d4

setup.cfg Outdated Show resolved Hide resolved
github-actions: run `rapidjson` testenv separately

To append coverage results.
setup.cfg Outdated
Comment on lines 12 to 13
raise NotImplementedError
return NotImplemented
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do need to add these lines ? In theory, these kind of things could be tested.

Copy link
Member Author

@miri64 miri64 Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do need to add these lines ? In theory, these kind of things could be tested.

I was called Mrs "100% percent coverage" by @MrKevinWeiss before, but even I don't test code that states on its own that it is not implemented ;-).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit out of scope of this PR anyway. And I think, this only concerns

raise NotImplementedError

The "raise NotImplementedError" is useless since it's an abstract method, you could just replace it with .... When instanciating a concrete class that doesn't implement the get_ctrl method, python will raise a TypeError exception telling what method is missing.

Copy link
Contributor

@aabadie aabadie Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To summarize, I think this whole configuration block should be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit out of scope of this PR anyway. And I think, this only concerns

raise NotImplementedError

But then get a missing coverage there....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then get a missing coverage there...

Then just replace this line with ... # pragma: no cover

If you want to ensure a derived class cannot be instanciated without a proper implementation of the get_ctrl method, you can use this test:

def test_not_implemented_factory():
    class MyFactory(riotctrl.ctrl.RIOTCtrlFactoryBase):
        pass

    with pytest.raises(TypeError) as exc_info:
        _ = MyFactory()

    assert exc_info.value.args[0] == (
        "Can't instantiate abstract class MyFactory "
        "with abstract method get_ctrl"
    )

but you definitely don't need to add an exclude_lines config in setup.cfg.

Copy link
Member Author

@miri64 miri64 Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine... let's finally get this in and worry about actual coverage later...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants