add basic test for new workflow #1346
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: MMEDs Tests | |
| on: [push | |
| ] | |
| jobs: | |
| run-tests-complex: | |
| runs-on: ubuntu-22.04 | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Set PYTHONPATH | |
| run: echo "PYTHONPATH=." >> $GITHUB_ENV | |
| - name: Install packages | |
| run: python -m pip install pip==24.0; pip install cryptography; pip install jupyter_client==6.1.12; pip install ipython_genutils==0.2.0; pip install nbconvert==5.6.1; pip install rpy2; pip install ipykernel; pip install pandas==1.2.3; pip install pillow; pip install -U Jinja2==3.0; pip install coverage; | |
| - name: install pandoc | |
| run: sudo apt-get install pandoc; | |
| - name: Start MySQL | |
| run: sudo systemctl start mysql.service; | |
| - name: MySQL Setup | |
| run: mysql -u root -proot < setup.sql | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@1.12.0 | |
| with: | |
| mongodb-version: '6.0' | |
| - name: Server data setup | |
| run: mkdir /home/runner/mmeds_server_data; mkdir /home/runner/conda_envs; mkdir -p /home/runner/conda_env_files/pheniqs; mkdir -p /home/runner/.modules/modulefiles; cp -r ./test_files /home/runner/mmeds_server_data/.; cp ./mmeds/resources/mmeds_stats.yaml /home/runner/mmeds_server_data/.; cp -r ./modules/* /home/runner/.modules/modulefiles/.; cp -r ./conda_env_files/* /home/runner/conda_env_files/.; mkdir /home/runner/mmeds_server_data/taxonomic_databases; touch /home/runner/mmeds_server_data/taxonomic_databases/dummy_classifier.qza; | |
| - name: Python install | |
| run: sudo python setup.py install --verbose; pip install wheel; pip install git+https://github.com/clemente-lab/mmeds-meta@$GITHUB_REF_NAME; | |
| #- name: install jupyter | |
| #run: conda env create -f ./conda_env_files/jupyter_env-github.yaml -p /home/runner/conda_envs/jupyter; | |
| - name: add bioconda channel for qiime | |
| run: conda config --append channels conda-forge --append channels bioconda --append channels defaults | |
| - name: install qiime | |
| run: conda env create -f ./conda_env_files/qiime2-2020.8_env.yaml -p /home/runner/conda_envs/qiime2-2020.8 | |
| #- name: install R | |
| #run: sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common; sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9; sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'; sudo apt install r-base; | |
| #- name: install R dependencies | |
| #run: sudo Rscript -e 'install.packages("GGally",dependencies=TRUE)'; sudo Rscript -e 'install.packages("ggrepel",dependencies=TRUE)'; sudo Rscript -e 'install.packages("RColorBrewer",dependencies=TRUE)'; sudo Rscript -e 'install.packages("ggplot2",dependencies=TRUE)'; | |
| - name: install pheniqs | |
| run: conda env create -f ./conda_env_files/pheniqs_env.yaml -p /home/runner/conda_envs/pheniqs | |
| - name: install latex | |
| run: conda env create -f ./conda_env_files/latex_env.yaml -p /home/runner/conda_envs/latex | |
| - name: Unit Tests | |
| run: | | |
| coverage run --parallel-mode --concurrency=multiprocessing ./mmeds/tests/unit/test.py analysis demultiplex; | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: summary-pdf-output | |
| path: /home/runner/mmeds_server_data/test_files/test_study/Qiime2_0/summary/mkstapylton@gmail.com-mattS-qiime2.pdf | |
| - name: Upload Unit coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| run-tests-simple: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Install packages | |
| run: python -m pip install pip==24.0; sudo apt-get install tidy environment-modules -y; pip install cryptography; pip install coverage; | |
| - name: Set PYTHONPATH | |
| run: echo "PYTHONPATH=." >> $GITHUB_ENV | |
| - name: Start MySQL | |
| run: sudo systemctl start mysql.service; | |
| - name: MySQL Setup | |
| run: mysql -u root -proot < setup.sql | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@1.12.0 | |
| with: | |
| mongodb-version: '6.0' | |
| - name: Server data setup | |
| run: mkdir /home/runner/mmeds_server_data; mkdir /home/runner/conda_envs; mkdir -p /home/runner/conda_env_files/pheniqs; mkdir -p /home/runner/.modules/modulefiles; cp -r ./test_files /home/runner/mmeds_server_data/.; cp ./mmeds/resources/mmeds_stats.yaml /home/runner/mmeds_server_data/.; cp -r ./modules/* /home/runner/.modules/modulefiles/.; cp -r ./conda_env_files/* /home/runner/conda_env_files/.; mkdir /home/runner/mmeds_server_data/taxonomic_databases; touch /home/runner/mmeds_server_data/taxonomic_databases/dummy_classifier.qza; | |
| - name: Python install | |
| run: sudo python setup.py install --verbose; pip install wheel; pip install git+https://github.com/clemente-lab/mmeds-meta@$GITHUB_REF_NAME; | |
| - name: Install GraphViz | |
| run: sudo apt-get install graphviz | |
| - name: install pheniqs | |
| run: conda env create -f ./conda_env_files/pheniqs_env.yaml -p /home/runner/conda_envs/pheniqs | |
| - name: Unit Tests | |
| run: | | |
| coverage run --parallel-mode --concurrency=multiprocessing ./mmeds/tests/unit/test.py adder authentication database documents error formatter tools uploader util validate spawn snakemake; | |
| - name: Upload Unit coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Server Tests | |
| run: | | |
| pytest --cov=mmeds -W ignore::DeprecationWarning -W ignore::FutureWarning -s --durations=0 ./mmeds/tests/watcher/test_watcher.py& | |
| sleep 1; | |
| pytest --cov=mmeds -W ignore::DeprecationWarning -W ignore::FutureWarning -s ./mmeds/tests/server/test_server.py -x --durations=0; | |
| - name: Upload Server Coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Metadata Tests | |
| run: pytest --cov=mmeds -W ignore::DeprecationWarning -W ignore::FutureWarning -s ./mmeds/tests/metadata/test_error_metadata.py; | |
| - name: Load File Action | |
| if: failure() | |
| id: read_file | |
| uses: guibranco/github-file-reader-action-v2@latest | |
| with: | |
| path: "/home/runner/mmeds_server_data/MMEDS_log.txt" | |
| - name: Print MMEDS Logs | |
| if: failure() | |
| run: echo "${{ steps.read_file.outputs.contents }}" |