|
| 1 | +# name: Qiita Plugin CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ dev ] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + # derived from https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml |
| 10 | + main: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + services: |
| 14 | + postgres: |
| 15 | + # Docker Hub image |
| 16 | + image: postgres:9.5 |
| 17 | + env: |
| 18 | + POSTGRES_DB: postgres |
| 19 | + POSTGRES_USER: postgres |
| 20 | + POSTGRES_PASSWORD: postgres |
| 21 | + COVER_PACKAGE: ${{ matrix.cover_package }} |
| 22 | + |
| 23 | + # Set health checks to wait until postgres has started |
| 24 | + options: >- |
| 25 | + --health-cmd pg_isready |
| 26 | + --health-interval 10s |
| 27 | + --health-timeout 5s |
| 28 | + --health-retries 5 |
| 29 | + ports: |
| 30 | + # based on https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml#L44-L72 |
| 31 | + - 5432/tcp |
| 32 | + |
| 33 | + steps: |
| 34 | + # Downloads a copy of the code in your repository before running CI tests |
| 35 | + - name: Check out repository code |
| 36 | + uses: actions/checkout@v2 |
| 37 | + |
| 38 | + - name: Setup for conda |
| 39 | + uses: conda-incubator/setup-miniconda@v2 |
| 40 | + with: |
| 41 | + auto-update-conda: true |
| 42 | + python-version: 3.6 |
| 43 | + |
| 44 | + - name: Basic dependencies install |
| 45 | + env: |
| 46 | + COVER_PACKAGE: ${{ matrix.cover_package }} |
| 47 | + shell: bash -l {0} |
| 48 | + run: | |
| 49 | + echo "Testing: " $COVER_PACKAGE |
| 50 | +
|
| 51 | + # we need to download qiita directly so we have "easy" access to |
| 52 | + # all config files |
| 53 | + wget https://github.com/biocore/qiita/archive/dev.zip |
| 54 | + unzip dev.zip |
| 55 | +
|
| 56 | + # pull out the port so we can modify the configuration file easily |
| 57 | + pgport=${{ job.services.postgres.ports[5432] }} |
| 58 | + sed -i "s/PORT = 5432/PORT = $pgport/" qiita-dev/qiita_core/support_files/config_test.cfg |
| 59 | +
|
| 60 | + # PGPASSWORD is read by pg_restore, which is called by the build_db process. |
| 61 | + export PGPASSWORD=postgres |
| 62 | +
|
| 63 | + # Setting up main qiita conda environment |
| 64 | + conda config --add channels conda-forge |
| 65 | + conda create -q --yes -n qiita python=3.6 pip libgfortran numpy nginx cython redis |
| 66 | + conda activate qiita |
| 67 | + pip install sphinx sphinx-bootstrap-theme nose-timer codecov Click |
| 68 | +
|
| 69 | + - name: Qiita install |
| 70 | + shell: bash -l {0} |
| 71 | + run: | |
| 72 | + conda activate qiita |
| 73 | + pip install qiita-dev/ --no-binary redbiom |
| 74 | + mkdir ~/.qiita_plugins |
| 75 | +
|
| 76 | + - name: Install plugins |
| 77 | + shell: bash -l {0} |
| 78 | + run: | |
| 79 | + conda config --add channels anaconda |
| 80 | + conda config --add channels bioconda |
| 81 | +
|
| 82 | + # installing qtp-sequencing |
| 83 | + conda create -q --yes -n qtp-sequencing python=3.6 pip pigz quast |
| 84 | + conda activate qtp-sequencing |
| 85 | + pip --quiet install https://github.com/qiita-spots/qtp-sequencing/archive/master.zip |
| 86 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 87 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 88 | + configure_qtp_sequencing --env-script "source /home/runner/.profile; conda activate qtp-sequencing" --server-cert $QIITA_SERVER_CERT |
| 89 | +
|
| 90 | + conda deactivate |
| 91 | +
|
| 92 | + # installing this plugin |
| 93 | + conda create -q --yes -n qp-spades python=3.6 cmake clang zlib flash spades |
| 94 | + conda activate qp-spades |
| 95 | +
|
| 96 | + # making sure the installed versions haven't changed |
| 97 | + flash_version=`flash --version` |
| 98 | + spades_version=`spades.py --version` |
| 99 | + if [[ $flash_version != *"v1.2.11"* ]]; then echo "wrong flash version", $flash_version; exit 1; fi |
| 100 | + if [[ $spades_version != *"v3.15.2"* ]]; then echo "wrong spades version", $spades_version; exit 1; fi |
| 101 | +
|
| 102 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 103 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 104 | + pip install -U pip |
| 105 | + pip install . |
| 106 | + configure_qp_spades --env-script "source /home/runner/.profile; conda activate qp-spades" --server-cert $QIITA_SERVER_CERT |
| 107 | +
|
| 108 | + - name: Starting services |
| 109 | + shell: bash -l {0} |
| 110 | + run: | |
| 111 | + conda activate qiita |
| 112 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 113 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 114 | + sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" `pwd`/qiita-dev/qiita_core/support_files/config_test.cfg > ${QIITA_CONFIG_FP} |
| 115 | +
|
| 116 | + export REDBIOM_HOST="http://localhost:7379" |
| 117 | +
|
| 118 | + echo "1. Setting up redis" |
| 119 | + redis-server --daemonize yes --port 7777 |
| 120 | +
|
| 121 | + echo "2. Setting up nginx" |
| 122 | + mkdir -p ${CONDA_PREFIX}/var/run/nginx/ |
| 123 | + export NGINX_FILE=`pwd`/qiita-dev/qiita_pet/nginx_example.conf |
| 124 | + export NGINX_FILE_NEW=`pwd`/qiita-dev/qiita_pet/nginx_example_local.conf |
| 125 | + sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" ${NGINX_FILE} > ${NGINX_FILE_NEW} |
| 126 | + nginx -c ${NGINX_FILE_NEW} |
| 127 | +
|
| 128 | + echo "3. Setting up qiita" |
| 129 | + conda activate qiita |
| 130 | + qiita-env make --no-load-ontologies |
| 131 | + qiita-test-install |
| 132 | + qiita plugins update |
| 133 | +
|
| 134 | + echo "4. Starting supervisord => multiple qiita instances" |
| 135 | + supervisord -c ${PWD}/qiita-dev/qiita_pet/supervisor_example.conf |
| 136 | + sleep 10 |
| 137 | + cat /tmp/supervisord.log |
| 138 | +
|
| 139 | + - name: Main tests |
| 140 | + shell: bash -l {0} |
| 141 | + env: |
| 142 | + COVER_PACKAGE: ${{ matrix.cover_package }} |
| 143 | + run: | |
| 144 | + conda activate qp-spades |
| 145 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 146 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 147 | +
|
| 148 | + nosetests $COVER_PACKAGE --with-doctest --with-coverage -vv --cover-package=$COVER_PACKAGE |
| 149 | +
|
| 150 | + # killing the qiita server to run the next commands |
| 151 | + QIITA_PID=`cat /tmp/supervisord.pid` |
| 152 | + kill $QIITA_PID |
| 153 | + sleep 10 |
| 154 | +
|
| 155 | + - uses: codecov/codecov-action@v1 |
| 156 | + with: |
| 157 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 158 | + file: codecov.yml |
| 159 | + |
| 160 | + lint: |
| 161 | + runs-on: ubuntu-latest |
| 162 | + steps: |
| 163 | + - name: flake8 |
| 164 | + uses: actions/setup-python@v2 |
| 165 | + with: |
| 166 | + python-version: 3.6 |
| 167 | + - name: install dependencies |
| 168 | + run: python -m pip install --upgrade pip |
| 169 | + - name: Check out repository code |
| 170 | + uses: actions/checkout@v2 |
| 171 | + - name: lint |
| 172 | + run: | |
| 173 | + pip install -q flake8 |
| 174 | + flake8 qp_spades setup.py scripts/* |
0 commit comments