Просмотр исходного кода

ci: refine job matrix and enable cache for poetry (#1381)

* ci: refine job matrix and enable cache for poetry

- Replace direct installation of Poetry with pipx to ensure isolated environment setups.
- Enable caching for Poetry dependencies using setup-python action to improve build efficiency.
- Refactor the job matrix specifications.

* ci: enable Homebrew caching in Actions

* ci: optimize Docker and Colima installation in GitHub Actions

- Check if Docker and Colima are already installed before attempting to install them. Link and start each service appropriately to avoid unnecessary reinstallation and ensure they are ready for immediate use in the CI pipeline.

* ci: remove Homebrew cache.

* fix typo

* fix: specified the Python version to avoid errors in actions.

---------

Co-authored-by: Robert Brennan <accounts@rbren.io>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
Arno.Edwards 1 год назад
Родитель
Сommit
03ecec1e76

+ 1 - 0
.github/workflows/lint.yml

@@ -37,6 +37,7 @@ jobs:
         uses: actions/setup-python@v5
         with:
           python-version: 3.11
+          cache: 'pip'
       - name: Install pre-commit
         run: pip install pre-commit==3.7.0
       - name: Run pre-commit hooks

+ 25 - 47
.github/workflows/run-integration-tests.yml

@@ -11,64 +11,42 @@ jobs:
     name: Integration Tests
     runs-on: ubuntu-latest
     strategy:
+      fail-fast: false
       matrix:
+        python-version: ["3.11"]
+        agent: ["SWEAgent", "PlannerAgent", "MonologueAgent", "CodeActAgent"]
+        sandbox: ["ssh", "exec"]
         include:
-          - name: SWEAgent-py311-ssh
-            python-version: "3.11"
-            agent: "SWEAgent"
-            embedding-model: "none"
-            sandbox: "ssh"
-          - name: PlannerAgent-py311-ssh
-            python-version: "3.11"
-            agent: "PlannerAgent"
-            embedding-model: "none"
-            sandbox: "ssh"
-          - name: MonologueAgent-py311-ssh
-            python-version: "3.11"
-            agent: "MonologueAgent"
+          - agent: "MonologueAgent"
             embedding-model: "local"
-            sandbox: "ssh"
-          - name: CodeActAgent-py311-ssh
-            python-version: "3.11"
-            agent: "CodeActAgent"
-            embedding-model: "none"
-            sandbox: "ssh"
-          - name: SWEAgent-py311-exec
-            python-version: "3.11"
-            agent: "SWEAgent"
+          - agent: "MonologueAgent"
+            # sufficient to have one agent testing against local sandbox
+            sandbox: "local"
+            embedding-model: "local"
+          - agent: "SWEAgent"
             embedding-model: "none"
-            sandbox: "exec"
-          - name: PlannerAgent-py311-exec
-            python-version: "3.11"
-            agent: "PlannerAgent"
+          - agent: "PlannerAgent"
             embedding-model: "none"
-            sandbox: "exec"
-          - name: MonologueAgent-py311-exec
-            python-version: "3.11"
-            agent: "MonologueAgent"
-            embedding-model: "local"
-            sandbox: "exec"
-          - name: CodeActAgent-py311-exec
-            python-version: "3.11"
-            agent: "CodeActAgent"
+          - agent: "CodeActAgent"
             embedding-model: "none"
-            sandbox: "exec"
-          - name: MonologueAgent-py311-local
-            python-version: "3.11"
-            agent: "MonologueAgent"
-            embedding-model: "local"
-            # sufficient to have one agent testing against local sandbox
-            sandbox: "local"
     steps:
       - uses: actions/checkout@v4
-      - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v2
+
+      - name: Install poetry via pipx
+        run: pipx install poetry
+
+      - name: Set up Python
+        uses: actions/setup-python@v5
         with:
-          python-version: ${{ matrix.python-version }}
-      - name: Install Poetry
-        run: curl -sSL https://install.python-poetry.org | python3 -
+          python-version: '3.11'
+          cache: 'poetry'
+
+      - name: Install Python dependencies using Poetry
+        run: poetry install
+
       - name: Build Environment
         run: make build
+
       - name: Run Integration Tests
         env:
           SANDBOX_TYPE: ${{ matrix.sandbox }}

+ 24 - 9
.github/workflows/run-unit-tests.yml

@@ -16,20 +16,27 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
+
+      - name: Install poetry via pipx
+        run: pipx install poetry
+
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python-version }}
+          cache: 'poetry'
+
+      - name: Install Python dependencies using Poetry
+        run: poetry install
+
       - name: Install & Start Docker
         run: |
           brew install colima docker
           colima start
-      - name: Install and configure Poetry
-        uses: snok/install-poetry@v1
-        with:
-          version: latest
+
       - name: Build Environment
         run: make build
+
       - name: Run Tests
         run: poetry run pytest ./tests/unit
   test-on-linux:
@@ -41,14 +48,22 @@ jobs:
 
     steps:
       - uses: actions/checkout@v4
-      - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v2
+
+      - name: Install poetry via pipx
+        run: pipx install poetry
+
+      - name: Set up Python
+        uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python-version }}
-      - name: Install Poetry
-        run: curl -sSL https://install.python-poetry.org | python3 -
+          cache: 'poetry'
+
+      - name: Install Python dependencies using Poetry
+        run: poetry install --without evaluation
+
       - name: Build Environment
         run: make build
+
       - name: Run Tests
         run: poetry run pytest ./tests/unit