try to add ci

This commit is contained in:
Mery-Sanz 2025-04-11 10:06:25 +02:00
parent 00a50a03ae
commit ed73fe1a08
3 changed files with 66 additions and 2 deletions

35
.gitlab-ci.yml Normal file
View File

@ -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

29
ci/test/.test.yml Normal file
View File

@ -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

View File

@ -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