Feat/longform #127
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pytest | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- '**.py' # Python files | |
- 'tests/**' # Test directory | |
- 'requirements.txt' # Dependencies | |
- 'setup.py' # Package setup | |
- '.github/workflows/**' # Workflow files | |
- 'pyproject.toml' # Python project config | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- '**.py' | |
- 'tests/**' | |
- 'requirements.txt' | |
- 'setup.py' | |
- '.github/workflows/**' | |
- 'pyproject.toml' | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: ubuntu:24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up environment | |
run: | | |
set -e | |
apt-get update | |
DEBIAN_FRONTEND=noninteractive apt-get install -y python3-full python3-pip python3-venv ffmpeg | |
- name: Cache virtual environment | |
uses: actions/cache@v3 | |
with: | |
path: /opt/venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-venv- | |
- name: Set up Python virtual environment | |
run: | | |
set -e | |
python3 -m venv /opt/venv | |
. /opt/venv/bin/activate | |
python3 -m pip install --upgrade pip | |
- name: Install dependencies | |
run: | | |
set -e | |
. /opt/venv/bin/activate | |
pip install flake8 pytest pytest-xdist | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Check versions and list packages | |
run: | | |
set -e | |
. /opt/venv/bin/activate | |
echo "Ubuntu version:" | |
cat /etc/os-release | |
echo "FFmpeg version:" | |
ffmpeg -version | |
echo "Python version:" | |
python3 --version | |
echo "Pip version:" | |
pip --version | |
echo "Installed packages:" | |
pip list | |
- name: Lint with flake8 | |
run: | | |
set -e | |
. /opt/venv/bin/activate | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
env: | |
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
set -e | |
. /opt/venv/bin/activate | |
pytest -n auto --dist loadfile | |
- name: Upload test artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: path/to/test/artifacts | |
if: always() |