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>
This commit is contained in:
Arno.Edwards 2024-04-29 22:32:25 +08:00 committed by GitHub
parent 8954855ba3
commit 03ecec1e76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 57 deletions

View File

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

View File

@ -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"
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"
embedding-model: "none"
sandbox: "exec"
- name: PlannerAgent-py311-exec
python-version: "3.11"
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"
embedding-model: "none"
sandbox: "exec"
- name: MonologueAgent-py311-local
python-version: "3.11"
agent: "MonologueAgent"
- agent: "MonologueAgent"
embedding-model: "local"
- agent: "MonologueAgent"
# sufficient to have one agent testing against local sandbox
sandbox: "local"
embedding-model: "local"
- agent: "SWEAgent"
embedding-model: "none"
- agent: "PlannerAgent"
embedding-model: "none"
- agent: "CodeActAgent"
embedding-model: "none"
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 }}

View File

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