Minimal and Full Tests #1347
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
name: Minimal and Full Tests | |
on: | |
schedule: | |
- cron: "0 16 * * *" # Daily at noon EST | |
workflow_call: | |
secrets: | |
AWS_ACCESS_KEY_ID: | |
required: true | |
AWS_SECRET_ACCESS_KEY: | |
required: true | |
S3_GIN_BUCKET: | |
required: true | |
workflow_dispatch: | |
jobs: | |
run: | |
name: ${{ matrix.os }} Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: s-weigand/setup-conda@v1 | |
- uses: actions/checkout@v3 | |
- run: git fetch --prune --unshallow --tags | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Global Setup | |
run: | | |
python -m pip install -U pip # Official recommended way | |
pip install pytest-xdist | |
git config --global user.email "CI@example.com" | |
git config --global user.name "CI Almighty" | |
pip install wheel # Needed for scan image | |
- name: Install neuroconv with minimal requirements | |
run: pip install .[test] | |
- name: Run import tests | |
run: | | |
pytest tests/imports.py::TestImportStructure::test_top_level | |
pytest tests/imports.py::TestImportStructure::test_tools | |
pytest tests/imports.py::TestImportStructure::test_datainterfaces | |
- name: Run minimal tests | |
run: pytest tests/test_minimal -rsx -n auto --dist loadscope | |
- name: Install with ecephys requirements | |
run: pip install .[ecephys] | |
- name: Run ecephys tests | |
run: pytest tests/test_ecephys -rsx -n auto --dist loadscope | |
- name: Install with ophys requirements | |
run: pip install .[ophys] | |
- name: Run ophys tests | |
run: pytest tests/test_ophys -rsx -n auto --dist loadscope | |
- name: Install with behavior requirements | |
run: pip install .[behavior] | |
- name: Run behavior tests | |
run: pytest tests/test_behavior -rsx -n auto --dist loadscope | |
- name: Install with icephys requirements | |
run: pip install .[icephys] | |
#- name: Run icephys tests # There are no icephys specific tests without data | |
# run: pytest tests/test_icephys -rsx -n auto --dist loadscope | |
- name: Install full requirements (-e needed for codecov report) | |
run: pip install -e .[full] | |
- name: Get ephy_testing_data current head hash | |
id: ephys | |
run: echo "::set-output name=HASH_EPHY_DATASET::$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" | |
- name: Cache ephys dataset - ${{ steps.ephys.outputs.HASH_EPHY_DATASET }} | |
uses: actions/cache@v3 | |
id: cache-ephys-datasets | |
with: | |
path: ./ephy_testing_data | |
key: ephys-datasets-2023-06-26-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }} | |
- name: Get ophys_testing_data current head hash | |
id: ophys | |
run: echo "::set-output name=HASH_OPHYS_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/ophys_testing_data.git HEAD | cut -f1)" | |
- name: Cache ophys dataset - ${{ steps.ophys.outputs.HASH_OPHYS_DATASET }} | |
uses: actions/cache@v3 | |
id: cache-ophys-datasets | |
with: | |
path: ./ophys_testing_data | |
key: ophys-datasets-2022-08-18-${{ matrix.os }}-${{ steps.ophys.outputs.HASH_OPHYS_DATASET }} | |
- name: Get behavior_testing_data current head hash | |
id: behavior | |
run: echo "::set-output name=HASH_BEHAVIOR_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/behavior_testing_data.git HEAD | cut -f1)" | |
- name: Cache behavior dataset - ${{ steps.behavior.outputs.HASH_BEHAVIOR_DATASET }} | |
uses: actions/cache@v3 | |
id: cache-behavior-datasets | |
with: | |
path: ./behavior_testing_data | |
key: behavior-datasets-2023-07-26-${{ matrix.os }}-${{ steps.behavior.outputs.HASH_behavior_DATASET }} | |
- if: steps.cache-ephys-datasets.outputs.cache-hit != 'true' || steps.cache-ophys-datasets.outputs.cache-hit != 'true' || steps.cache-behavior-datasets.outputs.cache-hit != 'true' | |
name: Install and configure AWS CLI | |
run: | | |
pip install awscli | |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- if: steps.cache-ephys-datasets.outputs.cache-hit != 'true' | |
name: Download ephys dataset from S3 | |
run: aws s3 cp --recursive ${{ secrets.S3_GIN_BUCKET }}/ephy_testing_data ./ephy_testing_data | |
- if: steps.cache-ophys-datasets.outputs.cache-hit != 'true' | |
name: Download ophys dataset from S3 | |
run: aws s3 cp --recursive ${{ secrets.S3_GIN_BUCKET }}/ophys_testing_data ./ophys_testing_data | |
- if: steps.cache-behavior-datasets.outputs.cache-hit != 'true' | |
name: Download behavior dataset from S3 | |
run: aws s3 cp --recursive ${{ secrets.S3_GIN_BUCKET }}/behavior_testing_data ./behavior_testing_data | |
- name: Run full pytest with coverage | |
run: pytest -rsx -n auto --dist loadscope --cov=./ --cov-report xml:./codecov.xml | |
- name: Upload full coverage to Codecov | |
if: ${{ matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./codecov.xml | |
flags: unittests | |
name: codecov-umbrella | |
yml: ./codecov.yml |