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

Add CI with GitHub Actions #675

Merged
merged 12 commits into from
Dec 9, 2024
Merged

Add CI with GitHub Actions #675

merged 12 commits into from
Dec 9, 2024

Conversation

fermino
Copy link
Collaborator

@fermino fermino commented Dec 5, 2024

  • Migrate from TravisCI to GH Actions.
    • Use tmpfs for test files.
  • Use the pytest binary instead of nosetest.
  • Cleanup test folder between runs, as some tests fail when the folder is in an unexpected state.

@fermino fermino marked this pull request as draft December 5, 2024 02:20
@fermino
Copy link
Collaborator Author

fermino commented Dec 5, 2024

I haven't been able to test the tmpfs patch as I'm using act to run the actions (it executes the actions inside a container), but besides that tests should be working well on Ubuntu 22 at least.

So far so good! :)

================================================ test session starts =================================================
platform linux -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/fermino/develop/rmlint
plugins: hypothesis-6.118.7, trio-0.8.0, anyio-4.6.2.post1, asyncio-0.24.0, typeguard-4.3.0, xdist-3.5.0, cov-5.0.0, mock-3.14.0
asyncio: mode=Mode.STRICT, default_loop_scope=None
collected 148 items

tests/test_formatters/test_csv.py ..                                                                                                                                                                                                     [  1%]
tests/test_formatters/test_json.py .                                                                                                                                                                                                     [  2%]
tests/test_formatters/test_others.py .                                                                                                                                                                                                   [  2%]
tests/test_formatters/test_py.py x                                                                                                                                                                                                       [  3%]
tests/test_formatters/test_sh.py xx.xxxxx..                                                                                                                                                                                              [ 10%]
tests/test_mains/test_dedupe.py ssssss                                                                                                                                                                                                   [ 14%]
tests/test_mains/test_hash.py x                                                                                                                                                                                                          [ 14%]
tests/test_mains/test_is_reflink.py .......sssss.                                                                                                                                                                                        [ 23%]
tests/test_options/test_cache.py .x.xx                                                                                                                                                                                                   [ 27%]
tests/test_options/test_clamp.py ....                                                                                                                                                                                                    [ 29%]
tests/test_options/test_color.py ..                                                                                                                                                                                                      [ 31%]
tests/test_options/test_equal.py ........                                                                                                                                                                                                [ 36%]
tests/test_options/test_help.py ..                                                                                                                                                                                                       [ 37%]
tests/test_options/test_hidden_dirs.py ....                                                                                                                                                                                              [ 40%]
tests/test_options/test_keep_hardlinks.py ..                                                                                                                                                                                             [ 41%]
tests/test_options/test_km.py .                                                                                                                                                                                                          [ 42%]
tests/test_options/test_match_basenames.py ....                                                                                                                                                                                          [ 45%]
tests/test_options/test_match_with_extension.py ..                                                                                                                                                                                       [ 46%]
tests/test_options/test_match_without_extension.py ..                                                                                                                                                                                    [ 47%]
tests/test_options/test_merge_directories.py x............                                                                                                                                                                               [ 56%]
tests/test_options/test_mtime_window.py ....                                                                                                                                                                                             [ 59%]
tests/test_options/test_newer_than.py ...                                                                                                                                                                                                [ 61%]
tests/test_options/test_no_backup.py .                                                                                                                                                                                                   [ 62%]
tests/test_options/test_pass_files.py .                                                                                                                                                                                                  [ 62%]
tests/test_options/test_perms.py .                                                                                                                                                                                                       [ 63%]
tests/test_options/test_rankby.py ..                                                                                                                                                                                                     [ 64%]
tests/test_options/test_replay.py ..........                                                                                                                                                                                             [ 71%]
tests/test_options/test_size.py ...                                                                                                                                                                                                      [ 73%]
tests/test_options/test_sorting.py ......                                                                                                                                                                                                [ 77%]
tests/test_options/test_stdin.py ...x                                                                                                                                                                                                    [ 80%]
tests/test_options/test_symlinks.py ....                                                                                                                                                                                                 [ 83%]
tests/test_robustness/test_8Mlongpathfiles.py .                                                                                                                                                                                          [ 83%]
tests/test_robustness/test_badlinks_as_args.py .                                                                                                                                                                                         [ 84%]
tests/test_robustness/test_bigfiles.py ..                                                                                                                                                                                                [ 85%]
tests/test_robustness/test_collisions.py .                                                                                                                                                                                               [ 86%]
tests/test_robustness/test_manyfiles.py .                                                                                                                                                                                                [ 87%]
tests/test_robustness/test_manylongpathfiles.py .                                                                                                                                                                                        [ 87%]
tests/test_robustness/test_path_doubles.py ....                                                                                                                                                                                          [ 90%]
tests/test_types/test_badlink.py .                                                                                                                                                                                                       [ 91%]
tests/test_types/test_baduids.py .                                                                                                                                                                                                       [ 91%]
tests/test_types/test_duplicate.py .....                                                                                                                                                                                                 [ 95%]
tests/test_types/test_empty_dirs.py ...                                                                                                                                                                                                  [ 97%]
tests/test_types/test_empty_files.py .                                                                                                                                                                                                   [ 97%]
tests/test_types/test_nonstripped.py ...                                                                                                                                                                                                 [100%]
==================================================================================== 123 passed, 11 skipped, 14 xfailed, 18 warnings in 1344.02s (0:22:24) =====================================================================================

