From 704686b95a771023b774fcc931feb0dddb76b185 Mon Sep 17 00:00:00 2001 From: omodei Date: Thu, 31 Oct 2019 16:50:48 -0700 Subject: [PATCH] Cleaning the script adding libgfortran<3 dependency --- build_local.sh | 68 ++++++++++++++----------- ci/build_and_test.sh | 12 +---- conda_recipe/xspec-modelsonly/meta.yaml | 2 +- 3 files changed, 40 insertions(+), 42 deletions(-) diff --git a/build_local.sh b/build_local.sh index 7a3b96a..9dc8863 100755 --- a/build_local.sh +++ b/build_local.sh @@ -1,22 +1,13 @@ #!/usr/bin/env bash # Make sure we fail in case of errors set -e - -# FLAGS AND ENVIRONMENT: - +# FROM TRAVIS: TRAVIS_OS_NAME="unknown" -UPDATE_CONDA=true TRAVIS_PYTHON_VERSION=2.7 TRAVIS_BUILD_NUMBER=1 - -LIBGFORTRAN_VERSION="3.0" -READLINE_VERSION="6.2" - -ENVNAME=xsmodelsonly_test_$TRAVIS_PYTHON_VERSION - - -conda_channel=conda-forge/label/cf201901 - +TRAVIS_EVENT_TYPE="push" +#TRAVIS_BRANCH="master" +TRAVIS_BRANCH="no_master" if [[ "$OSTYPE" == "linux-gnu" ]]; then # Linux @@ -47,13 +38,20 @@ else fi -echo "Running on ${TRAVIS_OS_NAME}" -echo "Python version: ${TRAVIS_PYTHON_VERSION}" -#conda config --remove channels conda-forge -#conda config --remove channels default +# Build and test... +# FLAGS AND ENVIRONMENT: +LIBGFORTRAN_VERSION="3.0" +READLINE_VERSION="6.2" +UPDATE_CONDA=false + +ENVNAME=xsmodelsonly_test_$TRAVIS_PYTHON_VERSION + +conda_channel=conda-forge/label/cf201901 +echo "Running on ${TRAVIS_OS_NAME}" +echo "Python version: ${TRAVIS_PYTHON_VERSION}" if $UPDATE_CONDA ; then # Updating conda @@ -89,14 +87,17 @@ echo "=====================> Activate test environment..." source $CONDA_PREFIX/etc/profile.d/conda.sh conda activate $ENVNAME #source activate $ENVNAME + echo "======> getting the file..." if ! [ -f xspec-modelsonly-v6.22.1.tar.gz ]; then curl -LO -z xspec-modelsonly-v6.22.1.tar.gz https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft6.22.1/xspec-modelsonly-v6.22.1.tar.gz fi -#conda install conda-verify # Build package echo "Build package..." + +#conda install conda-verify + if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then conda build --python=$TRAVIS_PYTHON_VERSION conda_recipe/xspec-modelsonly #conda index $HOME/miniconda/conda-bld @@ -108,16 +109,21 @@ fi echo "======> installing..." conda install --use-local -c $conda_channel xspec-modelsonly -# Run tests -#cd astromodels/tests -#python -m pytest -vv --cov=astromodels # -k "not slow" - -# Codecov needs to run in the main git repo - -## Upload coverage measurements if we are on Linux -#if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - -# echo "********************************** COVERAGE ******************************" -# codecov -t 493c9a2d-42fc-40d6-8e65-24e681efaa1e# - -#fi +# UPLOAD TO CONDA: +# If we are on the master branch upload to the channel +if [[ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]]; then + echo "This is a pull request, not uploading to Conda channel" +else + if [[ "${TRAVIS_EVENT_TYPE}" == "push" ]]; then + echo "This is a push to TRAVIS_BRANCH=${TRAVIS_BRANCH}" + if [[ "${TRAVIS_BRANCH}" == "master" ]]; then + conda install -c conda-forge anaconda-client + echo "Uploading ${CONDA_BUILD_PATH}" + if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + anaconda -t $CONDA_UPLOAD_TOKEN upload -u omodei $HOME/miniconda/conda-bld/linux-64/*.tar.bz2 --force + else + anaconda -t $CONDA_UPLOAD_TOKEN upload -u omodei $HOME/miniconda/conda-bld/*/*.tar.bz2 --force + fi + fi + fi +fi diff --git a/ci/build_and_test.sh b/ci/build_and_test.sh index 046c206..4fe215d 100755 --- a/ci/build_and_test.sh +++ b/ci/build_and_test.sh @@ -11,13 +11,6 @@ ENVNAME=xsmodelsonly_test_$TRAVIS_PYTHON_VERSION conda_channel=conda-forge/label/cf201901 -if [[ ${TRAVIS_OS_NAME} == linux ]]; -then - miniconda_os=Linux -else # osx - miniconda_os=MacOSX -fi - echo "Running on ${TRAVIS_OS_NAME}" echo "Python version: ${TRAVIS_PYTHON_VERSION}" @@ -53,7 +46,6 @@ conda config --add channels $conda_channel echo "=====================> Activate test environment..." #source $CONDA_PREFIX/etc/profile.d/conda.sh - source activate $ENVNAME echo "======> getting the file..." @@ -89,9 +81,9 @@ else conda install -c conda-forge anaconda-client echo "Uploading ${CONDA_BUILD_PATH}" if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - anaconda -t $CONDA_UPLOAD_TOKEN upload -u omodei /home/travis/miniconda/conda-bld/linux-64/*.tar.bz2 --force + anaconda -t $CONDA_UPLOAD_TOKEN upload -u threeml /home/travis/miniconda/conda-bld/linux-64/*.tar.bz2 --force else - anaconda -t $CONDA_UPLOAD_TOKEN upload -u omodei /Users/travis/miniconda/conda-bld/*/*.tar.bz2 --force + anaconda -t $CONDA_UPLOAD_TOKEN upload -u threeml /Users/travis/miniconda/conda-bld/*/*.tar.bz2 --force fi fi fi diff --git a/conda_recipe/xspec-modelsonly/meta.yaml b/conda_recipe/xspec-modelsonly/meta.yaml index 224ac13..76cca1b 100644 --- a/conda_recipe/xspec-modelsonly/meta.yaml +++ b/conda_recipe/xspec-modelsonly/meta.yaml @@ -19,7 +19,7 @@ requirements: - {{ compiler('c') }} # [linux] - {{ compiler('cxx') }} # [linux] - {{ compiler('fortran') }} # [linux] - - libgfortran>=3.0 + - libgfortran>=3.0,<4.0 - ncurses==5.9 - readline==6.2 - toolchain==2.1.2