Skip to content

Commit

Permalink
add GHA workflows for basic CI (PR 4 of N) (#7)
Browse files Browse the repository at this point in the history
* add GHA workflows; remove temp exclusion from pre-commit config

* GHA tweak, attempt to trigger PR runs

---------

Co-authored-by: Ryan Williams <[email protected]>
  • Loading branch information
bkmartinjr and ryan-williams committed Sep 25, 2024
1 parent 30937b0 commit c0f32a1
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 6 deletions.
59 changes: 56 additions & 3 deletions .github/workflows/python-tiledbsoma-ml.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: python-tiledbsoma-ml
name: python-tiledbsoma-ml CI

on:
pull_request:
Expand All @@ -10,7 +10,60 @@ on:
workflow_dispatch:

jobs:
job:
lint:
runs-on: ubuntu-latest
steps:
# Empty job; placeholder GHA
- 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.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

- name: Install prereqs
run: |
pip install --upgrade pip wheel pytest pytest-cov setuptools
pip install .
- name: Run tests
run: pytest -v --cov=src --cov-report=xml tests

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
run: |
pip install --upgrade build pip wheel setuptools setuptools-scm
python -m build .
46 changes: 46 additions & 0 deletions .github/workflows/python-tilledbsoma-ml-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: python-tiledbsoma-ml past tiledbsoma compat # Latest tiledbsoma version covered by another workflow

on:
pull_request:
branches: ["*"]
paths-ignore:
- "scripts/**"
- "notebooks/**"
push:
branches: [main]
paths-ignore:
- "scripts/**"
- "notebooks/**"

jobs:
unit_tests:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"] # could add 'macos-latest', but the matrix is already huge...
python-version: ["3.9", "3.10", "3.11"] # TODO: add 3.12 when tiledbsoma releases wheels for it.
pkg-version:
- "tiledbsoma~=1.9.0 'numpy<2.0.0'"
- "tiledbsoma~=1.10.0 'numpy<2.0.0'"
- "tiledbsoma~=1.11.0"
- "tiledbsoma~=1.12.0"
- "tiledbsoma~=1.13.0"
- "tiledbsoma~=1.14.0"

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install prereqs
run: |
pip install --upgrade pip pytest setuptools
pip install ${{ matrix.pkg-version }} .
- name: Run tests
run: pytest -v tests
3 changes: 0 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ repos:
rev: "24.8.0"
hooks:
- id: black
exclude: 'apis/'

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
hooks:
- id: ruff
name: "ruff for tiledbsoma_ml"
args: ["--config=pyproject.toml"]
exclude: 'apis/'

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
Expand All @@ -23,4 +21,3 @@ repos:
- attrs
- numpy
- pandas-stubs>=2
exclude: 'apis/'

0 comments on commit c0f32a1

Please sign in to comment.