Skip to content

Commit

Permalink
Add CI and fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Milk committed Nov 28, 2023
1 parent 4078749 commit 8f785be
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI

on:
push:
paths:
- '.github/**'
- 'lazyslide/**'
- 'tests/**'
- 'pyproject.toml'
pull_request:
paths:
- '.github/**'
- 'lazyslide/**'
- 'tests/**'
- 'pyproject.toml'

jobs:
Test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest tests/
# Upload_to_test_pypi:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install flit
# pip install .

# - name: Publish to test.ipynb pypi
# env:
# FLIT_INDEX_URL: https://test.ipynb.pypi.org/legacy/
# FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }}
# FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: flit publish || exit 0
#
# - name: Publish to pypi
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# env:
# FLIT_INDEX_URL: https://upload.pypi.org/legacy/
# FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }}
# FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: flit publish
10 changes: 10 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Lint with Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
with:
src: "./lazyslide"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Ruff cache
.ruff_cache/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
2 changes: 1 addition & 1 deletion lazyslide/readers/vips.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

try:
import pyvips as vips
except Exception as e:
except Exception as _:
pass

VIPS_FORMAT_TO_DTYPE = {
Expand Down
2 changes: 1 addition & 1 deletion lazyslide/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_reader(reader="auto") -> Type[ReaderBase]:
try:
import pyvips as vips
pyvips_avail = True
except (ModuleNotFoundError, OSError) as e:
except (ModuleNotFoundError, OSError) as _:
pass

if pyvips_avail:
Expand Down

0 comments on commit 8f785be

Please sign in to comment.