Skip to content

Commit a6578bc

Browse files
authored
fix-3064 (#3080)
* Create qiita-ci.yml * add passwd to psql * nginx + redis * redis via conda * redis-server - -> redis-server -- * daemonize -> daemonize * conda libevent * apt-get libevent-dev * adding multiple sections * rm travis_retry * add missing activagte * onfig_test.cfg * rm indent * add 1 indent * pgport * add drop * change db name * redis version * redis -> redbiom version * split tests * source .profile * adding ssh command * mkdir ~/.ssh/ * only ssh * pushing to retrigger * add run * split ssh conf/run * 60367309 * add bash * fix ident * rm ssh cmd * strict=no * localhost * mod permissions * user ssh * rm keys * echos * start ssh service * ssh -vvv * split setup/test * localhost -> 127 * localhost -> 127 * rm ssh setup * -o StrictHostKeyChecking=no * change key creation * echo sshd_config * readd ssh config * cp sshd_config and then move * rm echos * extra qiita folder * ls test_data * rm qiita folder * use key in .ssh * more ssh params * tee -> > * chmod * fullpath * ls key * rm localhost * params * rsa -> rsa-sha2-256 * rm root login * readd -o StrictHostKeyChecking=no * minimizing params * permissions * cleaning up * comments => echo * -o StrictHostKeyChecking=no * export REDBIOM_HOST=http://127.0.0.1:7379 * localhost -> 127.0.0.1 * add runner * cover package * cleaning env vars * renaming jobs * redbiom host * add env vars via export * changing echo * add env COVER_PACKAGE * rm user sftp * just qiita_db * open_sftp -> SFTPClient * +1 worker * only SCPClient * ssh.SCPClient -> SCPClient * return sftp/ssh back * just qiita_db * rm sftp * add all tests * BASE_URL = https://127.0.0.1:8383 * bash -c * start_biom * start_biom 127 * populate QIITA_SERVER_CERT * nginx 127 * adding ports to conf * lowering ports * service qiita * 8383 postgres * curl test * mkdir nginx * moving tests around * moving curl up * echos for curl * sleep 10 * 127.0.0.1 -> localhost * returning some localhost to 127... * qiita_pet! * final clean up * kill qiita first * addreesing @ElDeveloper comments * checkout repo for flake8 * split cover_package
1 parent e979bff commit a6578bc

File tree

11 files changed

+241
-161
lines changed

11 files changed

+241
-161
lines changed

.github/workflows/qiita-ci.yml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# name: Qiita 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+
strategy:
14+
matrix:
15+
include:
16+
- cover_package: "qiita_db"
17+
- cover_package: "qiita_pet qiita_core qiita_ware"
18+
19+
services:
20+
postgres:
21+
# Docker Hub image
22+
image: postgres:9.5
23+
env:
24+
POSTGRES_DB: postgres
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
COVER_PACKAGE: ${{ matrix.cover_package }}
28+
29+
# Set health checks to wait until postgres has started
30+
options: >-
31+
--health-cmd pg_isready
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
ports:
36+
# based on https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml#L44-L72
37+
- 5432/tcp
38+
39+
steps:
40+
# Downloads a copy of the code in your repository before running CI tests
41+
- name: Check out repository code
42+
uses: actions/checkout@v2
43+
44+
- name: Setup for conda
45+
uses: conda-incubator/setup-miniconda@v2
46+
with:
47+
auto-update-conda: true
48+
python-version: 3.6
49+
50+
- name: Basic dependencies install
51+
env:
52+
COVER_PACKAGE: ${{ matrix.cover_package }}
53+
shell: bash -l {0}
54+
run: |
55+
echo "Testing: " $COVER_PACKAGE
56+
57+
# pull out the port so we can modify the configuration file easily
58+
pgport=${{ job.services.postgres.ports[5432] }}
59+
sed -i "s/PORT = 5432/PORT = $pgport/" qiita_core/support_files/config_test.cfg
60+
61+
# PGPASSWORD is read by pg_restore, which is called by the build_db process.
62+
export PGPASSWORD=postgres
63+
64+
# Setting up main qiita conda environment
65+
conda config --add channels conda-forge
66+
conda create -q --yes -n qiita python=3.6 pip libgfortran numpy nginx cython redis
67+
conda activate qiita
68+
pip install sphinx sphinx-bootstrap-theme nose-timer codecov Click
69+
70+
# Configuring SSH
71+
cp /etc/ssh/sshd_config sshd_config
72+
echo "RSAAuthentication yes" > sshd_config
73+
echo "PubkeyAuthentication yes" > sshd_config
74+
echo "StrictModes no" > sshd_config
75+
sudo mv sshd_config /etc/ssh/sshd_config
76+
sudo systemctl restart ssh
77+
78+
- name: Webdis install
79+
shell: bash -l {0}
80+
run: |
81+
sudo apt-get -y install libevent-dev
82+
git clone https://github.com/nicolasff/webdis
83+
cd webdis
84+
make
85+
86+
- name: Main install
87+
shell: bash -l {0}
88+
run: |
89+
conda activate qiita
90+
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
91+
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
92+
export REDBIOM_HOST="http://localhost:7379"
93+
pip install . --no-binary redbiom
94+
pwd
95+
mkdir ~/.qiita_plugins
96+
97+
- name: Install plugins
98+
shell: bash -l {0}
99+
run: |
100+
wget https://data.qiime2.org/distro/core/qiime2-2019.4-py36-linux-conda.yml
101+
conda env create -q -n qtp-biom --file qiime2-2019.4-py36-linux-conda.yml
102+
rm qiime2-2019.4-py36-linux-conda.yml
103+
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
104+
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
105+
export REDBIOM_HOST="http://localhost:7379"
106+
conda activate qtp-biom
107+
pip install -U pip
108+
pip install https://github.com/qiita-spots/qiita_client/archive/master.zip
109+
pip install https://github.com/qiita-spots/qtp-biom/archive/master.zip
110+
configure_biom --env-script "source /home/runner/.profile; conda activate qtp-biom" --server-cert $QIITA_SERVER_CERT
111+
112+
- name: Starting services
113+
shell: bash -l {0}
114+
run: |
115+
conda activate qiita
116+
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
117+
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
118+
export REDBIOM_HOST="http://localhost:7379"
119+
120+
echo "1. Setting up redis"
121+
redis-server --daemonize yes --port 7777
122+
redis-server --daemonize yes --port 6379
123+
124+
echo "2. Starting webdis"
125+
pushd webdis
126+
./webdis &
127+
popd
128+
129+
echo "3. Starting redbiom: " $REDBIOM_HOST
130+
curl -s http://localhost:7379/FLUSHALL > /dev/null
131+
redbiom --version
132+
redbiom admin scripts-writable
133+
redbiom admin create-context --name "qiita-test" --description "qiita-test context"
134+
redbiom admin load-sample-metadata --metadata `pwd`/qiita_db/support_files/test_data/templates/1_19700101-000000.txt
135+
redbiom admin load-sample-metadata-search --metadata `pwd`/qiita_db/support_files/test_data/templates/1_19700101-000000.txt
136+
redbiom admin load-sample-data --table `pwd`/qiita_db/support_files/test_data/processed_data/1_study_1001_closed_reference_otu_table.biom --context qiita-test --tag 4
137+
redbiom admin load-sample-data --table `pwd`/qiita_db/support_files/test_data/processed_data/1_study_1001_closed_reference_otu_table-for_redbiom_tests.biom --context qiita-test --tag 5
138+
139+
echo "4. Setting up nginx"
140+
mkdir -p /usr/share/miniconda/envs/qiita/var/run/nginx/
141+
nginx -c ${PWD}/qiita_pet/nginx_example.conf
142+
143+
echo "5. Setting up qiita"
144+
conda activate qiita
145+
qiita-env make --no-load-ontologies
146+
qiita-test-install
147+
qiita plugins update
148+
149+
echo "6. Starting supervisord => multiple qiita instances"
150+
supervisord -c ${PWD}/qiita_pet/supervisor_example.conf
151+
sleep 10
152+
cat /tmp/supervisord.log
153+
154+
echo "7. Starting plugins"
155+
conda deactivate
156+
conda activate qtp-biom
157+
export QIITA_CLIENT_DEBUG_LEVEL=DEBUG
158+
start_biom https://localhost:8383 register ignored
159+
conda deactivate
160+
161+
echo "8. Setting up SSH"
162+
ssh-keygen -t rsa-sha2-256 -b 4096 -N '' -f $PWD/qiita_ware/test/test_data/test_key
163+
mkdir ~/.ssh/
164+
cp $PWD/qiita_ware/test/test_data/test_key* ~/.ssh/
165+
cat ~/.ssh/test_key.pub > ~/.ssh/authorized_keys
166+
chmod 600 $PWD/qiita_ware/test/test_data/test_key*
167+
chmod 600 ~/.ssh/*
168+
chmod 700 ~/.ssh/
169+
scp -o StrictHostKeyChecking=no -i $PWD/qiita_ware/test/test_data/test_key $USER@localhost:$PWD/qiita_ware/test/test_data/random_key $PWD/qiita_ware/test/test_data/random_key_copy
170+
171+
- name: Main tests
172+
shell: bash -l {0}
173+
env:
174+
COVER_PACKAGE: ${{ matrix.cover_package }}
175+
run: |
176+
conda activate qiita
177+
bash -c 'source /home/runner/.profile; conda activate qtp-biom; start_biom --help'
178+
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
179+
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
180+
export REDBIOM_HOST="http://localhost:7379"
181+
nosetests $COVER_PACKAGE --with-doctest --with-coverage --with-timer -v --cover-package=$COVER_PACKAGE -e 'test_submit_EBI_parse_EBI_reply_failure' -e 'test_full_submission'
182+
183+
# killing the qiita server to run the next commands
184+
QIITA_PID=`cat /tmp/supervisord.pid`
185+
kill $QIITA_PID
186+
sleep 10
187+
if [[ "$COVER_PACKAGE" == *"qiita_db"* ]]; then test_data_studies/commands.sh; all-qiita-cron-job; fi
188+
189+
- uses: codecov/codecov-action@v1
190+
with:
191+
file: codecov.yml
192+
fail_ci_if_error: true
193+
194+
lint:
195+
runs-on: ubuntu-latest
196+
steps:
197+
- name: flake8
198+
uses: actions/setup-python@v2
199+
with:
200+
python-version: 3.6
201+
- name: install dependencies
202+
run: python -m pip install --upgrade pip
203+
- name: Check out repository code
204+
uses: actions/checkout@v2
205+
- name: lint
206+
run: |
207+
pip install -q flake8
208+
flake8 qiita_* setup.py scripts/qiita*

.travis.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ future.
7171
existing studies by submitting a fix proposals to the authors of the study.
7272

7373

74-
.. |Build Status| image:: https://travis-ci.org/qiita-spots/qiita.png?branch=master
75-
:target: https://travis-ci.org/qiita-spots/qiita
74+
.. |Build Status| image:: https://github.com/qiita-spots/qiita/actions/workflows/qiita-ci.yml/badge.svg
75+
:target: https://github.com/qiita-spots/qiita/actions/workflows/qiita-ci.yml
7676
.. |Coverage Status| image:: https://codecov.io/gh/qiita-spots/qiita/branch/master/graph/badge.svg
7777
:target: https://codecov.io/gh/qiita-spots/qiita

qiita_core/support_files/config_test.cfg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ REQUIRE_APPROVAL = True
2626
BASE_URL = https://localhost:8383
2727

2828
# Download path files
29-
UPLOAD_DATA_DIR = /home/travis/miniconda3/envs/qiita/lib/python3.6/site-packages/qiita_db/support_files/test_data/uploads/
29+
UPLOAD_DATA_DIR = /home/runner/work/qiita/qiita/qiita_db/support_files/test_data/uploads/
3030

3131
# Working directory path
32-
WORKING_DIR = /home/travis/miniconda3/envs/qiita/lib/python3.6/site-packages/qiita_db/support_files/test_data/working_dir/
32+
WORKING_DIR = /home/runner/work/qiita/qiita/qiita_db/support_files/test_data/working_dir/
3333

3434
# Maximum upload size (in Gb)
3535
MAX_UPLOAD_SIZE = 100
3636

3737
# Path to the base directory where the data files are going to be stored
38-
BASE_DATA_DIR = /home/travis/miniconda3/envs/qiita/lib/python3.6/site-packages/qiita_db/support_files/test_data/
38+
BASE_DATA_DIR = /home/runner/work/qiita/qiita/qiita_db/support_files/test_data/
3939

4040
# Valid upload extension, comma separated. Empty for no uploads
4141
VALID_UPLOAD_EXTENSION = fastq,fastq.gz,txt,tsv,sff,fna,qual
@@ -118,10 +118,10 @@ HOST = localhost
118118
PORT = 5432
119119

120120
# The password to use to connect to the database
121-
PASSWORD =
121+
PASSWORD = postgres
122122

123123
# The postgres password for the admin_user
124-
ADMIN_PASSWORD =
124+
ADMIN_PASSWORD = postgres
125125

126126
# ----------------------------- Torque settings -----------------------------
127127
[torque]

qiita_pet/nginx_example.conf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ http {
88
server localhost:21174;
99
server localhost:21175;
1010
server localhost:21176;
11+
server localhost:21177;
1112
}
1213

1314
# listening to 8080 and redirecting to https
@@ -23,8 +24,8 @@ http {
2324
merge_slashes off;
2425
ssl on;
2526

26-
ssl_certificate /home/travis/miniconda3/envs/qiita/lib/python3.6/site-packages/qiita_core/support_files/server.crt;
27-
ssl_certificate_key /home/travis/miniconda3/envs/qiita/lib/python3.6/site-packages/qiita_core/support_files/server.key;
27+
ssl_certificate /home/runner/work/qiita/qiita/qiita_core/support_files/server.crt;
28+
ssl_certificate_key /home/runner/work/qiita/qiita/qiita_core/support_files/server.key;
2829

2930
ssl_session_timeout 5m;
3031

qiita_pet/supervisor_example.conf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
1010
files=/home/travis/miniconda3/envs/qiita/bin
1111

1212
[group:qiita_all]
13-
programs=qiita_workers_0,qiita_workers_1,qiita_master ; each refers to 'x' in [program:x] definitions
13+
programs=qiita_workers_0,qiita_workers_1,qiita_workers_2,qiita_master ; each refers to 'x' in [program:x] definitions
1414

1515
[program:qiita_master]
1616
command=qiita pet webserver --no-build-docs start --port 21174 --master
@@ -26,3 +26,8 @@ numprocs=1 ; number of processes copies to start (def 1)
2626
command=qiita pet webserver --no-build-docs start --port 21176
2727
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
2828
numprocs=1 ; number of processes copies to start (def 1)
29+
30+
[program:qiita_workers_2]
31+
command=qiita pet webserver --no-build-docs start --port 21177
32+
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
33+
numprocs=1 ; number of processes copies to start (def 1)

0 commit comments

Comments
 (0)