Bacpop-202 Assign fallback to refs to db #535
This file contains 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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python unit & integration tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main, "bacpop-*" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: main | |
- name: Restore databases from cache | |
uses: actions/cache@v3 | |
with: | |
path: ./main/storage/dbs | |
key: cache-dbs | |
id: cache-dbs | |
- name: Download and extract GPS database | |
working-directory: ./main | |
run: | | |
./scripts/download_databases --refs | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Setup Miniconda | |
uses: conda-incubator/[email protected] | |
with: | |
python-version: 3.9 | |
activate-environment: beebop_py | |
channels: bioconda, conda-forge | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Restore Conda env from cache | |
uses: actions/cache@v2 | |
with: | |
path: /usr/share/miniconda/envs/beebop_py | |
key: | |
# Refresh cache each day | |
conda-${{ runner.os }}--${{ runner.arch }}--${{ | |
steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER}} | |
env: | |
# Increment this value to manually reset cache. | |
CACHE_NUMBER: 0 | |
id: cache-conda | |
# - name: Install poppunk | |
# run: conda install poppunk | |
# currently the latest poppunk release is missing some functions required for beebop. For now installing from source: | |
- name: Get poppunk source code | |
uses: actions/checkout@v3 | |
with: | |
repository: bacpop/PopPUNK | |
ref: fix-json-serialisation | |
path: poppunk | |
- name: install poppunk & dependencies | |
working-directory: ./poppunk | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate beebop_py | |
conda install graph-tool | |
conda install mandrake | |
conda install rapidnj | |
sudo apt-get update | |
sudo apt-get install libeigen3-dev libegl1 | |
sudo apt-get install libopenblas-dev | |
sudo apt-get install -y '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev | |
pip install joblib==1.1.0 | |
conda install -c bioconda pp-sketchlib=2.0.0 | |
pip3 install git+https://github.com/bacpop/[email protected]#egg=PopPUNK | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: false | |
- name: Install dependencies | |
working-directory: ./main | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate beebop_py | |
poetry install | |
- name: Run Redis | |
working-directory: ./main | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate beebop_py | |
docker pull redis | |
docker run --rm -d --name=redis -p 6379:6379 redis | |
- name: Test with pytest | |
env: | |
MICROREACT_TOKEN: ${{ secrets.MICROREACT_TOKEN }} | |
working-directory: ./main | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate beebop_py | |
export PATH="/usr/share/miniconda/bin:$PATH" | |
rq worker > rq_output.txt 2>&1 & | |
STORAGE_LOCATION=./tests/results DBS_LOCATION=./storage/dbs poetry run coverage run -m pytest | |
- name: Process coverage | |
working-directory: ./main | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate beebop_py | |
export PATH="/usr/share/miniconda/bin:$PATH" | |
poetry run coverage report -m && poetry run coverage xml | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
root_dir: ./main | |
# Uncomment the next three lines to debug on failure with | |
# tmate. However, don't leave them uncommented on merge as that | |
# causes failing builds to hang forever. | |
# | |
# - name: tmate session | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 |