Skip to content

Commit

Permalink
Merge pull request #1 from ilaflott/add_conda_environment_yaml
Browse files Browse the repository at this point in the history
Add conda environment yaml
  • Loading branch information
ilaflott authored Oct 17, 2024
2 parents ffb4af4 + 9c80f99 commit 8a2f383
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build_conda.yml
Original file line number Diff line number Diff line change
@@ -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 .
41 changes: 41 additions & 0 deletions .github/workflows/create_test_conda_env.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions .github/workflows/publish_conda.yml
Original file line number Diff line number Diff line change
@@ -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 .
12 changes: 12 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: fms_yaml_tools
channels:
- defaults
- conda-forge
- noaa-gfdl
dependencies:
- python
- pip
- click
- pyyaml
- pylint
- jsonschema
39 changes: 39 additions & 0 deletions meta.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8a2f383

Please sign in to comment.