Sc 55 linting (#180) #100
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: Run tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
#pull_request: | |
# branches: | |
# - main | |
paths: | |
- "src/sparrow/**" | |
- ".github/workflows/run_tests.yml" | |
env: | |
CACHE_NUMBER: 1 # increase to reset cache manually | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] #[ubuntu-latest, macos-latest] | |
python-version: ["3.10"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
# these libraries enable testing on Qt on linux | |
- uses: tlambert03/setup-qt-libs@v1 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: napari-sparrow | |
use-mamba: true | |
python-version: ${{ matrix.python-version }} | |
- name: Set cache environment variables | |
shell: bash -l {0} | |
run: | | |
CONDA_PREFIX=$(python -c "import sys; print(sys.prefix)") | |
echo "$CONDA_PREFIX" | |
echo "CONDA_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV | |
#- name: Set cache date | |
# run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA_PREFIX }} | |
key: conda-env-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: mamba env update -n napari-sparrow -f environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
# this runs the platform-specific tests declared in tox.ini | |
- name: Test with tox | |
shell: bash -l {0} | |
run: | | |
conda activate napari-sparrow | |
pip install -e '.[testing]' | |
pip install tox tox-gh-actions | |
tox | |
env: | |
PLATFORM: ${{ matrix.os }} | |
- name: Upload coverage.xml | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-report | |
path: coverage.xml |