diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..2230e01 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,81 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macOS-latest, ubuntu-latest] + env: + CI_OS: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v1 + - name: Additional info about the build + shell: bash + run: | + uname -a + df -h + ulimit -a + # - name: Lint with flake8 + # shell: bash + # run: | + # . resources/initialize_conda.sh + # conda activate + # sudo ${CONDA}/bin/conda install flake8 + # # stop the build if there are Python syntax errors or undefined names + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Install UCSF Chimera + shell: bash + run: | + if [[ ${CI_OS} == ubuntu-* ]]; then + if [[ ! -e $GITHUB_WORKSPACE/chimera/bin/chimera ]]; then + bash resources/install_chimera.sh + fi + echo "::set-env name=CHIMERADIR::$GITHUB_WORKSPACE/chimera" + else + if [[ ! -e $GITHUB_WORKSPACE/chimera/Chimera.app/Contents/Resources/bin/chimera ]]; then + bash resources/install_chimera.sh + rm -rf $GITHUB_WORKSPACE/chimera/Chimera.app/Contents/Resources/lib/python2.7/site-packages/{AutoDockTools,MolKit,PyBabel,mglutil,mmLib,mslib} + rm -rf $GITHUB_WORKSPACE/chimera/Chimera.app/Contents/Resources/lib/python2.7/site-packages/setuptools* + fi + echo "::set-env name=CHIMERADIR::$GITHUB_WORKSPACE/chimera/Chimera.app/Contents/Resources" + fi + - name: Configure conda + shell: bash + run: | + . resources/initialize_conda.sh + conda activate + conda info + conda config --set always_yes yes + conda config --remove-key channels || true + conda config --add channels conda-forge + conda config --add channels bioconda + conda config --add channels salilab + conda config --add channels omnia + conda config --add channels insilichem + conda config --add channels defaults + sudo ${CONDA}/bin/conda install -q conda conda-build + - name: Build package + shell: bash + run: | + . resources/initialize_conda.sh + env | sort + ls -lh $CHIMERADIR/* + test -f $CHIMERADIR/bin/chimera + sudo ${CONDA}/bin/conda build -c local --python=2.7 conda-recipe + # - name: Deploy + # shell: bash + # run: | + # . resources/initialize_conda.sh + # sudo ${CONDA}/bin/conda install -q anaconda-client + # anaconda -t {{ $secrets.ANACONDA_TOKEN }} upload -u insilichem ${CONDA}/conda-bld/**/gaudi-*.tar.bz2 + # on: + # push: + # tags: + # - 'v*' \ No newline at end of file diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 0c9cf54..94019a7 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -57,6 +57,6 @@ test: source_files: - tests requires: - - pytest 4.0.* + - pytest - pytest-benchmark diff --git a/resources/initialize_conda.sh b/resources/initialize_conda.sh new file mode 100644 index 0000000..64c4749 --- /dev/null +++ b/resources/initialize_conda.sh @@ -0,0 +1,8 @@ +case ${CI_OS} in + windows*) + eval "$(${CONDA}/condabin/conda.bat shell.bash hook)";; + macOS*) + eval "$(${CONDA}/condabin/conda shell.bash hook)";; + *) + eval "$(conda shell.bash hook)";; +esac diff --git a/resources/install_chimera.sh b/resources/install_chimera.sh new file mode 100644 index 0000000..acca8f5 --- /dev/null +++ b/resources/install_chimera.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +PKG_VERSION="1.13.1" + +[[ $ARCH = 32 ]] && echo "32-bit builds are not supported anymore" && exit 1; + +# Linux +uname_out="$(uname -s)" +case "$uname_out" in + Linux* ) + _file="chimera-${PKG_VERSION}-linux_x86_64.bin" + _filepath="linux_x86_64/${_file}" + _installdir="UCSF-Chimera64-${PKG_VERSION}" + _hash="80d2c95f78c603da3acda42f4bbceca0" # v1.13.1 + _agent="Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0" + ;; +# MacOS X + Darwin* ) + _file="chimera-${PKG_VERSION}-mac64.dmg" + _filepath="mac64/${_file}" + _installdir="UCSF-Chimera64-${PKG_VERSION}" + _hash="62251f8677846e367de3cab4b5b1e8af" # v1.13.1 + _agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36" + ;; +# Emulated Windows + CYGWIN*|MINGW*|MSYS*|*windows*) + _file="chimera-${PKG_VERSION}-win64.exe" + _filepath="win64/${_file}" + _installdir="Chimera_${PKG_VERSION}" + _hash="1cb7f1f4138fc4ff34a5c3383623b4a4" # v1.13.1 + _agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14931" + ;; + *) + echo "Platform ${uname_out} not supported" + exit 1 + ;; +esac + +_downloader="https://www.rbvi.ucsf.edu/chimera/cgi-bin/secure/chimera-get.py" + +download(){ + _download=$(command curl -A "${_agent}" -F file=${_filepath} -F choice=Accept "${_downloader}" | grep href | sed -E 's/.*href="(.*)">/\1/'); + sleep 3; + command curl -A "${_agent}" "https://www.cgl.ucsf.edu${_download}" -o "${_file}"; +} + +download_retry(){ + n=0; + until [ $n -ge 10 ]; do + download; + echo "${_hash} ${_file}" | md5sum -c --strict --quiet && break; + n=$[$n+1]; + sleep 3; + done; + echo "${_hash} ${_file}" | md5sum -c --strict --quiet || exit 1; +} + +installation_linux() { + chmod +x "${_file}"; + echo "$GITHUB_WORKSPACE/chimera" | "./${_file}"; +} + +installation_mac() { + cd "${SRC_DIR}" + hdiutil convert "${_file}" -format UDRW -o chimerarw + _mountdir=$(echo `hdiutil attach -mountpoint "$GITHUB_WORKSPACE/chimera" chimerarw.dmg | tail -1 | awk '{$1=$2=""; print $0}'` | xargs -0 echo) + echo "Installed at ${_mountdir}" +} + +installation_win() { + cd "${SRC_DIR}" + cmd.exe /C "START /WAIT ${_file} /VERYSILENT /DIR=$CHIMERADIR" +} + + +set +x +echo 'IMPORTANT: By downloading you accept the UCSF Chimera Non-Commercial Software License Agreement!' +echo 'IMPORTANT: The license agreement can be found here: http://www.cgl.ucsf.edu/chimera/license.html' +echo 'IMPORTANT: If you do not agree, please press Ctrl-C now.' +echo 'IMPORTANT: Downloading in 10 seconds...' +sleep 10 +set -x + +# Linux +case "$uname_out" in + Linux* ) + download_retry + installation_linux + ;; +# MacOS X + Darwin* ) + download + installation_mac + ;; +# Emulated Windows + CYGWIN*|MINGW*|MSYS*|*windows*) + download + installation_win + ;; + *) + echo "Platform ${uname_out} not supported" + exit 1 + ;; +esac \ No newline at end of file