Skip to content

Accept image input

Accept image input #45

name: Lint / Test / Publish
on:
push:
branches: ["main"]
# We only deploy on tags and main branch
tags:
# Only run on tags that match the following regex
# This will match tags like 1.0.0, 1.0.1, etc.
- "[0-9]+.[0-9]+.[0-9]+"
# Lint and test on pull requests
pull_request:
jobs:
lint_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
# Set python version to 3.12
- name: set python version
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Install Build stuff
- name: Install Dependencies
run: |
pip install poetry \
&& poetry config virtualenvs.create false \
&& poetry install
# Ruff
- name: Ruff check
run: |
poetry run ruff check shuttleai
# Black
- name: Black check
run: |
poetry run black shuttleai --check
# # Mypy (disabled for now)
# - name: Mypy Check
# run: |
# poetry run mypy shuttleai
publish:
if: startsWith(github.ref, 'refs/tags') # || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: lint_and_test
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
# Set python version to 3.12
- name: set python version
uses: actions/setup-python@v4
with:
python-version: 3.12
# Install Build stuff
- name: Install Dependencies
run: |
pip install poetry \
&& poetry config virtualenvs.create false \
&& poetry install
# build package using poetry
- name: Build Package
run: |
poetry build
# Publish to PyPi
- name: Pypi publish
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish