Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI Test

on:
pull_request:
types:
- opened
- synchronize

jobs:
test-rust-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Run tests
run: make test

test-python-binding:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
run: pip install uv

- name: Install dependencies
working-directory: bindings/python
run: source start.sh

- name: Run tests
working-directory: bindings/python
run: make test

- name: Install docker-compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

- name: Run integration tests
working-directory: bindings/python
run: |
make test-integration
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ dist/
# Added by cargo

/target
.ruff_cache/
.venv/
30 changes: 4 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
POETRY := poetry
RUFF := .venv/bin/ruff
PYTEST := .venv/bin/pytest

.PHONY: build
build: lint
$(POETRY) build

.PHONY: publish
publish: build
$(POETRY) publish --username=__token__ --password=$(INFTYAI_PYPI_TOKEN)

.PHONY: lint
lint:
$(RUFF) check .
CARGO := cargo

.PHONY: format
format:
$(RUFF) format .
$(RUFF) check --fix .
$(CARGO) fmt

.PHONY: test
test: lint
$(PYTEST) tests/unit --timeout=15

.PHONY: test-integration
test-integration: lint
$(PYTEST) tests/integration --timeout=30
'
.PHONY: test-all
test-all: test test-integration
test: format
$(CARGO) test
31 changes: 31 additions & 0 deletions bindings/python/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
POETRY := poetry
RUFF := .venv/bin/ruff
PYTEST := .venv/bin/pytest

.PHONY: build
build: lint
$(POETRY) build

.PHONY: publish
publish: build
$(POETRY) publish --username=__token__ --password=$(INFTYAI_PYPI_TOKEN)

.PHONY: lint
lint:
$(RUFF) check .

.PHONY: format
format:
$(RUFF) format .
$(RUFF) check --fix .

.PHONY: test
test: lint
$(PYTEST) tests/unit --timeout=15

.PHONY: test-integration
test-integration: lint
$(PYTEST) tests/integration --timeout=30

.PHONY: test-all
test-all: test test-integration
1 change: 1 addition & 0 deletions bindings/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Python Binding for AMRS
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions bindings/python/tests/integration/config_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

def test_fake():
print("This is a fake test to ensure the test suite runs.")
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions bindings/python/tests/unit/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from dotenv import load_dotenv

load_dotenv(dotenv_path="../../.env.test")
File renamed without changes.
3 changes: 3 additions & 0 deletions src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ impl Client {
mod tests {
use super::*;
use crate::config::{Config, ModelConfig, RoutingMode};
use dotenvy::from_filename;

#[test]
fn test_client_new() {
from_filename(".env.test").ok();

struct TestCase {
name: &'static str,
config: Config,
Expand Down
6 changes: 4 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ mod tests {

#[test]
fn test_populate_config() {
from_filename(".env.test").ok();

let mut valid_cfg = Config::builder()
.temperature(0.5)
.max_output_tokens(1500)
Expand All @@ -313,7 +315,7 @@ mod tests {
assert!(valid_cfg.as_ref().unwrap().models[0].weight == -1);

let mut valid_specified_cfg = Config::builder()
.provider("DEEPINFRA".to_string())
.provider("AMRS".to_string())
.base_url("http://custom-api.ai".to_string())
.model(
ModelConfig::builder()
Expand All @@ -325,7 +327,7 @@ mod tests {
valid_specified_cfg.as_mut().unwrap().populate();

assert!(valid_specified_cfg.is_ok());
assert!(valid_specified_cfg.as_ref().unwrap().provider == "DEEPINFRA".to_string());
assert!(valid_specified_cfg.as_ref().unwrap().provider == "AMRS".to_string());
assert!(
valid_specified_cfg.as_ref().unwrap().models[0].base_url
== Some("http://custom-api.ai".to_string())
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/conftest.py

This file was deleted.

Loading