Skip to content

Correct python version with quotes and remove tag requirement for deploy #6

Correct python version with quotes and remove tag requirement for deploy

Correct python version with quotes and remove tag requirement for deploy #6

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: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- 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
- name: Tests
run: poetry run pytest
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- 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
- name: Install Poetry
uses: snok/install-poetry@v1
- 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 }}