Skip to content

fix-3064 #3080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 112 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
987c6c1
Create qiita-ci.yml
antgonza Feb 25, 2021
393dcbb
add passwd to psql
antgonza Feb 25, 2021
6de0a09
nginx + redis
antgonza Feb 25, 2021
3dc47b8
redis via conda
antgonza Feb 25, 2021
07f6aed
redis-server - -> redis-server --
antgonza Feb 25, 2021
14b3713
daemonize -> daemonize
antgonza Feb 25, 2021
94a839f
conda libevent
antgonza Feb 25, 2021
d058a33
apt-get libevent-dev
antgonza Feb 25, 2021
74b99c0
adding multiple sections
antgonza Feb 25, 2021
e3abf08
rm travis_retry
antgonza Feb 25, 2021
421f40b
add missing activagte
antgonza Feb 25, 2021
2ba53ce
onfig_test.cfg
antgonza Feb 25, 2021
c447bfa
rm indent
antgonza Feb 25, 2021
d425d9e
add 1 indent
antgonza Feb 25, 2021
ab7bd26
pgport
antgonza Feb 25, 2021
cb9903a
add drop
antgonza Feb 25, 2021
5ac15b2
change db name
antgonza Feb 25, 2021
e659e51
redis version
antgonza Feb 25, 2021
e733ae4
redis -> redbiom version
antgonza Feb 25, 2021
86ad303
split tests
antgonza Feb 25, 2021
5a34101
source .profile
antgonza Feb 25, 2021
70b51cc
adding ssh command
antgonza Feb 25, 2021
8bbbc45
mkdir ~/.ssh/
antgonza Feb 25, 2021
1c3b8be
only ssh
antgonza Feb 26, 2021
8fbd6f8
pushing to retrigger
antgonza Feb 26, 2021
f8e4e34
add run
antgonza Feb 26, 2021
d665766
split ssh conf/run
antgonza Feb 26, 2021
1bf7a9d
60367309
antgonza Feb 26, 2021
a627559
add bash
antgonza Feb 26, 2021
04b7794
fix ident
antgonza Feb 26, 2021
076036e
rm ssh cmd
antgonza Feb 26, 2021
fad964b
strict=no
antgonza Feb 26, 2021
041a744
localhost
antgonza Feb 26, 2021
0b464d5
mod permissions
antgonza Feb 26, 2021
6b3f3b8
user ssh
antgonza Feb 26, 2021
ddf2d71
rm keys
antgonza Feb 26, 2021
1f8ed84
echos
antgonza Feb 26, 2021
4e2f29e
start ssh service
antgonza Feb 26, 2021
9f1ac42
ssh -vvv
antgonza Feb 26, 2021
accbaad
split setup/test
antgonza Feb 26, 2021
1d6c150
localhost -> 127
antgonza Feb 26, 2021
89bf700
localhost -> 127
antgonza Feb 26, 2021
e68af61
rm ssh setup
antgonza Feb 26, 2021
84107c1
-o StrictHostKeyChecking=no
antgonza Feb 26, 2021
617bb01
change key creation
antgonza Feb 26, 2021
5dcf6e9
echo sshd_config
antgonza Feb 26, 2021
cd719ec
readd ssh config
antgonza Feb 26, 2021
01c0116
cp sshd_config and then move
antgonza Feb 26, 2021
9e7f8eb
rm echos
antgonza Feb 26, 2021
cf378e8
extra qiita folder
antgonza Feb 26, 2021
a21bf29
ls test_data
antgonza Feb 26, 2021
ea8a403
rm qiita folder
antgonza Feb 26, 2021
6f480fb
use key in .ssh
antgonza Feb 26, 2021
45e9aae
more ssh params
antgonza Feb 26, 2021
f35a7e8
tee -> >
antgonza Feb 27, 2021
13b42f7
chmod
antgonza Feb 27, 2021
7a1194d
fullpath
antgonza Feb 27, 2021
3156232
ls key
antgonza Feb 27, 2021
519cc1a
rm localhost
antgonza Feb 27, 2021
1f75f4e
params
antgonza Feb 27, 2021
4ce0a05
rsa -> rsa-sha2-256
antgonza Feb 27, 2021
1af822a
rm root login
antgonza Feb 27, 2021
febd980
readd -o StrictHostKeyChecking=no
antgonza Feb 27, 2021
a3f0b26
minimizing params
antgonza Feb 27, 2021
615becd
permissions
antgonza Feb 27, 2021
46615ec
cleaning up
antgonza Feb 27, 2021
4275503
comments => echo
antgonza Feb 27, 2021
797f089
-o StrictHostKeyChecking=no
antgonza Feb 27, 2021
7a262d4
export REDBIOM_HOST=http://127.0.0.1:7379
antgonza Feb 28, 2021
c82457c
localhost -> 127.0.0.1
antgonza Feb 28, 2021
fdc784e
add runner
antgonza Feb 28, 2021
1fee15a
cover package
antgonza Feb 28, 2021
cc3a1ab
cleaning env vars
antgonza Feb 28, 2021
8ff823a
renaming jobs
antgonza Feb 28, 2021
86bc7e4
redbiom host
antgonza Feb 28, 2021
2d1e4ac
add env vars via export
antgonza Feb 28, 2021
8111edb
changing echo
antgonza Feb 28, 2021
e84647e
add env COVER_PACKAGE
antgonza Feb 28, 2021
23a1793
rm user sftp
antgonza Feb 28, 2021
bc8599b
just qiita_db
antgonza Mar 1, 2021
a3c68a4
open_sftp -> SFTPClient
antgonza Mar 1, 2021
6c01d08
+1 worker
antgonza Mar 1, 2021
1bcb11f
only SCPClient
antgonza Mar 1, 2021
42b70f7
ssh.SCPClient -> SCPClient
antgonza Mar 1, 2021
4393bdb
return sftp/ssh back
antgonza Mar 1, 2021
adbcd34
just qiita_db
antgonza Mar 1, 2021
ca9c60f
rm sftp
antgonza Mar 2, 2021
5bceadc
add all tests
antgonza Mar 2, 2021
851a528
BASE_URL = https://127.0.0.1:8383
antgonza Mar 2, 2021
cc3ba29
bash -c
antgonza Mar 2, 2021
c6dcfa0
start_biom
antgonza Mar 2, 2021
f54279a
start_biom 127
antgonza Mar 2, 2021
a3f6d18
populate QIITA_SERVER_CERT
antgonza Mar 2, 2021
dac1750
nginx 127
antgonza Mar 2, 2021
60ad191
adding ports to conf
antgonza Mar 2, 2021
7d3d4be
lowering ports
antgonza Mar 2, 2021
b704d89
service qiita
antgonza Mar 2, 2021
70b6d90
8383 postgres
antgonza Mar 2, 2021
f92a0cf
curl test
antgonza Mar 2, 2021
3aa7f11
mkdir nginx
antgonza Mar 2, 2021
1128a05
moving tests around
antgonza Mar 2, 2021
9002cf4
moving curl up
antgonza Mar 2, 2021
84af8da
echos for curl
antgonza Mar 2, 2021
7a64717
sleep 10
antgonza Mar 2, 2021
ce1e30b
127.0.0.1 -> localhost
antgonza Mar 2, 2021
023c075
returning some localhost to 127...
antgonza Mar 2, 2021
ba77bdd
qiita_pet!
antgonza Mar 2, 2021
3df0ca7
final clean up
antgonza Mar 2, 2021
9c2c49c
kill qiita first
antgonza Mar 2, 2021
317a650
addreesing @ElDeveloper comments
antgonza Mar 2, 2021
f455ce6
checkout repo for flake8
antgonza Mar 2, 2021
25542f8
split cover_package
antgonza Mar 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 208 additions & 0 deletions .github/workflows/qiita-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
# name: Qiita CI

