|
| 1 | +# name: Qiita Plugin CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + # derived from https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml |
| 9 | + main: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + services: |
| 13 | + postgres: |
| 14 | + # Docker Hub image |
| 15 | + image: postgres:13.4 |
| 16 | + env: |
| 17 | + POSTGRES_DB: postgres |
| 18 | + POSTGRES_USER: postgres |
| 19 | + POSTGRES_PASSWORD: postgres |
| 20 | + |
| 21 | + # Set health checks to wait until postgres has started |
| 22 | + options: >- |
| 23 | + --health-cmd pg_isready |
| 24 | + --health-interval 10s |
| 25 | + --health-timeout 5s |
| 26 | + --health-retries 5 |
| 27 | + ports: |
| 28 | + # based on https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml#L44-L72 |
| 29 | + - 5432/tcp |
| 30 | + |
| 31 | + steps: |
| 32 | + # Downloads a copy of the code in your repository before running CI tests |
| 33 | + - name: Check out repository code |
| 34 | + uses: actions/checkout@v2 |
| 35 | + |
| 36 | + - name: Setup for conda |
| 37 | + uses: conda-incubator/setup-miniconda@v2 |
| 38 | + with: |
| 39 | + auto-update-conda: true |
| 40 | + python-version: 3.9 |
| 41 | + |
| 42 | + - name: Basic dependencies install |
| 43 | + env: |
| 44 | + COVER_PACKAGE: ${{ matrix.cover_package }} |
| 45 | + shell: bash -l {0} |
| 46 | + run: | |
| 47 | + echo "Testing: " $COVER_PACKAGE |
| 48 | +
|
| 49 | + # we need to download qiita directly so we have "easy" access to |
| 50 | + # all config files |
| 51 | + wget https://github.com/biocore/qiita/archive/dev.zip |
| 52 | + unzip dev.zip |
| 53 | +
|
| 54 | + # pull out the port so we can modify the configuration file easily |
| 55 | + pgport=${{ job.services.postgres.ports[5432] }} |
| 56 | + sed -i "s/PORT = 5432/PORT = $pgport/" qiita-dev/qiita_core/support_files/config_test.cfg |
| 57 | +
|
| 58 | + # PGPASSWORD is read by pg_restore, which is called by the build_db process. |
| 59 | + export PGPASSWORD=postgres |
| 60 | +
|
| 61 | + # Setting up main qiita conda environment |
| 62 | + conda config --add channels conda-forge |
| 63 | + conda create -q --yes -n qiita python=3.9 libgfortran numpy nginx cython redis |
| 64 | + conda activate qiita |
| 65 | +
|
| 66 | + - name: Qiita install |
| 67 | + shell: bash -l {0} |
| 68 | + run: | |
| 69 | + conda activate qiita |
| 70 | + pip --quiet install qiita-dev/ --no-binary redbiom |
| 71 | + mkdir ~/.qiita_plugins |
| 72 | +
|
| 73 | + - name: Install Qiita plugins |
| 74 | + shell: bash -l {0} |
| 75 | + run: | |
| 76 | + conda create --yes -n qiita_client python=3.9 pip nose flake8 coverage |
| 77 | + conda activate qiita_client |
| 78 | +
|
| 79 | + pip --quiet install . |
| 80 | +
|
| 81 | + - name: Starting Main Services |
| 82 | + shell: bash -l {0} |
| 83 | + run: | |
| 84 | + conda activate qiita |
| 85 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 86 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 87 | + sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" `pwd`/qiita-dev/qiita_core/support_files/config_test.cfg > ${QIITA_CONFIG_FP} |
| 88 | +
|
| 89 | + export REDBIOM_HOST="http://localhost:7379" |
| 90 | +
|
| 91 | + echo "1. Setting up redis" |
| 92 | + redis-server --daemonize yes --port 7777 |
| 93 | +
|
| 94 | + echo "2. Setting up nginx" |
| 95 | + mkdir -p ${CONDA_PREFIX}/var/run/nginx/ |
| 96 | + export NGINX_FILE=`pwd`/qiita-dev/qiita_pet/nginx_example.conf |
| 97 | + export NGINX_FILE_NEW=`pwd`/qiita-dev/qiita_pet/nginx_example_local.conf |
| 98 | + sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" ${NGINX_FILE} > ${NGINX_FILE_NEW} |
| 99 | + nginx -c ${NGINX_FILE_NEW} |
| 100 | +
|
| 101 | + echo "3. Setting up qiita" |
| 102 | + qiita-env make --no-load-ontologies |
| 103 | + qiita plugins update |
| 104 | + qiita-test-install |
| 105 | +
|
| 106 | + echo "4. Starting supervisord => multiple qiita instances" |
| 107 | + supervisord -c ${PWD}/qiita-dev/qiita_pet/supervisor_example.conf |
| 108 | + sleep 10 |
| 109 | + cat /tmp/supervisord.log |
| 110 | +
|
| 111 | + - name: Main tests |
| 112 | + shell: bash -l {0} |
| 113 | + env: |
| 114 | + COVER_PACKAGE: ${{ matrix.cover_package }} |
| 115 | + run: | |
| 116 | + conda activate qiita_client |
| 117 | + export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt |
| 118 | + export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg |
| 119 | +
|
| 120 | + nosetests --with-doctest --with-coverage --cover-package=qiita_client |
| 121 | +
|
| 122 | + - uses: codecov/codecov-action@v1 |
| 123 | + with: |
| 124 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 125 | + file: codecov.yml |
| 126 | + |
| 127 | + lint: |
| 128 | + runs-on: ubuntu-latest |
| 129 | + steps: |
| 130 | + - name: flake8 |
| 131 | + uses: actions/setup-python@v2 |
| 132 | + with: |
| 133 | + python-version: 3.9 |
| 134 | + - name: install dependencies |
| 135 | + run: python -m pip install --upgrade pip |
| 136 | + - name: Check out repository code |
| 137 | + uses: actions/checkout@v2 |
| 138 | + - name: lint |
| 139 | + run: | |
| 140 | + pip --quiet install -q flake8 |
| 141 | + flake8 qiita_client setup.py |
0 commit comments