mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* 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>
76 lines
1.6 KiB
YAML
76 lines
1.6 KiB
YAML
name: Run Unit Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
test-on-macos:
|
|
name: Test on macOS
|
|
runs-on: macos-13
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.11"]
|
|
|
|
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@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: Build Environment
|
|
run: make build
|
|
|
|
- name: Run Tests
|
|
run: poetry run pytest ./tests/unit
|
|
test-on-linux:
|
|
name: Test on Linux
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.11"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install poetry via pipx
|
|
run: pipx install poetry
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
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
|
|
|
|
test_matrix_success:
|
|
name: All Mac/Linux Tests Passed
|
|
runs-on: ubuntu-latest
|
|
needs: [test-on-macos, test-on-linux]
|
|
steps:
|
|
- run: echo Done!
|