Skip to content

refactor: Update pyproject.toml moving geopandas to global dependenci… #48

refactor: Update pyproject.toml moving geopandas to global dependenci…

refactor: Update pyproject.toml moving geopandas to global dependenci… #48

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches: [master]
tags:
- v*
pull_request:
branches: [master, dev]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Check commit type
if: '!contains(github.ref, ''tags'')'
id: check-type
run: |
COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.event.after }})
COMMIT_TYPE=$(echo $COMMIT_MSG | cut -d' ' -f1 | tr -d ':')
echo "Commit type is '$COMMIT_TYPE'"
echo "type=$COMMIT_TYPE" >> "$GITHUB_OUTPUT"
- name: Check if tests should be skipped
if: '!contains(github.ref, ''tags'')'
id: check-skip
run: |
COMMIT_TYPE=${{ steps.check-type.outputs.type }}
SKIP_TYPES=("docs" "refactor" "style" "chore")
if [[ " ${SKIP_TYPES[@]} " =~ " ${COMMIT_TYPE} " ]]; then
echo "Skipping tests..."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "Running tests..."
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up Python ${{ matrix.python-version }}
if: steps.check-skip.outputs.skip != 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Openslide global dependencies
if: steps.check-skip.outputs.skip != 'true'
run: |
sudo apt update
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
- name: Print Version Information
if: steps.check-skip.outputs.skip != 'true'
run: python -c "import sys; print(sys.version)"
- name: Load cached venv if cache exists
if: steps.check-skip.outputs.skip != 'true'
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
if: steps.check-skip.outputs.skip != 'true'
uses: snok/install-poetry@v1
- name: Install dependencies if cache does not exist
if: steps.check-skip.outputs.skip != 'true' && steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --extras "emb"
- name: Tests
if: steps.check-skip.outputs.skip != 'true'
run: poetry run pytest
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Openslide global dependencies
run: |
sudo apt update
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
- name: Print Version Information
run: python -c "import sys; print(sys.version)"
- name: Load cached venv if cache exists
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies if cache does not exist
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --extras "emb"
- name: Deploy doc
run: poetry run mkdocs gh-deploy --force
publish:
needs: [build]
if: contains(github.ref, 'tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
python_version: "3.10"
pypi_token: ${{ secrets.PYPI_TOKEN }}