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 pytests and CI for simple configuration checks #32

Merged
merged 26 commits into from
Apr 2, 2024

Conversation

jo-basevi
Copy link
Collaborator

@jo-basevi jo-basevi commented Mar 24, 2024

Add CI checks for checking config.yaml, metadata.yaml files and simple configuration directory checks, as described in #25.

Closes #25

TODO:

  • Add Metadata pytests
  • Add new CI job that runs the pytests on PRs merging into release-* and dev-*

@CodeGat
Copy link
Contributor

CodeGat commented Mar 25, 2024

@jo-basevi what markers would be used for these new tests? config for sure, but do we need any others? I think you were talking about a metadata one? And there is a highres marker but I don't know under what conditions that would be invoked.

@jo-basevi
Copy link
Collaborator Author

Ok there's a bit of test marker explosion.. metadata or config for most branches. If metadata checks will always be required to be run, then could remove the metadata, and just have config for all simple ci checks, to keep things simple?

Otherwise for the high resolution configs (just dev-025deg_jra55_ryf at this stage?), add in an or highres to marker expression.

As checking the metadata realms is model specific, there's also markers for access_om2 and access_om2_bgc. @aidanheerdegen Is there a way to distinguish between access-om2 and access-om2-bgc using config.yaml or similar? As more specific tests are added, the access-om2/access-om2-bgc markers might be used more.

@CodeGat
Copy link
Contributor

CodeGat commented Mar 25, 2024

Sounds good! If we want to run different checks on different branches, we could add another .json file to the config folder on main that informs the CI regarding what markers to use. For example:

{
    "$schema": "./ci.schema.json",
    "pytest": {
        "quick": {
            "markers": {
                "branches": {
                    "dev-025deg_jra55_ryf": "config or metadata or highres"
                },
                "default": "config or metadata"
            }
        },
        "repro": {
            "markers": {
                "branches": {

                },
                "default": "checksum"
            }
        }
    }
}

Also getting @aidanheerdegen s feedback on this would be good

@jo-basevi
Copy link
Collaborator Author

Regrading the checklist in the issue here, the only tests not implemented are:

  • all input paths in vk83 (allow exceptions for jra55 data in IAF configs) - Not implemented as unsure on defining what was jra55 data
  • all input paths point to files (allow exceptions for IAF forcing data) - Not implemented as some paths were directories and this also required access to gadi's filesystem
  • manifests updated and consistent with executables and inputs implemented for model and submodel exe fullpaths but not inputs

@CodeGat
Copy link
Contributor

CodeGat commented Mar 26, 2024

Alright, got the CI working. Now just need to figure out - which configs need something other than config or metadata, and add them to config/ci.yml (like dev-025deg_jra55_ryf). Tagging @jo-basevi to see if she has some inkling of these things.

@aidanheerdegen
Copy link
Member

Is there a way to distinguish between access-om2 and access-om2-bgc using config.yaml or similar? As more specific tests are added, the access-om2/access-om2-bgc markers might be used more.

Well now. I have been mulling over if we should separate the BGC configs out into a separate access-om2-bgc-configs repo. I can see some merit in the idea, even if it is just to reduce branch explosion.

That said, you can tell the difference because the BGC configs will have bgc in their branch name. The CI could check for that and adjust the test suite accordingly I suppose.

@jo-basevi
Copy link
Collaborator Author

Alright, got the CI working. Now just need to figure out - which configs need something other than config or metadata, and add them to config/ci.yml (like dev-025deg_jra55_ryf). Tagging @jo-basevi to see if she has some inkling of these things.

I think the dev-025deg_jra55_ryf is the only high resolution one currently, so:
dev-025deg_jra55_ryf : config or metadata or highres or access_om2
every other access-om2 branch: config or metadata or access_om2

@aidanheerdegen
Copy link
Member

Note

#25 (comment)

@jo-basevi jo-basevi marked this pull request as ready for review March 27, 2024 03:51
@jo-basevi
Copy link
Collaborator Author

So call-pr-1-ci.yaml is not triggered on changes to metadata.yaml file here, but metadata files are now being tested on in the QA checks. So, changes only to metadata.yaml shouldn't trigger a repro test, but also if metadata.yaml was updated to pass the QA tests, those QA tests tests should be rerun? Also noticed that changing the metadata.yaml will trigger a call-pr-3-bump-tag workflow, but it looks like that will just emit a warning if the version tag already exists?

@CodeGat
Copy link
Contributor

CodeGat commented Mar 27, 2024

Yeah, I think we should remove the ignored metadata.yaml now that it is being tested. Just need to verify that we can't get into an infinite loop of commits and checks from github-actions, although that looks to be taken care of with the commit-check job in pr-1-ci.yml.
Yeah so it will run pr-3-bump-tag.yml if there is a push to release-* - which can only happen when a PR is merged.

@jo-basevi
Copy link
Collaborator Author

Given this extra check suggestion here, I wonder if its now worth inferring information from the branch name within the tests - rather than adding markers for each different degree..

CodeGat and others added 4 commits March 28, 2024 11:44
Co-authored-by: Aidan Heerdegen <aidan.heerdegen@anu.edu.au>
- Add new file for access-om2 config tests
- Parse the git branch of access-om2 config for resolution and bgc
- Add restart period and metadata keywords tests
Copy link
Contributor

@CodeGat CodeGat left a comment

Choose a reason for hiding this comment

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

Just preventing merge until I've tested the CI portion on my own org

aidanheerdegen
aidanheerdegen previously approved these changes Mar 28, 2024
Copy link
Member

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

test/test_access_om2_config.py Outdated Show resolved Hide resolved
test/test_access_om2_config.py Outdated Show resolved Hide resolved
test/test_access_om2_config.py Show resolved Hide resolved
test/test_config.py Show resolved Hide resolved
@CodeGat
Copy link
Contributor

CodeGat commented Mar 29, 2024

Note: Require checks on modification to metadata.yaml to succeed before giving the you must bump... dialogue.

@CodeGat
Copy link
Contributor

CodeGat commented Apr 1, 2024

Note to self...what the heck did I mean when I wrote the above comment...

In other news, I'm adding a commit that lets devs know that they can modify the version in the metadata.yaml, but should use the appropriate !bump command. I feel that for something like the version in metadata.yaml to be so accessible (modifications to the metadata.yaml will be commonplace) we either need to make it known that it is modifiable but not to, or give it some special name (like _version).

Copy link
Member

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

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

CI parts LGTM.

.github/workflows/pr-1-ci.yml Show resolved Hide resolved
CodeGat
CodeGat previously approved these changes Apr 1, 2024
Copy link
Contributor

@CodeGat CodeGat left a comment

Choose a reason for hiding this comment

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

Just approving since the CI tests are done. i think I went through all the possible paths...

@CodeGat
Copy link
Contributor

CodeGat commented Apr 2, 2024

I think I'm all done with the changes here (CI wise) :)

@jo-basevi
Copy link
Collaborator Author

I'm done with the pytest changes (unless there are more review suggestions?)

Copy link
Member

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for all the work @jo-basevi and @CodeGat

@aidanheerdegen aidanheerdegen merged commit 1c2425f into main Apr 2, 2024
@aidanheerdegen aidanheerdegen deleted the 25-simple-config-ci-checks branch April 2, 2024 03:56
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.

Add non-repro, simple CI checks all relevant config PRs
3 participants