on:
push:
branches: [ dev ]
pull_request:

jobs:
# derived from https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
main:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- cover_package: "qiita_db"
- cover_package: "qiita_pet qiita_core qiita_ware"
Comment on lines +16 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have the same effect, so just in case you are interested in containing everything in one line.

Suggested change
- cover_package: "qiita_db"
- cover_package: "qiita_pet qiita_core qiita_ware"
- cover_package: ["qiita_db", "qiita_pet qiita_core qiita_ware"]


services:
postgres:
# Docker Hub image
image: postgres:9.5
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
COVER_PACKAGE: ${{ matrix.cover_package }}

# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# based on https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml#L44-L72
- 5432/tcp

steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v2

- name: Setup for conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.6

- name: Basic dependencies install
env:
COVER_PACKAGE: ${{ matrix.cover_package }}
shell: bash -l {0}
run: |
echo "Testing: " $COVER_PACKAGE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


# pull out the port so we can modify the configuration file easily
pgport=${{ job.services.postgres.ports[5432] }}
sed -i "s/PORT = 5432/PORT = $pgport/" qiita_core/support_files/config_test.cfg

# PGPASSWORD is read by pg_restore, which is called by the build_db process.
export PGPASSWORD=postgres

# Setting up main qiita conda environment
conda config --add channels conda-forge
conda create -q --yes -n qiita python=3.6 pip libgfortran numpy nginx cython redis
conda activate qiita
pip install sphinx sphinx-bootstrap-theme nose-timer codecov Click

