Skip to content

Commit

Permalink
Merge pull request #253 from NOAA-GFDL/187.schema-submodule
Browse files Browse the repository at this point in the history
187.schema submodule
  • Loading branch information
singhd789 authored Nov 6, 2024
2 parents c9ef8f5 + 071f46a commit 20e943a
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 213 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- name: Checkout Files
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Run Conda to Build
run: |
conda config --append channels conda-forge
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create_test_conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ jobs:
runs-on: ubuntu-latest
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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- name: Checkout Files
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Run Conda to Build and Publish
run: |
conda config --append channels conda-forge
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "fre/gfdl_msd_schemas"]
path = fre/gfdl_msd_schemas
url = https://github.com/NOAA-GFDL/gfdl_msd_schemas
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## **For Developers**

* Developers are free to use this repository's `README.md` to familiarize with the CLI and save time from having to install any dependencies, but development within a Conda environment is heavily recommended regardless
* Gain access to the repository with `git clone [email protected]:NOAA-GFDL/fre-cli.git` or your fork's link (recommended) and an SSH RSA key
* Gain access to the repository with `git clone --recursive [email protected]:NOAA-GFDL/fre-cli.git` or your fork's link (recommended) and an SSH RSA key
- Once inside the repository, developers can test local changes by running a `pip install .` inside of the root directory to install the fre-cli package locally with the newest local changes on top of the installed Conda fre-cli dependencies
- Test as a normal user would use the CLI
* Create a GitHub issue to reflect your contribution's background and reference it with Git commits
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Usage (Developers)

Developers are free to use the user guide above to familiarize with the CLI and save time from having to install any dependencies, but development within a Conda environment is heavily recommended regardless

Gain access to the repository with *git clone [email protected]:NOAA-GFDL/fre-cli.git* or your fork's link (recommended) and an SSH RSA key
Gain access to the repository with *git clone --recursive [email protected]:NOAA-GFDL/fre-cli.git* or your fork's link (recommended) and an SSH RSA key

Once inside the repository, developers can test local changes by running a *pip install .* inside of the root directory to install the fre-cli package locally with the newest local changes

Expand Down
1 change: 1 addition & 0 deletions fre/gfdl_msd_schemas
Submodule gfdl_msd_schemas added at 04c815
2 changes: 1 addition & 1 deletion fre/make/gfdlfremake/platformfre.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self,platforminfo):
p["container"]
except:
p["container"] = False
p["RUNenv"] = ""
p["RUNenv"] = [""]
p["containerBuild"] = ""
p["containerRun"] = ""
if p["container"]:
Expand Down
201 changes: 0 additions & 201 deletions fre/make/gfdlfremake/schema.json

This file was deleted.

5 changes: 3 additions & 2 deletions fre/make/gfdlfremake/yamlfre.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import json
from pathlib import Path
import yaml
from jsonschema import validate, ValidationError, SchemaError
from . import platformfre
Expand Down Expand Up @@ -176,8 +177,8 @@ def __init__(self,combinedyaml,v):
#self.freyaml.update(self.platformsyaml)

## VALIDATION OF COMBINED YAML FOR COMPILATION
fremake_package_dir = os.path.dirname(os.path.abspath(__file__))
schema_path = os.path.join(fremake_package_dir, 'schema.json')
fremake_package_dir = Path(__file__).resolve().parents[2]
schema_path = os.path.join(fremake_package_dir, 'gfdl_msd_schemas', 'FRE', 'fre_make.json')
with open(schema_path, 'r') as f:
s = f.read()
schema = json.loads(s)
Expand Down
7 changes: 4 additions & 3 deletions fre/yamltools/tests/test_combine_yamls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#CWD = Path.cwd()
TEST_DIR = Path("fre/yamltools/tests")
IN_DIR = Path(f"{TEST_DIR}/AM5_example")
SCHEMA_DIR = Path("fre/gfdl_msd_schemas/FRE")

# Create output directories
COMP_OUT_DIR = Path(f"{TEST_DIR}/combine_yamls_out/compile")
Expand Down Expand Up @@ -81,8 +82,8 @@ def test_combined_compileyaml_validation():
Validate the combined compile yaml
"""
combined_yamlfile =f"{COMP_OUT_DIR}/combined-{COMP_EXPERIMENT}.yaml"
schema_file = os.path.join(f"{IN_DIR}","compile_yamls","schema.json")

schema_file = os.path.join(SCHEMA_DIR, "fre_make.json")
with open(combined_yamlfile,'r') as cf:
yml = yaml.safe_load(cf)

Expand Down Expand Up @@ -134,7 +135,7 @@ def test_combined_compileyaml_validatefail():

# Validate against schema; should fail
wrong_combined = Path(f"{COMP_OUT_DIR}/combined-am5-wrong_datatype.yaml")
schema_file = os.path.join(f"{IN_DIR}","compile_yamls","schema.json")
schema_file = os.path.join(SCHEMA_DIR, "fre_make.json")

# Open/load combined yaml file
with open(wrong_combined,'r') as cf:
Expand Down
4 changes: 2 additions & 2 deletions meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package:
version: '{{ environ.get("GIT_DESCRIBE_TAG", data.get("version")) }}'

source:
path: .
# path: .
# ideally we want this git_url path, but it messes with conda publish
# where it builds only the sourced url and not local/branch changes
# git_url: https://github.com/NOAA-GFDL/fre-cli
git_url: https://github.com/NOAA-GFDL/fre-cli.git

build:
script:
Expand Down

0 comments on commit 20e943a

Please sign in to comment.