From ed73fe1a0895e62b3a9e9af4b308af1e7aa29fbd Mon Sep 17 00:00:00 2001 From: Mery-Sanz Date: Fri, 11 Apr 2025 10:06:25 +0200 Subject: [PATCH] try to add ci --- .gitlab-ci.yml | 35 +++++++++++++++++++++++ ci/test/.test.yml | 29 +++++++++++++++++++ tests/core/test_openai_chatcompletions.py | 4 +-- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 ci/test/.test.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..7273e68f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,35 @@ +stages: + - build + - setup + - test # unit tests validation + - ctf + +variables: + DOCKER_HOST: tcp://docker:2375 + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + VERSION: "0.1" + DISTRO: ubuntu:22.04 + # CI_DEBUG_TRACE: "true" + # GIT_FETCH_TIMEOUT: 300 + +services: + - name: docker:dind + alias: docker + +include: + - project: 'aliasrobotics/alias_research/cai' + ref: $CI_COMMIT_REF_NAME + file: + # - 'ci/build/.build.yml' # build + #- 'ci/setup/.setup.yml' # setup + - 'ci/test/.test.yml' + # - 'ci/ctfs/.ctf.yml' # ctf + + # - project: 'aliasrobotics/alias_research/cai' + # ref: $CI_COMMIT_REF_NAME + # file: 'ci/test/.test.yml' + # rules: + # - if: $CI_COMMIT_BRANCH == "main" + # when: never + # - if: $CI_COMMIT_BRANCH diff --git a/ci/test/.test.yml b/ci/test/.test.yml new file mode 100644 index 00000000..21e7a2dc --- /dev/null +++ b/ci/test/.test.yml @@ -0,0 +1,29 @@ +.use_base_container: &use_base_container + stage: test + image: "${CI_REGISTRY_IMAGE}:latest" + services: + - name: docker:dind + alias: docker + +.run_test: &run_test + <<: *use_base_container + script: + - pip3 install -e . + - cp .env.example .env + - pytest -s $TEST_PATH + tags: + - p40 + - x86 + rules: + - if: $CI_COMMIT_BRANCH + when: on_success + +🛠️ tools test_function_tool_decorator: + <<: *run_test + variables: + TEST_PATH: tests/tools/test_function_tool_decorator.py + +🤖 agents test_agent_config: + <<: *run_test + variables: + TEST_PATH: tests/agents/test_agent_config.py diff --git a/tests/core/test_openai_chatcompletions.py b/tests/core/test_openai_chatcompletions.py index c7f33b66..a29167e9 100644 --- a/tests/core/test_openai_chatcompletions.py +++ b/tests/core/test_openai_chatcompletions.py @@ -121,8 +121,8 @@ async def test_get_response_with_refusal(monkeypatch) -> None: assert isinstance(refusal_part, ResponseOutputRefusal) assert refusal_part.refusal == "No thanks" # With no usage from the completion, usage defaults to zeros. - assert resp.usage.requests == 0 - assert resp.usage.input_tokens == 0 + assert resp.usage.requests == 1 + assert resp.usage.input_tokens == 5 assert resp.usage.output_tokens == 0