# Configuring SSH
cp /etc/ssh/sshd_config sshd_config
echo "RSAAuthentication yes" > sshd_config
echo "PubkeyAuthentication yes" > sshd_config
echo "StrictModes no" > sshd_config
sudo mv sshd_config /etc/ssh/sshd_config
sudo systemctl restart ssh

- name: Webdis install
shell: bash -l {0}
run: |
sudo apt-get -y install libevent-dev
git clone https://github.com/nicolasff/webdis
cd webdis
make

- name: Main install
shell: bash -l {0}
run: |
conda activate qiita
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
export REDBIOM_HOST="http://localhost:7379"
pip install . --no-binary redbiom
pwd
mkdir ~/.qiita_plugins

- name: Install plugins
shell: bash -l {0}
run: |
wget https://data.qiime2.org/distro/core/qiime2-2019.4-py36-linux-conda.yml
conda env create -q -n qtp-biom --file qiime2-2019.4-py36-linux-conda.yml
rm qiime2-2019.4-py36-linux-conda.yml
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
export REDBIOM_HOST="http://localhost:7379"
conda activate qtp-biom
pip install -U pip
pip install https://github.com/qiita-spots/qiita_client/archive/master.zip
pip install https://github.com/qiita-spots/qtp-biom/archive/master.zip
configure_biom --env-script "source /home/runner/.profile; conda activate qtp-biom" --server-cert $QIITA_SERVER_CERT

- name: Starting services
shell: bash -l {0}
run: |
conda activate qiita
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
export REDBIOM_HOST="http://localhost:7379"

echo "1. Setting up redis"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using echo, another alternative is to put each of these sections under a -name: Setting up redis tag so that the UI summarizes which step failed, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with echos! :)

redis-server --daemonize yes --port 7777
redis-server --daemonize yes --port 6379

echo "2. Starting webdis"
pushd webdis
./webdis &
popd
Comment on lines +125 to +127
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pushd webdis
./webdis &
popd
$PWD/webdis/webdis &

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my own experience the webdis expects and looks for files in the folder; if you run from outside the folder the expected files are not where they should be


echo "3. Starting redbiom: " $REDBIOM_HOST
curl -s http://localhost:7379/FLUSHALL > /dev/null
redbiom --version
redbiom admin scripts-writable
redbiom admin create-context --name "qiita-test" --description "qiita-test context"
redbiom admin load-sample-metadata --metadata `pwd`/qiita_db/support_files/test_data/templates/1_19700101-000000.txt
redbiom admin load-sample-metadata-search --metadata `pwd`/qiita_db/support_files/test_data/templates/1_19700101-000000.txt
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
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

echo "4. Setting up nginx"
mkdir -p /usr/share/miniconda/envs/qiita/var/run/nginx/
nginx -c ${PWD}/qiita_pet/nginx_example.conf

echo "5. Setting up qiita"
conda activate qiita
qiita-env make --no-load-ontologies
qiita-test-install
qiita plugins update

echo "6. Starting supervisord => multiple qiita instances"
supervisord -c ${PWD}/qiita_pet/supervisor_example.conf
sleep 10
cat /tmp/supervisord.log

