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

7.improve CIworkflow #8

Merged
merged 36 commits into from
Jul 25, 2024
Merged

7.improve CIworkflow #8

merged 36 commits into from
Jul 25, 2024

Conversation

ilaflott
Copy link
Member

This tries to straighten out the workflow files for githubs CI/CD pipeline. Part of testing these changes is... opening this PR and watching the correct workflows run.

ilaflott added 22 commits July 23, 2024 11:58
`environment.yml` had different package reqs than whats in `setup.py` or `meta.yaml`. changed to be consistent.

`setup-python` github action gives us accesss to a python with conda in it, remove conda reqs for now. 

change name.
Ian Laflotte cannot spell.
…te-pip-install-pytest

not convinced this will work. lets see.
…da-conda-env-create-pip-install-pytest.yml

ian still can't type.
…l to conda-env-create-and-pytest.yml

shorter name
remove what seems to be redundant workflow
remove unused workflow
separate steps of docs job by new line for readability
remove unused docker build workflow
remove unused workflow file
create a conda build workflow that doesn't upload anything for PR/MR.

change the conda publish workflow to run only upon push to main.
update checkout action to v4, remove conda config line that i'm not sure works and is redundant anyways.
remove branch from meta.yaml
remove gir url from source field in catalogbuilder.

messes with conda build call. 

thank you bennet
include explicit `catalogbuilder.scripts.gen_intake_gfdl` import test in `meta.yaml` for conda package
trying to absorb what create-gfdl-catalog does into conda-env-create-and-pytest to start.

if i'm understanding the pipelines correctly, these steps should work with the conda env create approach, and we can re-define them in terms of the pytest suite. lets see if my first attempt here works..
ahhhhh the pytest, conda installations brought in with the python environment pointed to by github actions "setup-python" take precedence over the conda env python etc. 

not my favorite thing- but it does seem at least to work consistently. i hope to see most steps work after this commit.
`which pytest` upsets github ci/cd... kind of suprising
@ilaflott
Copy link
Member Author

so, almost entirely focused on changing the workflow files here.

deletes the following, as they are unused/old/redundant

.github/workflows/main.yml
.github/workflows/import-test.yml
.github/workflows/docker-image2.yml
.github/workflows/docker-image.yml

.github/workflows/python-conda-env.yml renamed to conda-env-create-and-pytest.yml, expanded upon to include steps originally included in .github/workflows/create-gfdl-catalog.yml, which is still present for the moment, but i think we can get rid of.

meta.yaml used to specify the git_url field with the repo URL. This is a good idea in theory but results in the conda build . in the workflow files to only look at code on the main branch- undesirable!!! Thank you @bcc2761 for figuring that out and leaving good commit notes for fre-cli. Also now includes a new import test, catalogbuilder.scripts.gen_intake_gfdl

environment.yml hada a bunch of dependencies that aren't actual dependencies for the catalogbuilder package. environment.yml now only contains what catalogbuilder needs to be pip-installed + run in the environment.

@ilaflott ilaflott requested review from Ciheim and ceblanton July 23, 2024 18:26
@ilaflott
Copy link
Member Author

Also, addresses #6 #7 and #11

ilaflott added 3 commits July 23, 2024 14:36
put publish-conda.yml name field back to old value, to avoid polluting the workflows menu of this repo more than i already did...
that later pytest call isnt redundant, it uses the downloaded artifacts from earlier in the workflow.

also, pretty sure the `python` call points to the right one, even if `pytest` doesn't without the path to the executable in the conda env.
remove now-redundant create-gfdl-catalog.yml. we can test all the same things in the pipeline testing the conda env create step.

for the future: absorb the test script calls into the pytest suite.
@ilaflott
Copy link
Member Author

I'm happy with the current tweaks.

Note that all of this is changes regarding the workflow and/or environment files. There are no changes to the code of the package itself.

@@ -0,0 +1,70 @@
name: conda-env-create-and-pytest
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
name: conda-env-create-and-pytest
name: catalog-build-pytests-in-conda-env

Copy link
Collaborator

Choose a reason for hiding this comment

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

the workflow file could also be renamed to catalog-build-pytests-in-conda-env? (or anything that is a bit descriptive as this is an important dynamic catalog building test)

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'm OK with finding a new name, but let's avoid "build" in this context. build is very overloaded here. we have catalogbuilder building catalogs, a pipeline building an environment, a pipeline building a package using conda build...

ideally, some day, this dynamic catalog creation test exists within a pytest suite

Copy link
Member Author

Choose a reason for hiding this comment

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

how about conda-env-create-run-tests?

- catalogbuilder.cats
- catalogbuilder.scripts
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Ciheim will be curious to see if fre-cli can still take the --config option because I had not moved configs during this restructuring. We can move it if fre-cli requires it, though it shouldn't be required. Please open a separate issue if fre-cli needs catalogbuilder.config

Copy link
Collaborator

@aradhakrishnanGFDL aradhakrishnanGFDL 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 @ilaflott! Minor changes and suggestions made.
For a later time- This change makes me wonder if a similar, but minimal test to use the catalogbuilder conda package and run the catalog builder might add value as well, upon push. But, I can also see how the analysis-scripts repo might help with this post PR (push) tests.

@aradhakrishnanGFDL
Copy link
Collaborator

@ilaflott not sure if its tied to this PR, but the json and csv files in here https://github.com/NOAA-GFDL/CatalogBuilder/tree/main/catalogbuilder/cats do not show up in the conda package we install/download from the noaa-gfdl channel. Do you see the same behavior?

Descending into catalogbuilder and looking at cats/ reveals that there is only the init file in there within the published conda pkg. It may have to do something with this file that may need a tweak or could be removed given the settings have changed?

Co-authored-by: Aparna Radhakrishnan <aparna.radhakrishnan@noaa.gov>
@ilaflott
Copy link
Member Author

thanks for the excellent feedback @aradhakrishnanGFDL, let me take a peek at what you're pointing out RE json files being absent.

as for the conda env building + running test... there is merit to the idea IMO. what makes
me reconsider is the surprising amount of pain github CI/CD introduces to trying to test software within a conda env.

ilaflott added 3 commits July 24, 2024 12:30
implementing conda env tricks for github ci/cd i figured out here:
NOAA-GFDL/fre-cli#127
now includes files other than `__init__.py` in `catalogbuilder/cats`
@ilaflott
Copy link
Member Author

OK, aside from the workflow file name, i've implemented the suggested changes and added another improvement to handling calls to the conda environments resources

ilaflott added 6 commits July 24, 2024 13:10
…getting put in a conda env's "site-packages" directory.

adjust respective workflow file

add pytest.ini file for assist pytest calls with finding the tests
… change, and `<root>/intakebuilder/` --> `<root>/catalogbuilder/intakebuilder` change
@ilaflott
Copy link
Member Author

OK great news! I managed to work the packaging structure out... initially i just wanted to move tests/ into catalogbuilder/tests/, but this caused awkward problems with sys.path manipulation for module imports in the tests... and i just couldnt stop going down that rabbit hole.

…-run-pytest.yml

change file name / workflow name. change `pip install --prefix` path- shouldn't target `bin/`, but the directory containing it and e.g. `lib` and i.e. other top-level things for the env.
@aradhakrishnanGFDL aradhakrishnanGFDL self-requested a review July 25, 2024 16:15
@ilaflott ilaflott merged commit 6bc010d into main Jul 25, 2024
3 checks passed
This was referenced Jul 25, 2024
@ilaflott ilaflott deleted the 7.improveCIworkflow branch July 29, 2024 16:24
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