Skip to content

Update deps (#2)

Update deps (#2) #12

Workflow file for this run

name: CI
on:
push:
branches:
- main
- releases/*
tags:
- "v*.*.*"
pull_request:
branches:
- main
- releases/*
workflow_dispatch:
env:
PYTORCH_VERSION: "2.7"
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg libsm6 libxext6 libfontconfig1 libxrender1
# Install audio libraries for pydub
sudo apt-get install -y libavcodec-extra
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install ffmpeg
pip3 install torch torchvision torchaudio
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
# Install ffmpeg using chocolatey
choco install -y ffmpeg
# Add ffmpeg to PATH
echo "C:\ProgramData\chocolatey\lib\ffmpeg\tools\ffmpeg\bin" >> $GITHUB_PATH
# Install wget
choco install -y wget
pip3 install torch torchvision torchaudio
- name: Upgrade pip and dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[dev]
- name: Lint with flake8
run: |
flake8 src/ tests/
- name: Format code with black
run: |
black --check src/ tests/
# Will implement type checking later
# - name: Run type checks with mypy
# run: |
# mypy --install-types --non-interactive --ignore-missing-imports
# mypy src/
- name: Run tests
run: |
pytest --cov=captionalchemy -v
publish:
needs: build_and_test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/project/captionalchemy
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Build distributions
run: |
python -m pip install --upgrade pip build
python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1