From 806658e5f8e44715e6bf3fe41f00477eda80f925 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Mon, 9 Dec 2019 16:31:27 +0100 Subject: [PATCH 01/12] Add support for GitHub Actions CI --- .github/workflows/ci.yaml | 79 +++++++++++++++++++++++++++++++++++ resources/initialize_conda.sh | 8 ++++ 2 files changed, 87 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 resources/initialize_conda.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..ecd75e0 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,79 @@ +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 + pip 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: | + wget https://raw.githubusercontent.com/insilichem/pychimera/master/scripts/install_chimera.sh + + if [[ ${CI_OS} == linux-* ]]; then + if [[ ! -e $HOME/chimera/bin/chimera ]]; then + bash install_chimera.sh + fi + echo "::set-env name=CHIMERADIR::$HOME/chimera" + else + if [[ ! -e $HOME/chimera/Chimera.app/Contents/Resources/bin/chimera ]]; then + bash install_chimera.sh + rm -rf $HOME/chimera/Chimera.app/Contents/Resources/lib/python2.7/site-packages/{AutoDockTools,MolKit,PyBabel,mglutil,mmLib,mslib} + rm -rf $HOME/chimera/Chimera.app/Contents/Resources/lib/python2.7/site-packages/setuptools* + fi + echo "::set-env name=CHIMERADIR::$HOME/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 + conda install -q conda conda-build + - name: Build package + shell: bash + run: | + . resources/initialize_conda.sh + conda build -c local --python=2.7 conda-recipe + # - name: Deploy + # shell: bash + # run: | + # conda install -q anaconda-client + # anaconda -t {{ $secrets.ANACONDA_TOKEN }} upload -u insilichem $HOME/miniconda/conda-bld/**/gaudi-*.tar.bz2 + # on: + # push: + # tags: + # - 'v*' \ No newline at end of file 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 From 9bc16df080a4b157dcdc709c0b494589af2c9cf4 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Mon, 9 Dec 2019 16:36:11 +0100 Subject: [PATCH 02/12] Disable linting for now --- .github/workflows/ci.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ecd75e0..81ba3f8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,16 +20,16 @@ jobs: uname -a df -h ulimit -a - - name: Lint with flake8 - shell: bash - run: | - . resources/initialize_conda.sh - conda activate - pip 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: Lint with flake8 + # shell: bash + # run: | + # . resources/initialize_conda.sh + # conda activate + # pip 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: | From 11802b657a42c240eec4f5078418bb386eca70d2 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Mon, 9 Dec 2019 16:40:22 +0100 Subject: [PATCH 03/12] Disable OSX for now - will re-enable later --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 81ba3f8..494d9ca 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macOS-latest, ubuntu-latest] + # os: [macOS-latest, ubuntu-latest] + os: [ubuntu-latest] env: CI_OS: ${{ matrix.os }} From 200b12c1f48457c0638f5fa625e0fe5d1c4c6450 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Mon, 9 Dec 2019 16:44:08 +0100 Subject: [PATCH 04/12] Fix CI_OS checks --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 494d9ca..11ebc02 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,7 +36,7 @@ jobs: run: | wget https://raw.githubusercontent.com/insilichem/pychimera/master/scripts/install_chimera.sh - if [[ ${CI_OS} == linux-* ]]; then + if [[ ${CI_OS} == ubuntu-* ]]; then if [[ ! -e $HOME/chimera/bin/chimera ]]; then bash install_chimera.sh fi From 9746aa39a7dba49365d663400204c39e42992b88 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Mon, 9 Dec 2019 16:55:40 +0100 Subject: [PATCH 05/12] Do not pin pytest --- conda-recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From b90dea5bd394c8f28f7caf96190d8b6743db1bea Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 10 Dec 2019 16:11:57 +0100 Subject: [PATCH 06/12] GHA: Re-enable MacOS --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 11ebc02..04a2eed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,8 +8,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - # os: [macOS-latest, ubuntu-latest] - os: [ubuntu-latest] + os: [macOS-latest, ubuntu-latest] env: CI_OS: ${{ matrix.os }} From aa9c0368247d66b256e6f59cd060c516b57149c5 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 10 Dec 2019 16:16:01 +0100 Subject: [PATCH 07/12] GHA: MacOS require sudo permissions for conda root installs --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 04a2eed..2171998 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -62,7 +62,7 @@ jobs: conda config --add channels omnia conda config --add channels insilichem conda config --add channels defaults - conda install -q conda conda-build + sudo ${CONDA}/bin/conda install -q conda conda-build - name: Build package shell: bash run: | From 39592b3358cd23a13dc14d60efbc5e0f6a5d904c Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 10 Dec 2019 16:19:39 +0100 Subject: [PATCH 08/12] GHA: More sudo conda --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2171998..c1f1a3e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: # run: | # . resources/initialize_conda.sh # conda activate - # pip install flake8 + # 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 @@ -67,7 +67,7 @@ jobs: shell: bash run: | . resources/initialize_conda.sh - conda build -c local --python=2.7 conda-recipe + sudo ${CONDA}/bin/conda build -c local --python=2.7 conda-recipe # - name: Deploy # shell: bash # run: | From a83f03496c58a3c46dcf79bf15b41251fb16fe54 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 10 Dec 2019 16:26:48 +0100 Subject: [PATCH 09/12] GHA: Debug env vars --- .github/workflows/ci.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c1f1a3e..be81b1e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -67,12 +67,14 @@ jobs: shell: bash run: | . resources/initialize_conda.sh + env | sort sudo ${CONDA}/bin/conda build -c local --python=2.7 conda-recipe # - name: Deploy # shell: bash # run: | - # conda install -q anaconda-client - # anaconda -t {{ $secrets.ANACONDA_TOKEN }} upload -u insilichem $HOME/miniconda/conda-bld/**/gaudi-*.tar.bz2 + # . 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: From df18d859bfe2cc70387629910406a584c452ef20 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 10 Dec 2019 16:39:14 +0100 Subject: [PATCH 10/12] GHA: Install chimera in GITHUB_WORKSPACE --- .github/workflows/ci.yaml | 12 ++-- resources/install_chimera.sh | 104 +++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 resources/install_chimera.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index be81b1e..dd4afb2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,17 +36,17 @@ jobs: wget https://raw.githubusercontent.com/insilichem/pychimera/master/scripts/install_chimera.sh if [[ ${CI_OS} == ubuntu-* ]]; then - if [[ ! -e $HOME/chimera/bin/chimera ]]; then + if [[ ! -e $GITHUB_WORKSPACE/chimera/bin/chimera ]]; then bash install_chimera.sh fi - echo "::set-env name=CHIMERADIR::$HOME/chimera" + echo "::set-env name=CHIMERADIR::$GITHUB_WORKSPACE/chimera" else - if [[ ! -e $HOME/chimera/Chimera.app/Contents/Resources/bin/chimera ]]; then + if [[ ! -e $GITHUB_WORKSPACE/chimera/Chimera.app/Contents/Resources/bin/chimera ]]; then bash install_chimera.sh - rm -rf $HOME/chimera/Chimera.app/Contents/Resources/lib/python2.7/site-packages/{AutoDockTools,MolKit,PyBabel,mglutil,mmLib,mslib} - rm -rf $HOME/chimera/Chimera.app/Contents/Resources/lib/python2.7/site-packages/setuptools* + 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::$HOME/chimera/Chimera.app/Contents/Resources" + echo "::set-env name=CHIMERADIR::$GITHUB_WORKSPACE/chimera/Chimera.app/Contents/Resources" fi - name: Configure conda shell: bash 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 From 1b6f489334caae167a7e9724cd97a7b0c2da8535 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 10 Dec 2019 16:44:55 +0100 Subject: [PATCH 11/12] GHA: Use the new chimera installation script... --- .github/workflows/ci.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dd4afb2..5db03e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,16 +33,14 @@ jobs: - name: Install UCSF Chimera shell: bash run: | - wget https://raw.githubusercontent.com/insilichem/pychimera/master/scripts/install_chimera.sh - if [[ ${CI_OS} == ubuntu-* ]]; then if [[ ! -e $GITHUB_WORKSPACE/chimera/bin/chimera ]]; then - bash install_chimera.sh + 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 install_chimera.sh + 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 From beccb68fa91d586cc413bfa3723bbe3c2b95040f Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 10 Dec 2019 16:53:46 +0100 Subject: [PATCH 12/12] GHA: Is chimera really there? --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5db03e1..2230e01 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -66,6 +66,8 @@ jobs: 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