From 2cf710ae540c78b03be68c61be64c7a4d94ce4e1 Mon Sep 17 00:00:00 2001 From: lucas-aixplain Date: Tue, 1 Apr 2025 19:22:45 -0300 Subject: [PATCH 1/5] Update test and main workflows to run iunit tests --- .github/workflows/main.yaml | 3 + .github/workflows/test.yaml | 213 ++---------------------------------- 2 files changed, 11 insertions(+), 205 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b051f40c..3d95180d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -34,6 +34,9 @@ jobs: echo "MODELS_RUN_URL=https://models.aixplain.com/api/v1/execute" >> $GITHUB_ENV echo "PIPELINES_RUN_URL=https://platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV + - name: Run unit + run: python -m pytest tests/unit + - name: Run general_assets run: python -m pytest tests/functional/general_assets diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 62103a6e..18ff418c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -10,8 +10,9 @@ on: workflow_dispatch: jobs: - test-general-assets: + test: runs-on: ubuntu-latest + continue-on-error: true steps: - name: Checkout repository uses: actions/checkout@v4 @@ -26,237 +27,39 @@ jobs: python -m pip install --upgrade pip pip install . pip install pytest - - name: Set environment variables run: | echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV + echo "BACKEND_URL=https://test-platform-api.aixplain.com" >> $GITHUB_ENV echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV + - name: Run units + run: python -m pytest tests/unit + - name: Run general_assets run: python -m pytest tests/functional/general_assets - test-file-asset: - runs-on: ubuntu-latest - needs: test-general-assets - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run File Asset run: python -m pytest tests/functional/file_asset - test-agent: - runs-on: ubuntu-latest - needs: test-file-asset - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run Agent run: python -m pytest tests/functional/agent - test-team-agent: - runs-on: ubuntu-latest - needs: test-agent - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run Team Agent run: python -m pytest tests/functional/team_agent - test-data-asset: - runs-on: ubuntu-latest - needs: test-team-agent - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run Data run: python -m pytest tests/functional/data_asset - test-benchmark: - runs-on: ubuntu-latest - needs: test-data-asset - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - - name: Run Benchmark + - name: Run Becnhmark run: python -m pytest tests/functional/benchmark - test-pipelines: - runs-on: ubuntu-latest - needs: test-benchmark - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run Pipelines run: python -m pytest tests/functional/pipelines - test-api-key: - runs-on: ubuntu-latest - needs: test-pipelines - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run Api Key run: python -m pytest tests/functional/apikey - test-finetuner: - runs-on: ubuntu-latest - needs: test-api-key - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - pip install pytest - - - name: Set environment variables - run: | - echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV - echo "BACKEND_URL=https://test-platform-api.aixplain.com/" >> $GITHUB_ENV - echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV - echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run Finetuner - run: python -m pytest tests/functional/finetune + run: python -m pytest tests/functional/finetune \ No newline at end of file From 63d48642a7d6f158259ac9877969dd85b6392c66 Mon Sep 17 00:00:00 2001 From: lucas-aixplain Date: Tue, 1 Apr 2025 19:31:40 -0300 Subject: [PATCH 2/5] Update to install all test packages listed in pyproject.toml --- .github/workflows/main.yaml | 3 +-- .github/workflows/test.yaml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3d95180d..e7acf774 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -25,8 +25,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . - pip install pytest + pip install ".[test]" - name: Set environment variables run: | echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY_PROD }}" >> $GITHUB_ENV diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 18ff418c..ffeacb18 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,8 +25,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . - pip install pytest + pip install ".[test]" + - name: Set environment variables run: | echo "TEAM_API_KEY=${{ secrets.TEAM_API_KEY }}" >> $GITHUB_ENV From e9aa2f9ff4bbc4ec4eb239087703d7f3d08421e3 Mon Sep 17 00:00:00 2001 From: lucas-aixplain Date: Tue, 1 Apr 2025 19:34:56 -0300 Subject: [PATCH 3/5] Add pytest-mock to list of test dependencies --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a59e0e15..971f15d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,5 +69,6 @@ model-builder = [ test = [ "pytest>=6.1.0", "docker>=6.1.3", - "requests-mock>=1.11.0" + "requests-mock>=1.11.0", + "pytest-mock>=3.10.0" ] From 3e2869ea501610f9e3e302f26412cb4a83e7c220 Mon Sep 17 00:00:00 2001 From: lucas-aixplain Date: Tue, 1 Apr 2025 19:37:08 -0300 Subject: [PATCH 4/5] Update workflow names --- .github/workflows/main.yaml | 2 +- .github/workflows/test.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e7acf774..29b38452 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,4 +1,4 @@ -name: Run Tests +name: Run Tests on Production Environment on: push: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ffeacb18..12adb8c8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: Run Tests +name: Run Tests on Test Environment on: push: From c83aaa15b4215cc50d0470c47eb66039206a12d7 Mon Sep 17 00:00:00 2001 From: lucas-aixplain Date: Tue, 1 Apr 2025 19:46:52 -0300 Subject: [PATCH 5/5] Add continue on error to each test and fix typos --- .github/workflows/main.yaml | 16 +++++++++++++--- .github/workflows/test.yaml | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 29b38452..3dcd6ee0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -33,32 +33,42 @@ jobs: echo "MODELS_RUN_URL=https://models.aixplain.com/api/v1/execute" >> $GITHUB_ENV echo "PIPELINES_RUN_URL=https://platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run unit + - name: Run Unit Tests + continue-on-error: true run: python -m pytest tests/unit - - name: Run general_assets + - name: Run General Assets + continue-on-error: true run: python -m pytest tests/functional/general_assets - name: Run File Asset + continue-on-error: true run: python -m pytest tests/functional/file_asset - name: Run Agent + continue-on-error: true run: python -m pytest tests/functional/agent - name: Run Team Agent + continue-on-error: true run: python -m pytest tests/functional/team_agent - name: Run Data + continue-on-error: true run: python -m pytest tests/functional/data_asset - - name: Run Becnhmark + - name: Run Benchmark + continue-on-error: true run: python -m pytest tests/functional/benchmark - name: Run Pipelines + continue-on-error: true run: python -m pytest tests/functional/pipelines - name: Run Api Key + continue-on-error: true run: python -m pytest tests/functional/apikey - name: Run Finetuner + continue-on-error: true run: python -m pytest tests/functional/finetune diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 12adb8c8..2e5b8614 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -34,32 +34,42 @@ jobs: echo "MODELS_RUN_URL=https://test-models.aixplain.com/api/v1/execute" >> $GITHUB_ENV echo "PIPELINES_RUN_URL=https://test-platform-api.aixplain.com/assets/pipeline/execution/run" >> $GITHUB_ENV - - name: Run units + - name: Run Unit Tests + continue-on-error: true run: python -m pytest tests/unit - - name: Run general_assets + - name: Run General Assets + continue-on-error: true run: python -m pytest tests/functional/general_assets - name: Run File Asset + continue-on-error: true run: python -m pytest tests/functional/file_asset - name: Run Agent + continue-on-error: true run: python -m pytest tests/functional/agent - name: Run Team Agent + continue-on-error: true run: python -m pytest tests/functional/team_agent - name: Run Data + continue-on-error: true run: python -m pytest tests/functional/data_asset - - name: Run Becnhmark + - name: Run Benchmark + continue-on-error: true run: python -m pytest tests/functional/benchmark - name: Run Pipelines + continue-on-error: true run: python -m pytest tests/functional/pipelines - name: Run Api Key + continue-on-error: true run: python -m pytest tests/functional/apikey - name: Run Finetuner + continue-on-error: true run: python -m pytest tests/functional/finetune \ No newline at end of file