Skip to content

Commit

Permalink
Merge pull request #1 from jlowin/actions
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
jlowin authored Apr 5, 2024
2 parents 1620a28 + 7534c0d commit da52f2d
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 9 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Run tests

env:
# enable colored output
# https://github.com/pytest-dev/pytest/issues/7443
PY_COLORS: 1

on:
push:
branches: ["main"]
paths:
- .github/workflows/run-tests.yml
- src/**
- tests/**
- pyproject.toml
- setup.py

pull_request:
paths:
- .github/workflows/run-tests.yml
- src**
- tests/**
- pyproject.toml
- setup.py

workflow_dispatch:

permissions:
contents: read

jobs:
run_tests:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
# run no_llm tests across all python versions and oses
# os: [ubuntu-latest, macos-latest, windows-latest]
# python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest]
python-version: ['3.9']


runs-on: ${{ matrix.os }}

env:
CONTROLFLOW_OPENAI_API_KEY: ${{ secrets.CONTROLFLOW_OPENAI_API_KEY }}

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install ControlFlow
run: uv pip install --system ".[tests]"

- name: Run tests
run: pytest -n auto -vv
if: ${{ !(github.event.pull_request.head.repo.fork) }}
31 changes: 31 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run static analysis

env:
# enable colored output
# https://github.com/pytest-dev/pytest/issues/7443
PY_COLORS: 1

on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:

static_analysis:
timeout-minutes: 1

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
30 changes: 21 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ authors = [
{ name = "Jeremiah Lowin", email = "153965+jlowin@users.noreply.github.com" }
]
dependencies = [
"marvin>=2.3.1",
"marvin @ git+https://github.com/prefecthq/marvin@main",
"prefect @ git+https://github.com/prefecthq/prefect@main",
# can remove when prefect fully migrates to pydantic 2
"pydantic>=2",
]
readme = "README.md"
Expand All @@ -17,19 +18,30 @@ keywords = ["ai", "chatbot", "llm", "NLP", "natural language processing", "prefe
[project.urls]
Code = "https://github.com/jlowin/ControlFlow"

[project.optional-dependencies]
tests = [
"pytest-asyncio>=0.18.2,!=0.22.0,<0.23.0",
"pytest-env>=0.8,<2.0",
"pytest-rerunfailures>=10,<14",
"pytest-sugar>=0.9,<2.0",
"pytest>=8.1.1",
"pytest-timeout",
"pytest-xdist",
"pre-commit>=3.7.0",
]
dev = [
"control_flow[tests]",
"ipython>=8.22.2",
"pdbpp>=0.10.3",
"ruff>=0.3.4",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
"ipython>=8.22.2",
"pdbpp>=0.10.3",
"pre-commit>=3.7.0",
"ruff>=0.3.4",
"pytest>=8.1.1",
]
managed = true

[tool.hatch.metadata]
allow-direct-references = true
Expand Down

0 comments on commit da52f2d

Please sign in to comment.