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

Provide CI testing support #8

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

mitchnegus
Copy link
Member

@mitchnegus mitchnegus commented Nov 15, 2024

This provides a starting point for converting our GitLab CI testing infrastructure to the GitHub Actions workflow.

Workflow Upgrades

To avoid duplication in the workflow scripts, I've created a new set of composite actions to install minimega, discovery, FIREWHEEL, and tox. We should hopefully be able to use these composite actions to dramatically simplify some of the CI scripts we had before. I've also upgraded the versions of referenced reusable versions where possible.

Test Enhancements

The unit tests have been upgraded to provide increased utility and work better through the FIREWHEEL interface:

  • Running the firewheel test unit helper now returns the appropriate exit code returned by pytest, which was previously unintentionally suppressed.
  • A new marker includes or excludes tests which depend on model components.
  • In service of that functionality, the tests now also make use of pytest's built-in -m option to select marked tests for inclusion/exclusion rather than adding custom options.

Bug Fixes

This PR also fixes a few bugs in the current implementation:

  • This fixes a testing error identified by testing the FIREWHEEL deployment in an fresh installation (a hardcoded path in the test_cli_completion.py script).
  • Arguments passed to the helpers were not parsed correctly, ignoring quoted inputs and just splitting on spaces. This changes the helpers to use shlex for proper parsing.

@mitchnegus mitchnegus marked this pull request as draft November 15, 2024 23:38
@mitchnegus mitchnegus marked this pull request as ready for review November 15, 2024 23:39
@mitchnegus mitchnegus marked this pull request as draft November 15, 2024 23:39
@CLAassistant
Copy link

CLAassistant commented Dec 17, 2024

CLA assistant check
All committers have signed the CLA.

@mitchnegus mitchnegus force-pushed the tests branch 2 times, most recently from 9aba855 to 94b170f Compare January 9, 2025 18:15
@mitchnegus mitchnegus marked this pull request as ready for review January 23, 2025 20:37
.github/workflows/testing.yml Show resolved Hide resolved
.github/workflows/testing.yml Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
]

[project.optional-dependencies]
test = [
"tox<=4.23.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the dependency on tox was eliminated entirely. I think we should probably put it in the "format" or "dev" dependencies.

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'll probably leave it in dev? We still have the ability for a user to do tox run or something like tox -e py311 which will run tests. This feels like a fair thing to leave as a developer capability (along with all the other linting/typing/etc. things that tox does).

- name: Run unit tests
run: |
firewheel test unit -m 'not long and not mcs' \
--cov --cov-report=term --cov-fail-under=60
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was the reasoning for dropping this to 60?

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, I explained this in the extended body of the commit message because I expected you to ask 😁 (but then forgot to include it and elaborate in these notes).

The previous test level was not enough to get the unit tests to pass by themselves. Without a lot of digging, I think the reason is twofold:

  1. The previous coverage level included functional tests, which we can decide if we'd like to include or not. I don't know if we ever discussed that, but my gut feeling was that we'd want to know coverage for unit tests (i.e., are we testing the unit-level behavior of absolutely everything), while the value of the functional tests is at a higher level (i.e., does this stuff all work together).
  2. I've excluded tests that depend on other MCs or which take a while to run, meaning that any lines hit only by those are now uncovered. I think we actually do need to adjust that so that the long-running tests do get run at some point (although maybe we find a way to run them only on merges, not every push).

.github/actions/prepare-discovery/action.yml Show resolved Hide resolved
.github/actions/prepare-minimega/action.yml Show resolved Hide resolved
Add a dependency group for MC repos that may be installed along with the
FIREWHEEL package. This commit also excludes tests relying on those MC
repos from the GitHub testing workflow.
This drops coverage to 60% so that the unit tests pass.
This coverage is lower than previous pipelines, likely because this
coverage level only reflects unit tests (and not functional tests)
and because the current pipeline is excluding both long-running tests
and tests that depend on other MCs.
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.

3 participants