Skip to content

Commit

Permalink
Merge pull request #5 from openalea/new_features
Browse files Browse the repository at this point in the history
Add numpy feature
  • Loading branch information
thomasarsouze authored Apr 14, 2022
2 parents ce1e80a + 629cfb3 commit 992b0d4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In details, this action:
1. Check if `meta.yml` exists in a directory provided in input
2. Sets-up a basic conda environment with a python version specified in input (python 3 only). You can also specify a list of conda channels you migh need during the building process
3. Installs necessary packages for building and publishing (namely `conda-build` and `anaconda-client`)
4. Compiles the package with `conda build` using the `meta.yml` file rules. If your package uses the `numpy` library as a dependency, please be aware that library versions are tied to python version (so far, existing options are `python3.7`:`numpy1.11`, `python3.8`:`numpy1.16`, `python3.9`:`numpy1.19`)
4. Compiles the package with `conda build` using the `meta.yml` file rules. If your package uses the `numpy` library as a dependency, please be aware that library versions are tied to python version at build time if expressed explicitely in the `meta.yml` file (so far, existing options are `python3.7`:`numpy1.11`, `python3.8`:`numpy1.16`, `python3.9`:`numpy1.19`). Otherwise, `numpy` minor version used at build time can be expressed explicitely in input (cf. bellow).
5. Uploads the package on anaconda.org with `anaconda upload` using a token to access your repository or the one of your organization (cf. procedure [here](#anaconda_token))

The only mandatory input is the anaconda token to access your anaconda repository.
Expand Down Expand Up @@ -83,6 +83,7 @@ jobs:
conda: conda
mamba: true
python: ${{ matrix.python-minor-version }}
numpy: '20.0'
channels: openalea3, conda-forge
token: ${{ secrets.ANACONDA_TOKEN }}
publish: ${{ steps.publish.outputs.value }}
Expand Down Expand Up @@ -121,6 +122,7 @@ The following inputs are available for this action:
|------|-------------|----------|---------------|
|`conda`| Directory with conda recipe (i.e. `meta.yml` file)| No | `.`|
|`python`| Python3 minor version used for building | No | `9` |
|`numpy`| Numpy minor version used for building | No | `''` (fixed by python version)|
|`mamba`| Use mamba to setup miniconda and install in a faster way or not. Uses the latest available version. | No | `false`|
|`token` | Anaconda access Token (cf. use process described [above](#anaconda_token))| Yes | |
|`channels`| Optional Extra anaconda channels to use. Coma-separated syntax | No | `conda-forge`|
Expand Down
29 changes: 19 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
description: 'Python3 minor version used for building. Default `9`.'
required: false
default: '9'
numpy:
description: 'Numpy minor version used for building. Default is fixed by Python version.'
required: false
default: ''
token:
description: 'Anaconda access Token (required)'
required: true
Expand Down Expand Up @@ -70,17 +74,22 @@ runs:
working-directory: ./${{ inputs.conda }}
run: |
echo "::group::Conda packages building"
echo "Associate numpy version to python version provided"
export PYTHON_VERSION="3.${{ inputs.python }}"
if [[ ${PYTHON_VERSION} = "3.7" ]]; then
export NUMPY_VERSION="1.11"
elif [[ ${PYTHON_VERSION} = "3.8" ]]; then
export NUMPY_VERSION="1.16"
elif [[ ${PYTHON_VERSION} = "3.9" ]]; then
export NUMPY_VERSION="1.19"
if [[ ${{ inputs.numpy }} = '' ]]; then
echo "Associate numpy version to python version provided"
export PYTHON_VERSION="3.${{ inputs.python }}"
if [[ ${PYTHON_VERSION} = "3.7" ]]; then
export NUMPY_VERSION="1.11"
elif [[ ${PYTHON_VERSION} = "3.8" ]]; then
export NUMPY_VERSION="1.16"
elif [[ ${PYTHON_VERSION} = "3.9" ]]; then
export NUMPY_VERSION="1.19"
else
echo "Unable to build the package with this version of python (yet). Please choose a subversion of Python3: 7, 8 or 9"
exit 1
fi
else
echo "Unable to build the package with this version of python (yet). Please choose a subversion of Python3: 7, 8 or 9"
exit 1
export NUMPY_VERSION="1.${{ inputs.numpy }}"
echo "Numpy version provided is ${NUMPY_VERSION}"
fi
out_dir=`mktemp -d conda-build-dir.XXXXXX`
echo "Running 'conda build' with python ${PYTHON_VERSION} and numpy ${NUMPY_VERSION}"
Expand Down

0 comments on commit 992b0d4

Please sign in to comment.