Skip to content

replace Travis CI with GitHub actions - #52

Merged
orbeckst merged 6 commits into
masterfrom
travis2ghactions
Oct 5, 2021
Merged

orbeckst merged 6 commits into
masterfrom
travis2ghactions

Conversation

@orbeckst

@orbeckst orbeckst commented Oct 1, 2021

Copy link
Copy Markdown
Member

fix #48

@codecov

codecov Bot commented Oct 1, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #52 (1631093) into master (4cb391f) will increase coverage by 0.11%.
The diff coverage is n/a.

❗ Current head 1631093 differs from pull request most recent head 4572c0c. Consider uploading reports for the commit 4572c0c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
+ Coverage   56.53%   56.64%   +0.11%     
==========================================
  Files          12       13       +1     
  Lines         375      376       +1     
  Branches       47       47              
==========================================
+ Hits          212      213       +1     
  Misses        160      160              
  Partials        3        3              
Impacted Files Coverage Δ
MDAnalysisData/authors.py 100.00% <0.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 4cb391f...4572c0c. Read the comment docs.

@pep8speaks

pep8speaks commented Oct 1, 2021 •

Copy link
Copy Markdown

Hello @orbeckst! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-10-05 00:37:49 UTC

@orbeckst

orbeckst commented Oct 1, 2021

Copy link
Copy Markdown
Member Author

I am not sure why coverage looks so abysmal. Otherwise this seems to work.

@orbeckst

orbeckst commented Oct 1, 2021

Copy link
Copy Markdown
Member Author

The docs build action will only run when it is merged into master.

@orbeckst orbeckst mentioned this pull request Oct 1, 2021
@tylerjereddy tylerjereddy added the CI label Oct 1, 2021

@IAlibay IAlibay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Couple of comments but nothing blocking so I'll approve.

Comment thread .github/workflows/ci.yml
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
exclude:
- os: macOS-latest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the exclude here is weird, I guess you're only testing 3.8 and 2.7 on macOS and Windows? It might be a bit simpler to just not have these in the main matrix and just add them as includes (4 entries instead of 6 in exclude)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good call, changing it

Comment thread .github/workflows/ci.yml Outdated
python -m pip install wheel
python -m pip install pytest pytest-cov pytest-pep8 pytest-mock codecov

- name: Install main dependencies

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any reason for having the two separate parts of the workflow and not just squashing everything into the one step?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Mainly because I like the semantics of clearly seeing where something for tests only is done vs what's needed for running the package — I often look at the CI files to figure out what's actually needed as opposed to what someone might or might not have put into setup.py.

- Tests only (gratuitously expanded to MacOS and Windows), gh-ci.yml
- add docs action
- install pathlib2 for 2.7
- updated supported Python versions in setup.py (2.7, 3.6-3.9)
- use pathlib for OS-agnostic path comparisons
- install pathlib2 in setup.py for Python 2.7
Ensure that CRLF/LF line endings do not matter for tests.
Fixed sha256 test, which incorrectly wrote a text file instead of binary.
@orbeckst

orbeckst commented Oct 5, 2021

Copy link
Copy Markdown
Member Author

Coverage is getting annoying on GitHub actions: I got the error

Coverage.py warning: No data was collected. (no-data-collected)

and following https://stackoverflow.com/a/60579142 I added tests/__init__.py but now the generated authors file is not correctly picked up by the tests:

 _________________________________ test_authors _________________________________

    def test_authors():
        authors = MDAnalysisData.__authors__
>       assert authors[:5] == ["Oliver Beckstein", "Shujie Fan",
                               "Richard J. Gowers", "Micaela Matta",
                               "Lily Wang"]
E       AssertionError: assert ['The MDAnaly...lopment Team'] == ['Oliver Beck..., 'Lily Wang']
E         At index 0 diff: 'The MDAnalysis Development Team' != 'Oliver Beckstein'
E         Right contains 4 more items, first extra item: 'Shujie Fan'
E         Full diff:
E           [
E         +  'The MDAnalysis Development Team',
E         -  'Oliver Beckstein',
E         -  'Shujie Fan',
E         -  'Richard J. Gowers',
E         -  'Micaela Matta',
E         -  'Lily Wang',
E           ]

MDAnalysisData/tests/test_package_metadata.py:13: AssertionError
=============================== warnings summary ===============================
MDAnalysisData/__init__.py:20
  /home/runner/work/MDAnalysisData/MDAnalysisData/MDAnalysisData/__init__.py:20: UserWarning: Could not find authors.py, __authors__ will be the generic MDAnalysis team.
    warnings.warn('Could not find authors.py, __authors__ will be the '

I am not sure if it's trying to run the package from the sources instead from the proper installation.

@orbeckst

orbeckst commented Oct 5, 2021

Copy link
Copy Markdown
Member Author

The author tests work just fine if there is no tests/__init__.py.

What exactly do pytest and coverage look for and where???

@orbeckst

orbeckst commented Oct 5, 2021

Copy link
Copy Markdown
Member Author

The only way I managed to solve the issue of getting both pytest and coverage to work was to use an in-place installation pip install -e ..

(Seems a sub-par solution but for right now I take it and I am eager to hear better solutions and will happily implement them.)

- add tests/__init__.py to coax pytest-cov to report coverage

    "CoverageWarning: No data was collected. (no-data-collected)"

  is supposedly fixed with this empty
  __init__.py (see https://stackoverflow.com/a/60579142)
- inplace-installation so that coverage and pytest work with generated authors.py
  (with standard installation AND the tests/__init__.py, pytest picks up the local sources
  that does not contain the generated authors.py and fails)
@orbeckst

orbeckst commented Oct 5, 2021

Copy link
Copy Markdown
Member Author

@orbeckst
orbeckst merged commit 779bed1 into master Oct 5, 2021
@orbeckst
orbeckst deleted the travis2ghactions branch October 5, 2021 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transition CI from Travis to GitHub actions

4 participants