diff --git a/.github/workflows/build_conda.yml b/.github/workflows/build_conda.yml new file mode 100644 index 0000000..b7dcede --- /dev/null +++ b/.github/workflows/build_conda.yml @@ -0,0 +1,25 @@ +name: build_conda +on: + [push] +# pull_request: +# branches: +# - FOOmainBAR + +jobs: + build: + runs-on: ubuntu-latest + container: + image: continuumio/miniconda3:latest + steps: + - name: Checkout Files + uses: actions/checkout@v4 + - name: Run Conda to Build + run: | + conda config --append channels conda-forge + conda config --append channels noaa-gfdl + conda install conda-build conda-verify + git submodule update --init --recursive --remote + git config --global --add safe.directory fms_yaml_tools/schema/gfdl_msd_schemas + rm -rf fms_yaml_tools/schema/gfdl_msd_schemas/.git + conda build . + ls . diff --git a/.github/workflows/create_test_conda_env.yml b/.github/workflows/create_test_conda_env.yml new file mode 100644 index 0000000..7785e5c --- /dev/null +++ b/.github/workflows/create_test_conda_env.yml @@ -0,0 +1,41 @@ +name: create_test_conda_env + +on: [push] + +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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 fms_yaml_tools environment + run: | + # create environment containing all dependencies + # the env cannot be explicitly activated in github CI/CD + conda env create -f environment.yml --name fms_yaml_tools + + # add conda env's executables to github's PATH equiv. + echo $CONDA/envs/fms_yaml_tools/bin >> $GITHUB_PATH + + # get fms_yaml_tools/schema/gfdl_msd_schemas/FMS for unittest + git submodule update --init --recursive --remote + + # use *conda environment's pip* to install fms_yaml_tools + # called w/ full path to conda's python for explicitness + # called as a module (-m pip) for explicitness + $CONDA/envs/fms_yaml_tools/bin/python -m pip install --prefix $CONDA/envs/fms_yaml_tools . + + - name: Run unittest in fms_yaml_tools environment + run: | + # try to make sure the right things are in GITHUB_PATH + echo $CONDA/envs/fms_yaml_tools/bin >> $GITHUB_PATH + python -m unittest discover -s test diff --git a/.github/workflows/publish_conda.yml b/.github/workflows/publish_conda.yml new file mode 100644 index 0000000..2d4859a --- /dev/null +++ b/.github/workflows/publish_conda.yml @@ -0,0 +1,22 @@ +name: publish_conda +on: + push: + branches: + - main +jobs: + publish: + runs-on: ubuntu-latest + container: + image: continuumio/miniconda3:latest + steps: + - name: Checkout Files + uses: actions/checkout@v4 + - name: Run Conda to Build and Publish + run: | + conda config --append channels conda-forge + conda config --append channels noaa-gfdl + conda install conda-build anaconda-client conda-verify + export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }} + conda config --set anaconda_upload yes + git submodule update --init --recursive --remote + conda build . diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..7bf8f6d --- /dev/null +++ b/environment.yml @@ -0,0 +1,12 @@ +name: fms_yaml_tools +channels: + - defaults + - conda-forge + - noaa-gfdl +dependencies: + - python + - pip + - click + - pyyaml + - pylint + - jsonschema \ No newline at end of file diff --git a/meta.yaml b/meta.yaml new file mode 100644 index 0000000..a7bd9ac --- /dev/null +++ b/meta.yaml @@ -0,0 +1,39 @@ +package: + name: fms_yaml_tools + version: 'alpha' +# version: '{{ environ.get("GIT_DESCRIBE_TAG", data.get("version")) }}' + +source: + path: . + +build: + script: + - python3 -m pip install . -vv + number: 1 + noarch: python + +channels: + - defaults + - conda-forge + - noaa-gfdl + +requirements: + host: + - python + - pip + run: + - python + - pip + - click + - pyyaml + - pylint + - jsonschema + +test: + source_files: + - fms_yaml_tools/ + commands: + - python -m unittest discover -s test + +about: + home: https://github.com/NOAA-GFDL/fms_yaml_tools \ No newline at end of file