|
| 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 Qiita plugins |
| 77 | + shell: bash -l {0} |
| 78 | + run: | |
| 79 | + conda create -q --yes -n qtp-job-output-folder python=3.6 |
| 80 | + conda activate qtp-job-output-folder |
| 81 | +
|
| 82 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 83 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 84 | + pip --quiet install -U pip |
| 85 | + pip --quiet install . |
| 86 | + pip --quiet install coveralls |
| 87 | +
|
| 88 | + configure_qtp_job_output_folder --env-script "source /home/runner/.profile; conda activate qtp-job-output-folder" --server-cert $QIITA_SERVER_CERT |
| 89 | +
|
| 90 | + echo "Available Qiita plugins" |
| 91 | + ls ~/.qiita_plugins/ |
| 92 | +
|
| 93 | + - name: Starting Main Services |
| 94 | + shell: bash -l {0} |
| 95 | + run: | |
| 96 | + conda activate qiita |
| 97 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 98 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 99 | + sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" `pwd`/qiita-dev/qiita_core/support_files/config_test.cfg > ${QIITA_CONFIG_FP} |
| 100 | +
|
| 101 | + export REDBIOM_HOST="http://localhost:7379" |
| 102 | +
|
| 103 | + echo "1. Setting up redis" |
| 104 | + redis-server --daemonize yes --port 7777 |
| 105 | +
|
| 106 | + echo "2. Setting up nginx" |
| 107 | + mkdir -p ${CONDA_PREFIX}/var/run/nginx/ |
| 108 | + export NGINX_FILE=`pwd`/qiita-dev/qiita_pet/nginx_example.conf |
| 109 | + export NGINX_FILE_NEW=`pwd`/qiita-dev/qiita_pet/nginx_example_local.conf |
| 110 | + sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" ${NGINX_FILE} > ${NGINX_FILE_NEW} |
| 111 | + nginx -c ${NGINX_FILE_NEW} |
| 112 | +
|
| 113 | + echo "3. Setting up qiita" |
| 114 | + qiita-env make --no-load-ontologies |
| 115 | + qiita plugins update |
| 116 | + qiita-test-install |
| 117 | +
|
| 118 | + echo "4. Starting supervisord => multiple qiita instances" |
| 119 | + supervisord -c ${PWD}/qiita-dev/qiita_pet/supervisor_example.conf |
| 120 | + sleep 10 |
| 121 | + cat /tmp/supervisord.log |
| 122 | +
|
| 123 | + - name: Main tests |
| 124 | + shell: bash -l {0} |
| 125 | + env: |
| 126 | + COVER_PACKAGE: ${{ matrix.cover_package }} |
| 127 | + run: | |
| 128 | + conda activate klp |
| 129 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 130 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 131 | +
|
| 132 | + export PYTHONWARNINGS="ignore:Certificate for localhost has no \`subjectAltName\`" |
| 133 | +
|
| 134 | + nosetests --with-doctest --with-coverage -v --cover-package=qp_klp |
| 135 | +
|
| 136 | + - uses: codecov/codecov-action@v1 |
| 137 | + with: |
| 138 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 139 | + file: codecov.yml |
| 140 | + |
| 141 | + lint: |
| 142 | + runs-on: ubuntu-latest |
| 143 | + steps: |
| 144 | + - name: flake8 |
| 145 | + uses: actions/setup-python@v2 |
| 146 | + with: |
| 147 | + python-version: 3.6 |
| 148 | + - name: install dependencies |
| 149 | + run: python -m pip install --upgrade pip |
| 150 | + - name: Check out repository code |
| 151 | + uses: actions/checkout@v2 |
| 152 | + - name: lint |
| 153 | + run: | |
| 154 | + pip install -q flake8 |
| 155 | + flake8 qtp_job_output_folder setup.py scripts/* |
0 commit comments