echo "7. Starting plugins"
conda deactivate
conda activate qtp-biom
export QIITA_CLIENT_DEBUG_LEVEL=DEBUG
start_biom https://localhost:8383 register ignored
conda deactivate

echo "8. Setting up SSH"
ssh-keygen -t rsa-sha2-256 -b 4096 -N '' -f $PWD/qiita_ware/test/test_data/test_key
mkdir ~/.ssh/
cp $PWD/qiita_ware/test/test_data/test_key* ~/.ssh/
cat ~/.ssh/test_key.pub > ~/.ssh/authorized_keys
chmod 600 $PWD/qiita_ware/test/test_data/test_key*
chmod 600 ~/.ssh/*
chmod 700 ~/.ssh/
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

- name: Main tests
shell: bash -l {0}
env:
COVER_PACKAGE: ${{ matrix.cover_package }}
run: |
conda activate qiita
bash -c 'source /home/runner/.profile; conda activate qtp-biom; start_biom --help'
export QIITA_SERVER_CERT=`pwd`/qiita_core/support_files/server.crt
export QIITA_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
export REDBIOM_HOST="http://localhost:7379"
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'

# killing the qiita server to run the next commands
QIITA_PID=`cat /tmp/supervisord.pid`
kill $QIITA_PID
sleep 10
if [[ "$COVER_PACKAGE" == *"qiita_db"* ]]; then test_data_studies/commands.sh; all-qiita-cron-job; fi

- uses: codecov/codecov-action@v1
with:
file: codecov.yml
fail_ci_if_error: true

lint:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you but maybe the main job could depend on the lint job so that the full test suite isn't run before you find there's a syntax error or something like that. That would also mean that the tests aren't run if there are linting errors which might be undesirable.

runs-on: ubuntu-latest
steps:
- name: flake8
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: install dependencies
run: python -m pip install --upgrade pip
- name: Check out repository code
uses: actions/checkout@v2
- name: lint
run: |
pip install -q flake8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this missing the command that lints the code?

flake8 qiita_* setup.py scripts/qiita*
108 changes: 0 additions & 108 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ future.
existing studies by submitting a fix proposals to the authors of the study.


.. |Build Status| image:: https://travis-ci.org/qiita-spots/qiita.png?branch=master
:target: https://travis-ci.org/qiita-spots/qiita
.. |Build Status| image:: https://github.com/qiita-spots/qiita/actions/workflows/qiita-ci.yml/badge.svg
:target: https://github.com/qiita-spots/qiita/actions/workflows/qiita-ci.yml
.. |Coverage Status| image:: https://codecov.io/gh/qiita-spots/qiita/branch/master/graph/badge.svg
:target: https://codecov.io/gh/qiita-spots/qiita
10 changes: 5 additions & 5 deletions qiita_core/support_files/config_test.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ REQUIRE_APPROVAL = True
BASE_URL = https://localhost:8383

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

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

# Maximum upload size (in Gb)
MAX_UPLOAD_SIZE = 100

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

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

# The password to use to connect to the database
PASSWORD =
PASSWORD = postgres

# The postgres password for the admin_user
ADMIN_PASSWORD =
ADMIN_PASSWORD = postgres

# ----------------------------- Torque settings -----------------------------
[torque]
Expand Down
5 changes: 3 additions & 2 deletions qiita_pet/nginx_example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ http {
server localhost:21174;
server localhost:21175;
server localhost:21176;
server localhost:21177;
}

# listening to 8080 and redirecting to https
Expand All @@ -23,8 +24,8 @@ http {
merge_slashes off;
ssl on;

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

ssl_session_timeout 5m;

Expand Down
7 changes: 6 additions & 1 deletion qiita_pet/supervisor_example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
files=/home/travis/miniconda3/envs/qiita/bin

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

[program:qiita_master]
command=qiita pet webserver --no-build-docs start --port 21174 --master
Expand All @@ -26,3 +26,8 @@ numprocs=1 ; number of processes copies to start (def 1)
command=qiita pet webserver --no-build-docs start --port 21176
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1 ; number of processes copies to start (def 1)

[program:qiita_workers_2]
command=qiita pet webserver --no-build-docs start --port 21177
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1 ; number of processes copies to start (def 1)
Loading