Skip to content

Commit

Permalink
Merge pull request #71 from openalea/conda
Browse files Browse the repository at this point in the history
Update Conda packaging with noarch Python Package
  • Loading branch information
pradal authored Apr 15, 2022
2 parents 673121c + 7f869f0 commit 5fe77ca
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 103 deletions.
123 changes: 30 additions & 93 deletions .github/workflows/conda-package-build.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,42 @@
name: Building Package using Conda
name: Building and publish package using anaconda

on:
push:
branches: [ master ]
tags:
- 'v*'
branches:
- '*'
pull_request:
branches: [ master ]

workflow_dispatch: # allows you to trigger manually

jobs:
build:
build-and-publish:
name: ${{ matrix.os }}, Python 3.${{ matrix.python-minor-version }} for conda deployment
runs-on: ${{ matrix.os }}
strategy:
#max-parallel: 5
fail-fast: false
max-parallel: 3
matrix:
os: [ macos-latest, ubuntu-latest]
env:
- CONDA_PY: "37"
CONDA_NPY: "111"
- CONDA_PY: "38"
CONDA_NPY: "116"
- CONDA_PY: "39"
CONDA_NPY: "119"

environment: anaconda_build
os: [ ubuntu-latest ]
python-minor-version: [7]

steps:
- uses: actions/checkout@v2

- name: Add conda to system path
run: |
# Add conda to system path
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Setup conda
run: |
# Setup conda
sudo conda config --add channels openalea3
sudo conda config --add channels conda-forge
sudo conda config --set always_yes yes
sudo conda config --set remote_read_timeout_secs 600
sudo conda config --set auto_update_conda False
sudo conda install conda-build anaconda-client
- name: Build
env:
CONDA_PY: ${{ matrix.env.CONDA_PY }}
CONDA_NPY: ${{ matrix.env.CONDA_NPY }}
run: |
# Build
if [[ "$CONDA_PY" = "" ]]; then
echo "CONDA_PY is not defined"
exit -1
fi
if [[ "$CONDA_NPY" = "" ]]; then
echo "CONDA_NPY is not defined"
exit -1
fi
export PYTHON_VERSION=${CONDA_PY:0:1}.${CONDA_PY:1:1}
export NUMPY_VERSION=${CONDA_NPY:0:1}.${CONDA_NPY:1:2}
export BUILD_CMD="sudo conda build . --python=$PYTHON_VERSION"
export BUILD_OUTPUT=`$BUILD_CMD --output`
if [[ "$BUILD_OUTPUT" = "" ]]; then
echo "PACKAGE NAME is not defined"
exit -1
fi
echo "BUILD_OUTPUT=$BUILD_OUTPUT" >> $GITHUB_ENV
$BUILD_CMD
- name: Login
env:
ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD }}
run: |
# Login
if [[ "$ANACONDA_LOGIN" = "" ]]; then
echo "ANACONDA_LOGIN is not defined"
exit -1
fi
SESSION_UID=$(uuidgen)
anaconda login --username $ANACONDA_LOGIN --password $ANACONDA_PASSWORD --hostname $SESSION_UID
- name: Deploy
env:
ANACONDA_OWNER: ${{ secrets.ANACONDA_OWNER }}
BUILD_OUTPUT: ${{ env.BUILD_OUTPUT }}
run: |
# Deploy
if [[ "$ANACONDA_OWNER" = "" ]]; then
echo "ANACONDA_OWNER is not defined"
exit -1
fi
echo "PACKAGE NAME:" $BUILD_OUTPUT
if [[ "$BUILD_OUTPUT" = "" ]]; then
echo "PACKAGE NAME is not defined"
exit -1
fi
anaconda upload --skip-existing $BUILD_OUTPUT -u $ANACONDA_OWNER --no-progress
- uses: actions/checkout@v3
- name: Determine publish
uses: haya14busa/action-cond@v1
id: publish
with:
cond: ${{ startsWith(github.ref, 'refs/tags/v') }}
if_true: 'true'
if_false: 'false'
- name: Build and Publish
uses: openalea/action-build-publish-anaconda@v0.1.2
with:
conda: conda
mamba: false
python: ${{ matrix.python-minor-version }}
channels: openalea3, conda-forge
token: ${{ secrets.ANACONDA_TOKEN }}
publish: ${{ steps.publish.outputs.value }}
label: main
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ doc/_dvlpt/
# vscode
*.code-workspace
.vscode


# Mac
.DS_Store

13 changes: 7 additions & 6 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ source:
path: ..

build:
noarch: python
preserve_egg_dir: True
number: 0
script: python setup.py install
number: 1
script: python setup.py install --single-version-externally-managed --record=record.txt

requirements:
host:
build:
- python {{PY_VER}}
- openalea.deploy
run:
- python {{PY_VER}}
- python >=3.6
- openalea.deploy
- oawidgets
- openalea.mtg
- openalea.plantgl
- openalea.mtg
- oawidgets
- pandas
- jupyter
- voila
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
long_description = open('README.md').read()

authors="Marc Labadie, Christophe Pradal, Gaetan Heidsieck"
authors_email="marc.labadie@inra.fr, christophe.pradal@cirad.fr"
authors_email="marc.labadie@cirad.fr, christophe.pradal@cirad.fr"

url = "https://github.com/openalea/strawberry"

Expand Down Expand Up @@ -44,7 +44,7 @@
share_dirs={'share': 'share'},

# Namespace packages creation by deploy
namespace_packages=['openalea'],
#namespace_packages=['openalea'],
zip_safe=False,

# Dependencies
Expand Down

0 comments on commit 5fe77ca

Please sign in to comment.