Skip to content

Bacpop-192 multi-species #471

Bacpop-192 multi-species

Bacpop-192 multi-species #471

Workflow file for this run

# 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 ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
with:
path: main
- name: Restore GPS database from cache
uses: actions/cache@v2
with:
path: /home/runner/work/beebop_py/beebop_py/main/storage/GPS_v8_ref
key: cache-gps-v8-db
id: cache-db
- name: Download and extract GPS database
working-directory: ./main
run: |
./scripts/download_db
- 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 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