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

ensure that we have an import_std configuration in the test-set #637

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

Conversation

burnpanck
Copy link
Contributor

also, update flake8

@mpusz
Copy link
Owner

mpusz commented Nov 13, 2024

Ahh, I forgot to say that it also requires C++23+ to work 😢

Also, I do not know why a freestanding build failed.

FYI, I am providing a 3-day training from today, so I may be less responsive than usual.

@mpusz
Copy link
Owner

mpusz commented Nov 13, 2024

I've just changed the CI scripts (but not the generator) to account for C++23. They should also check for something like import_std_support when provided by the matrix.

@burnpanck
Copy link
Contributor Author

the freestanding build failed because of an issue you seemed to have previously identified: In Debug builds, the CMakeCheckCompiler test fails due to a missing _main symbol. you had an "exclude" in the matrix, but "include" comes after, so we have to account for that in the generator. I forgot about that when I added that special "cxx_modules" subsample.

@burnpanck
Copy link
Contributor Author

I might try to merge freestanding with the hosted conan, making this just another dimension of the matrix. I'll also extract the cxx_modules into its own dimension, and ensure all the unsupported combinations are skipped.

@burnpanck
Copy link
Contributor Author

finally, I'll experiment with a truly random sample of configurations, together with a GitHub Actions "manual_trigger" with a user input to choose the random seed. I belive that should be possible.

@mpusz
Copy link
Owner

mpusz commented Nov 13, 2024

WOW! You are a true GitHub Actions Wizard! 😄 I would never come up with those solutions by myself. It is great to learn those things from you. Thanks!

@mpusz
Copy link
Owner

mpusz commented Nov 13, 2024

Also, it seems that there is some issue with contracts setting as it resolves to an empty string instead of "none" here:
https://github.com/mpusz/mp-units/actions/runs/11826393072/job/32952538814#step:15:3

@mpusz
Copy link
Owner

mpusz commented Nov 16, 2024

Hi @burnpanck, will you have some time to look into it soon?

@burnpanck
Copy link
Contributor Author

I'l try to do it today. I would probably remove all logic affecting the settings of std_format and import_std from the CI, and instead include that into the generator; this has a few advantages: The logic determining which elements to run from the matrix properly respects what is actually being run in CI, and the logic determining what configurations are compatible is next to where the combinations are being configured. Would that be ok for you @mpusz? From my experience that would also be safer in the sense that a wrong configuration of the matrix would cause a loud failure rather than silently skipping an important test.

@mpusz
Copy link
Owner

mpusz commented Nov 17, 2024

Sure, it sounds great. However, please be careful with the import_std as this requires a very specific configuration and it is enforced through the conanfile.py. If import_std is set to True but other options are invalid, Conan will raise an error.

…rator; also, select a random seed every time
@burnpanck
Copy link
Contributor Author

If import_std is set to True but other options are invalid, Conan will raise an erro

That is a good thing. It means that we won't accidentally avoid testing import_std=True. If the matrix generator script thinks that a particular configuration with import_std=True is valid and schedules it for testing, it should either indeed test import_std=True or it should fail. Note also that the logic dealing with mutually incompatible configurations is very localised, so it should be fairly easy to maintain

@property
def is_supported(self) -> bool:
# check if selected features are supported by the platform
s = self.platform.feature_support
for field in dataclasses.fields(Features):
if getattr(self, field.name) and not getattr(s, field.name):
return False
# additional checks for import_std
if self.import_std:
if self.std < 23:
return False
if not self.cxx_modules:
return False
if not self.std_format:
return False
if self.contracts != "none":
return False
return True

Finally, as promised, I added changed the random seed to be truly random. It chosen seed is printed at the start of the "generate-matrix" job. I also added a workflow_dispatch trigger to allow manual starts of each of the modified workflows, including an input to select a specific seed, perhaps to re-run a previous failed test.

@burnpanck
Copy link
Contributor Author

I forgot to mention; the workflow_dispatch is only effective if it is on the default branch, so we unfortunately won't be able to test that until after the merge.

@burnpanck
Copy link
Contributor Author

Oh, and the failed GCC-13 C++23 fmtlib none Release CMake test doesn't appear to be related to my changes here; either it has been pulled in with the recent merge, or it has always been there and has been discovered here through a lucky random choice.

@mpusz
Copy link
Owner

mpusz commented Nov 18, 2024

I also added a workflow_dispatch trigger to allow

Thanks a lot! You are a true GitHub Actions wizard 🧙🏻 I wouldn't know how to do at least half of the things you contributed in the last few days.

feature_support=Features(
cxx_modules=version >= 17,
std_format=version >= 17,
import_std=version >= 17,
Copy link
Owner

Choose a reason for hiding this comment

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

According to our compatiblity table:

Suggested change
import_std=version >= 17,
import_std=version >= 18,

@mpusz
Copy link
Owner

mpusz commented Nov 18, 2024

As you have introduced "features" maybe we should also explicitly name no_crtp? The requirements for it are also provided here:

mp-units/conanfile.py

Lines 114 to 122 in c1d323a

"explicit_this": {
"min_cppstd": "23",
"compiler": {
"gcc": "14",
"clang": "18",
"apple-clang": "",
"msvc": "",
},
},

@mpusz
Copy link
Owner

mpusz commented Nov 18, 2024

Thinking a bit more about workflow_dispatch, do you think it could be a good idea to be able to manually run the tests for all of the valid possible combinations? Being able to run it by hand could allow us to ensure that everything is OK before doing the library release.

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.

2 participants