Skip to content

Tests

Tests #1115

Workflow file for this run

name: Tests
on:
push:
branches:
- '!test_branch'
- '!documentation'
schedule: # once a day at midnight UTC
- cron: '0 0 * * *'
workflow_dispatch: # Manually trigger with 'Run workflow' button
concurrency: # Replace Cancel Workflow Action
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run-tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
OS: ubuntu-latest
PYTHON: '3.9'
UCSF_BOX_TOKEN: ${{ secrets.UCSF_BOX_TOKEN }} # for download and testing
UCSF_BOX_USER: ${{ secrets.UCSF_BOX_USER }}
services:
mysql:
image: datajoint/mysql:8.0
env: # args: mysql -h 127.0.0.1 -P 3308 -uroot -ptutorial -e "CMD;"
MYSQL_DATABASE: localhost
MYSQL_ROOT_PASSWORD: tutorial
ports:
- 3308:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON }}
- name: Set up conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: spyglass
environment-file: environment.yml
miniforge-version: latest
use-mamba: true
- name: Install apt dependencies
run: |
sudo apt-get update # First mysql options
sudo apt-get install mysql-client libmysqlclient-dev libgirepository1.0-dev -y
sudo apt-get install ffmpeg libsm6 libxext6 -y # non-dlc position deps
- name: Run pip install for test deps
run: |
pip install --quiet .[test]
- name: Download data
env:
BASEURL: ftps://ftp.box.com/trodes_to_nwb_test_data/
NWBFILE: minirec20230622.nwb # Relative to Base URL
VID_ONE: 20230622_sample_01_a1/20230622_sample_01_a1.1.h264
VID_TWO: 20230622_sample_02_a1/20230622_sample_02_a1.1.h264
RAW_DIR: /home/runner/work/spyglass/spyglass/tests/_data/raw/
VID_DIR: /home/runner/work/spyglass/spyglass/tests/_data/video/
run: |
mkdir -p $RAW_DIR $VID_DIR
wget_opts() { # Declare func with download options
wget \
--recursive --no-verbose --no-host-directories --no-directories \
--user "$UCSF_BOX_USER" --password "$UCSF_BOX_TOKEN" \
-P "$1" "$BASEURL""$2"
}
wget_opts $RAW_DIR $NWBFILE
wget_opts $VID_DIR $VID_ONE
wget_opts $VID_DIR $VID_TWO
- name: Run tests
run: |
pytest --no-docker --no-dlc