@fermino fermino marked this pull request as ready for review December 5, 2024 04:12
Copy link
Collaborator

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

Thank you for working on this.
That is cool to see such a concise refactoring to make it work with pytest ... but if still uses nose -- why to add pytest?

also left other questions -- just curious on the choices made etc

tests/utils.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
@fermino
Copy link
Collaborator Author

fermino commented Dec 7, 2024

Hey there! Thanks for the feedback!

Regarding pytest, I don't think I had a clear reason behind it more than "I can't get the tests working and nose is deprecated so let's try this" 🤣

In any case, given that nose is deprecated I do think is a good idea to start moving to pytest (even if just a bit at a time) as we will likely run into packaging issues in upcoming distro releases. There's also nose2, which I haven't ever used but it's obviously up for discussion.

As for the cleanup_testdir function, I thought to keep the same API as create_testdir, but given that it is not used anywhere else let's just make it simpler.

Anyways, I think I addressed everything, but let me know if I missed something :)
Thanks again for taking the time to take a look at this!

@fermino
Copy link
Collaborator Author

fermino commented Dec 8, 2024

From the log, some things I want to check (not necessarily before merging, but important nonetheless):

tests/test_formatters/test_py.py:19
  tests/test_formatters/test_py.py:19: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_paranoia will be ignored
    @parameterized(["python2", "python3"])

tests/test_formatters/test_sh.py:25
  tests/test_formatters/test_sh.py:25: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_basic will be ignored
    @with_setup(usual_setup_func, usual_teardown_func)

tests/test_formatters/test_sh.py:75
  tests/test_formatters/test_sh.py:75: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_paranoia will be ignored
    @parameterized([("sh", ), ("bash", ), ("dash", )])

tests/test_formatters/test_sh.py:144
  tests/test_formatters/test_sh.py:144: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_hardlink_duplicate_directories will be ignored
    @parameterized([("sh", ), ("bash", ), ("dash", )])

tests/test_formatters/test_sh.py:178
  tests/test_formatters/test_sh.py:178: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_remove_empty_dirs will be ignored
    @parameterized([

tests/test_formatters/test_sh.py:211
  tests/test_formatters/test_sh.py:211: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_remove_empty_dirs_with_dupe_dirs will be ignored
    @parameterized([

tests/test_formatters/test_sh.py:244
  tests/test_formatters/test_sh.py:244: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_cleanup_emptydirs will be ignored
    @with_setup(usual_setup_func, usual_teardown_func)

tests/test_formatters/test_sh.py:275
  tests/test_formatters/test_sh.py:275: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_keep_parent_timestamps will be ignored
    @with_setup(usual_setup_func, usual_teardown_func)

tests/test_mains/test_hash.py:32
  tests/test_mains/test_hash.py:32: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_hash_function will be ignored
    @parameterized([

tests/test_options/test_cache.py:79
  tests/test_options/test_cache.py:79: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_xattr_detail will be ignored
    @parameterized([("", ), ("-D", )])

tests/test_options/test_cache.py:168
  tests/test_options/test_cache.py:168: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_clamp_xattr_false_negative will be ignored
    @parameterized([('-q 1',), ('-Q 1',), ('-q 50%',), ('-Q 50%',)])

tests/test_options/test_cache.py:190
  tests/test_options/test_cache.py:190: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_clamp_xattr_false_positive will be ignored
    @parameterized([('-q 2',), ('-Q 1',), ('-q 70%',), ('-Q 50%',)])

tests/test_options/test_merge_directories.py:15
  tests/test_options/test_merge_directories.py:15: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_simple will be ignored
    @parameterized([((),), (('--write-unfinished',),)])

tests/test_options/test_size.py:67
  /home/runner/work/rmlint/rmlint/tests/test_options/test_size.py:67: DeprecationWarning: invalid escape sequence '\-'
    trigger('--size \-\-17')

tests/test_options/test_stdin.py:86
  tests/test_options/test_stdin.py:86: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_stdin_empty will be ignored
    @parameterized([('-',), ('-0',), ('-D', '-')])

Copy link
Collaborator

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

FWIW, there was prior attempt to migrate to pytest

would be nice if someone reviewed/reattempted . Although I am still not 100% sure it is worth adding pytest in addition to nose, since some folks might try to run tests using pytest, it would actually be useful. Thus overall I feel that this PR is now "to the point" enough and would be great to get CI going again.

@fermino
Copy link
Collaborator Author

fermino commented Dec 9, 2024

I took a quick look at #603 and it looks good, it probably doesn't need much more than a rebase and some fixes. I want to fix the build process in arch linux so when I have some time I will get to it.

I also opened an issue to keep track of those ignored tests (#676).

@fermino fermino self-assigned this Dec 9, 2024
@fermino fermino merged commit c7318d9 into master Dec 9, 2024
1 check passed
@fermino fermino deleted the github-ci branch December 9, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants