Skip to content

[python] Initial work toward PyTorch data loaders #12

[python] Initial work toward PyTorch data loaders

[python] Initial work toward PyTorch data loaders #12

name: python-tiledbsoma-ml
on:
pull_request:
branches: ["*"]
paths:
- "!**"
- "other_packages/python/tiledbsoma_ml/**"
- ".github/workflows/python-tiledbsoma-ml.yml"
push:
branches: [main]
paths:
- "!**"
- "other_packages/python/tiledbsoma_ml/**"
- ".github/workflows/python-tiledbsoma-ml.yml"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Restore pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip -v install pre-commit
- name: Run pre-commit hooks on all files
run: pre-commit run -v -a
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: python-spec/requirements-py${{ matrix.python-version }}.txt
- name: Install prereqs
working-directory: ./other_packages/python/tiledbsoma_ml/
run: |
pip install --upgrade pip wheel pytest pytest-cov setuptools
pip install .
- name: Run tests
run: |
PYTHONPATH=$(pwd)/other_packages/python/tiledbsoma_ml python -m pytest \
--cov=other_packages/python/tiledbsoma_ml/src \
--cov-report=xml other_packages/python/tiledbsoma_ml/tests \
-v
- name: Report coverage to Codecov
if: ${{ matrix.python-version == '3.11' }}
uses: codecov/codecov-action@v4
with:
flags: python
# Although Codecov isn't supposed to require an auth token for public repos like this one,
# the uploader can be unreliable without one; see
# https://github.com/codecov/codecov-action/issues/557#issuecomment-1216749652
# As of this writing (8 Nov 2022) the CODECOV_TOKEN was generated by @aaronwolen in his
# Codecov settings page for this repo, then filled into the GitHub Actions secrets.
token: ${{ secrets.CODECOV_TOKEN }}
build:
# for now, just do a test build to ensure that it works
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Do build
working-directory: ./other_packages/python/tiledbsoma_ml/
run: |
pip install --upgrade build pip wheel setuptools setuptools-scm
python -m build .