-
Notifications
You must be signed in to change notification settings - Fork 11
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
update CI image and add mkmf for fre make testing #245
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
156cb25
update CI image and workflow, add run-fremake test and mkmf submodule
643ebe0
add ci platform to null model example
a2d64b6
Merge branch 'NOAA-GFDL:main' into update-ci-for-compilation
rem1776 5438593
Merge branch 'NOAA-GFDL:main' into update-ci-for-compilation
rem1776 2a6ecfb
Merge branch 'NOAA-GFDL:main' into update-ci-for-compilation
rem1776 e9fb43e
finally realized the tests run in both workflows...
rem1776 443d4d8
add recursive checkouts and mkmf path
0817456
add mkmf path to publish workflow
7e28c38
Merge branch 'main' into update-ci-for-compilation
rem1776 4e5a880
make new directory and move run-fremake test so it can be ignored dur…
29795a9
update run-fremake test file to use a direct function call and check …
17ed847
Merge branch 'main' into update-ci-for-compilation
rem1776 a3a7188
Merge branch 'main' into update-ci-for-compilation
rem1776 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,67 +5,54 @@ on: [push] | |
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/noaa-gfdl/fre-cli:miniconda24.7.1_gcc14.2.0 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '>=3.9' | ||
- name: Add conda to system path | ||
run: | | ||
# $CONDA is an env var pointing to root of miniconda dir | ||
echo $CONDA/bin >> $GITHUB_PATH | ||
|
||
- name: Create fre-cli environment | ||
run: | | ||
# create environment containing all dependencies | ||
# the env cannot be explicitly activated in github CI/CD | ||
conda env create -f environment.yml --name fre-cli | ||
|
||
# add conda env's executables to github's PATH equiv. | ||
# sets CONDA to wherever it may be on the image | ||
source /root/.bashrc | ||
|
||
# add conda env's executables and mkmf to github's PATH equiv. | ||
echo $CONDA/envs/fre-cli/bin >> $GITHUB_PATH | ||
echo $PWD/mkmf/bin >> $GITHUB_PATH | ||
|
||
## use *conda environment's pip* to install fre-cli | ||
## called w/ full path to conda's python for explicitness | ||
## called as a module (-m pip) for explicitness | ||
# use *conda environment's pip* to install fre-cli | ||
# called w/ full path to conda's python for explicitness | ||
# called as a module (-m pip) for explicitness | ||
$CONDA/envs/fre-cli/bin/python -m pip install --prefix $CONDA/envs/fre-cli . | ||
|
||
- name: Run pytest in fre-cli environment | ||
run: | | ||
# try to make sure the right things are in GITHUB_PATH | ||
echo $CONDA/envs/fre-cli/bin >> $GITHUB_PATH | ||
|
||
# are we talking to the right python? | ||
which python | ||
python --version | ||
$CONDA/envs/fre-cli/bin/python --version | ||
|
||
# add spack installed binaries to front of path so that | ||
# conda's netcdf/hdf5 installs don't break compilation tests | ||
export path_save=$PATH | ||
export PATH="/opt/views/view/bin:$PATH" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tom just walked me through views the other day, cool to see! |
||
|
||
# run pytest | ||
pytest --junit-xml=pytest_results.xml --config-file=fre/pytest.ini --cov-config=fre/coveragerc --cov-report=xml --cov=fre fre/ | ||
|
||
# install genbadge to generate coverage badge based on xml | ||
|
||
# restore original path and install genbadge to generate coverage badge based on xml | ||
export PATH="$path_save" | ||
pip install genbadge | ||
genbadge coverage -v -i coverage.xml -o docs/cov_badge.svg | ||
genbadge tests -v -i pytest_results.xml -o docs/pytest_badge.svg | ||
|
||
- name: Run pylint in fre-cli environment | ||
run: | | ||
# try to make sure the right things are in GITHUB_PATH | ||
echo $CONDA/envs/fre-cli/bin >> $GITHUB_PATH | ||
|
||
# are we talking to the right python? | ||
which python | ||
python --version | ||
$CONDA/envs/fre-cli/bin/python --version | ||
ilaflott marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# run pylint, ignored modules avoid warnings arising from code internal to those modules | ||
# run pylint, ignored modules avoid warnings arising from code internal to those modules | ||
pylint --max-args 6 -ry --ignored-modules netCDF4,cmor fre/ || echo "pylint returned non-zero exit code. preventing workflow from dying with this echo." | ||
|
||
- name: Install Sphinx and Build Documentation | ||
run: | | ||
pip install sphinx renku-sphinx-theme sphinx-rtd-theme | ||
pip install sphinx renku-sphinx-theme sphinx-rtd-theme | ||
pip install --upgrade sphinx-rtd-theme | ||
sphinx-apidoc --output-dir docs fre/ --separate | ||
sphinx-build docs build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "mkmf"] | ||
path = mkmf | ||
url = https://github.com/NOAA-GFDL/mkmf | ||
[submodule "fre/gfdl_msd_schemas"] | ||
path = fre/gfdl_msd_schemas | ||
url = https://github.com/NOAA-GFDL/gfdl_msd_schemas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
''' test "fre make run-fremake" calls ''' | ||
|
||
import os | ||
from fre.make import runFremake | ||
from pathlib import Path | ||
|
||
# command options | ||
YAMLFILE = "fre/make/tests/null_example/null_model.yaml" | ||
PLATFORM = [ "ci.gnu" ] | ||
CONTAINER_PLATFORM = ["hpcme.2023"] | ||
TARGET = ["debug"] | ||
EXPERIMENT = "null_model_full" | ||
|
||
# get HOME dir to check output | ||
HOME_DIR = os.environ["HOME"] | ||
|
||
def test_fre_make_run_fremake_null_model_serial_compile(): | ||
''' run fre make with run-fremake subcommand and build the null model experiment with gnu''' | ||
runFremake.fremake_run(YAMLFILE, PLATFORM, TARGET, False, 1, False, False) | ||
assert Path(f"{HOME_DIR}/fremake_canopy/test/{EXPERIMENT}/{PLATFORM[0]}-{TARGET[0]}/exec/{EXPERIMENT}.x").exists() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarifying question for myself, is this a version/image we'll have to update every once in a while?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think anything will break anytime soon if we used this image for a while, but it'd be good to get a new image with newer software every year or so, that's what I've typically done with other CI images. Anytime you rebuild the image it'll pull in the latest versions, so you wouldn't have to make any changes to the dockerfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity and my own notekeeping, where can one find the dockerfile for the uploaded container image in question?
edit: this isn't a condition for approval/merge/etc, i just like knowing stufff cause its fun
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the hpc-me repo:
https://gitlab.gfdl.noaa.gov/fre/HPC-ME/-/blob/main/ci/fre-cli-gnu/Dockerfile?ref_type=heads