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

Improve workflows to use github caches #182

Merged
merged 13 commits into from
Oct 26, 2023
Merged

Improve workflows to use github caches #182

merged 13 commits into from
Oct 26, 2023

Conversation

zain-sohail
Copy link
Member

@zain-sohail zain-sohail commented Oct 16, 2023

Generally addition of using caches in workflows
Parallization of testing of package and fixes for race conditions
Addition of dev dependencies so linting can be done

Refer to #151 for more details

Overall, workflows are much faster now
Linting: 1m
Test: 3-4m (after caching)

@coveralls
Copy link
Collaborator

coveralls commented Oct 16, 2023

Pull Request Test Coverage Report for Build 6656613697

  • 43 of 51 (84.31%) changed or added relevant lines in 3 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.2%) to 90.481%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tests/loader/test_loaders.py 25 33 75.76%
Files with Coverage Reduction New Missed Lines %
sed/calibrator/energy.py 2 91.86%
sed/core/processor.py 2 91.26%
Totals Coverage Status
Change from base Build 6655476886: -0.2%
Covered Lines: 4268
Relevant Lines: 4717

💛 - Coveralls

@rettigl
Copy link
Member

rettigl commented Oct 16, 2023

Coverage calculation does not work (or you added tests worth 9.1% coverage)

@rettigl
Copy link
Member

rettigl commented Oct 16, 2023

Testing is not done on push, should be added for commits that do not belong to a PR yet

Copy link
Member

@rettigl rettigl left a comment

Choose a reason for hiding this comment

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

In general, I think this is a nice addition, however I have a few concerns/suggestsions:

  1. We need to make sure that the poetry.lock file is regularly updated to the latest dependency versions if we want to use this. Dependabot does not do this in its current config (see add depedabot for dependency tracking/updating #178)
  2. There is currently no pytesting done on push. This should be added, at least for one python version, for pushes to branches without a PR.
  3. Coverage reports do not seem to report correct numbers

.github/workflows/testing_multiversion.yml Outdated Show resolved Hide resolved
@rettigl
Copy link
Member

rettigl commented Oct 16, 2023

The pytest workflow does not even run when pushing to this branch/PR. Seems completely disabled right now.

@daviddoji
Copy link
Collaborator

daviddoji commented Oct 17, 2023

@zain-sohail Related to this PR, if you also want to speed up on linting, have a look at ruff:
https://docs.astral.sh/ruff/

@rettigl
Copy link
Member

rettigl commented Oct 17, 2023

@zain-sohail Related to this PR, if you also want to speed up on linting, have a look at ruff: https://docs.astral.sh/ruff/

Interesting, but it does not seem to replace pylint or mypy, which take the major time in our linting pipeline.
Pylint, however, can still be parallelized, -j parameter

@zain-sohail
Copy link
Member Author

@zain-sohail Related to this PR, if you also want to speed up on linting, have a look at ruff: https://docs.astral.sh/ruff/

Interesting, but it does not seem to replace pylint or mypy, which take the major time in our linting pipeline. Pylint, however, can still be parallelized, -j parameter

I have thought about the Ruff option. If we can implement a similar rule set (or better) with Ruff, it's definitely faster. But we would still need a type checker like mypy.

@zain-sohail
Copy link
Member Author

In general, I think this is a nice addition, however I have a few concerns/suggestsions:

  1. We need to make sure that the poetry.lock file is regularly updated to the latest dependency versions if we want to use this. Dependabot does not do this in its current config (see add depedabot for dependency tracking/updating #178)

Addressed in that PR. We can implement this, if necessary, later.

  1. There is currently no pytesting done on push. This should be added, at least for one python version, for pushes to branches without a PR.

But this is the same as before. We were never using push. See


I just reimplemented the ruleset.

  1. Coverage reports do not seem to report correct numbers

Yes, on that I am not quite certain why. Even for single version test, it doesn't. Or the older ones were wrong? Because now I am using the official action from coveralls.io
I will test the coverage locally and see.

@daviddoji
Copy link
Collaborator

@zain-sohail Related to this PR, if you also want to speed up on linting, have a look at ruff: https://docs.astral.sh/ruff/

Interesting, but it does not seem to replace pylint or mypy, which take the major time in our linting pipeline. Pylint, however, can still be parallelized, -j parameter

Ruff and mypy are tools for different purposes, while the former is a linter, the latter is a type checker. Each of them can detect problems that the other would miss. It's the combination of them what it makes sense to use.

Regarding pylint, maybe it's worth to give it a shot as many users have succeeded (https://docs.astral.sh/ruff/faq/#how-does-ruff-compare-to-pylint)

@rettigl
Copy link
Member

rettigl commented Oct 17, 2023

3. There is currently no pytesting done on push. This should be added, at least for one python version, for pushes to branches without a PR.

But this is the same as before. We were never using push. See

The tests were part of the pylint action (on push), your removed them from there. If you want to keep it that way, implement a new test action that runs on push.

Why the coveralls workflow does not run on push to the pull request branch, I don't know. Maybe "on" and "pull_request" need to be on the same line, as it was before

@zain-sohail
Copy link
Member Author

  1. There is currently no pytesting done on push. This should be added, at least for one python version, for pushes to branches without a PR.

But this is the same as before. We were never using push. See

The tests were part of the pylint action (on push), your removed them from there. If you want to keep it that way, implement a new test action that runs on push.

Oh yes I removed them. That's a fair point. I will put the single version test to be on every push then?

Why the coveralls workflow does not run on push to the pull request branch, I don't know. Maybe "on" and "pull_request" need to be on the same line, as it was before

That shouldn't have mattered, from previous experience. I will check.

tests/test_processor.py Outdated Show resolved Hide resolved
@zain-sohail
Copy link
Member Author

Is it good now? @rettigl

@rettigl
Copy link
Member

rettigl commented Oct 26, 2023

Is it good now? @rettigl
Three more things:

  • rebase
  • add on: pull-request to the testing workflow
  • remove line 653 from test_processor

@rettigl
Copy link
Member

rettigl commented Oct 26, 2023

Ah, and remove update_requirements

- added PR trigger
- fixed unnecessary line in processor.py
- changed testing file name to include coverage
- removed update_requirements.yml
Copy link
Member

@rettigl rettigl left a comment

Choose a reason for hiding this comment

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

LGTM now

@zain-sohail
Copy link
Member Author

LGTM now

Thanks!

@zain-sohail zain-sohail merged commit 9e35e99 into main Oct 26, 2023
3 checks passed
@zain-sohail zain-sohail deleted the cached-workflows branch October 26, 2023 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants