mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 23:28:07 -05:00
- Move `autogpt/tests/vcr_cassettes` submodule to `forge/tests/vcr_cassettes` - Remove not needed markers from `pyproject.toml`: `"requires_openai_api_key", "requires_huggingface_api_key"` - Update relevant GitHub workflows Moved relevant tests from `autogpt/tests` to appropiate directories: - Component tests to their respective component dirs - `autogpt/tests/unit/test_web_search.py` → `forge/components/web/test_search.py` - `autogpt/tests/unit/test_git_commands.py` → `forge/components/git_operations/test_git_operations.py` - `autogpt/tests/unit/test_file_operations.py` → `forge/components/file_manager/test_file_manager.py` - `autogpt/tests/integration/test_image_gen.py` → `forge/components/image_gen/test_image_gen.py` - `autogpt/tests/integration/test_web_selenium.py` → `forge/components/web/test_selenium.py` - `autogpt/tests/integration/test_execute_code.py` → `forge/components/code_executor/test_code_executor.py` - `autogpt/tests/unit/test_s3_file_storage.py` → `forge/file_storage/test_s3_file_storage.py` - `autogpt/tests/unit/test_gcs_file_storage.py` → `forge/file_storage/test_gcs_file_storage.py` - `autogpt/tests/unit/test_local_file_storage.py` → `forge/file_storage/test_local_file_storage.py` - `autogpt/tests/unit/test_json.py` → `forge/json/test_parsing.py` - `autogpt/tests/unit/test_logs.py` → `forge/logging/test_utils.py` - `autogpt/tests/unit/test_url_validation.py` → `forge/utils/test_url_validator.py` - `autogpt/tests/unit/test_text_file_parsers.py` → `forge/utils/test_file_operations.py` - (Re)moved dependencies from `autogpt/pyproject.toml` that were only used in these test files. Also: - Added `load_env_vars` fixture to `forge/conftest.py` - Fixed a type error in `forge/components/web/test_search.py` - Merged `autogpt/.gitattributes` into root `.gitattributes` --------- Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
152 lines
4.0 KiB
YAML
152 lines
4.0 KiB
YAML
name: Python checks
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, development, ci-test* ]
|
|
paths:
|
|
- '.github/workflows/lint-ci.yml'
|
|
- 'autogpt/**'
|
|
- 'forge/**'
|
|
- 'benchmark/**'
|
|
- '**.py'
|
|
- '!forge/tests/vcr_cassettes'
|
|
pull_request:
|
|
branches: [ master, development, release-* ]
|
|
paths:
|
|
- '.github/workflows/lint-ci.yml'
|
|
- 'autogpt/**'
|
|
- 'forge/**'
|
|
- 'benchmark/**'
|
|
- '**.py'
|
|
- '!forge/tests/vcr_cassettes'
|
|
|
|
concurrency:
|
|
group: ${{ format('lint-ci-{0}', github.head_ref && format('{0}-{1}', github.event_name, github.event.pull_request.number) || github.sha) }}
|
|
cancel-in-progress: ${{ startsWith(github.event_name, 'pull_request') }}
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
get-changed-parts:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- id: changes-in
|
|
name: Determine affected subprojects
|
|
uses: dorny/paths-filter@v3
|
|
with:
|
|
filters: |
|
|
autogpt:
|
|
- autogpt/autogpt/**
|
|
- autogpt/tests/**
|
|
- autogpt/poetry.lock
|
|
forge:
|
|
- forge/forge/**
|
|
- forge/tests/**
|
|
- forge/poetry.lock
|
|
benchmark:
|
|
- benchmark/agbenchmark/**
|
|
- benchmark/tests/**
|
|
- benchmark/poetry.lock
|
|
outputs:
|
|
changed-parts: ${{ steps.changes-in.outputs.changes }}
|
|
|
|
lint:
|
|
needs: get-changed-parts
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
min-python-version: "3.10"
|
|
|
|
strategy:
|
|
matrix:
|
|
sub-package: ${{ fromJson(needs.get-changed-parts.outputs.changed-parts) }}
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ env.min-python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.min-python-version }}
|
|
|
|
- name: Set up Python dependency cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pypoetry
|
|
key: ${{ runner.os }}-poetry-${{ hashFiles(format('{0}/poetry.lock', matrix.sub-package)) }}
|
|
|
|
- name: Install Poetry
|
|
run: curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
# Install dependencies
|
|
|
|
- name: Install Python dependencies
|
|
run: poetry -C ${{ matrix.sub-package }} install
|
|
|
|
# Lint
|
|
|
|
- name: Lint (isort)
|
|
run: poetry run isort --check .
|
|
working-directory: ${{ matrix.sub-package }}
|
|
|
|
- name: Lint (Black)
|
|
if: success() || failure()
|
|
run: poetry run black --check .
|
|
working-directory: ${{ matrix.sub-package }}
|
|
|
|
- name: Lint (Flake8)
|
|
if: success() || failure()
|
|
run: poetry run flake8 .
|
|
working-directory: ${{ matrix.sub-package }}
|
|
|
|
types:
|
|
needs: get-changed-parts
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
min-python-version: "3.10"
|
|
|
|
strategy:
|
|
matrix:
|
|
sub-package: ${{ fromJson(needs.get-changed-parts.outputs.changed-parts) }}
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ env.min-python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.min-python-version }}
|
|
|
|
- name: Set up Python dependency cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pypoetry
|
|
key: ${{ runner.os }}-poetry-${{ hashFiles(format('{0}/poetry.lock', matrix.sub-package)) }}
|
|
|
|
- name: Install Poetry
|
|
run: curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
# Install dependencies
|
|
|
|
- name: Install Python dependencies
|
|
run: poetry -C ${{ matrix.sub-package }} install
|
|
|
|
# Typecheck
|
|
|
|
- name: Typecheck
|
|
if: success() || failure()
|
|
run: poetry run pyright
|
|
working-directory: ${{ matrix.sub-package }}
|