mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-06-16 21:06:15 +03:00
ci: add test/lint/smoke workflow, declare python-dotenv, recommend Python 3.12
GitHub Actions: pytest across Python 3.10-3.13, a clean-install import smoke that catches undeclared runtime deps, and a strict Ruff gate (standard rule set) scoped to the files each PR changes. Declares python-dotenv (imported by the CLI but previously undeclared) and adds a [dev] extra. Recommends Python 3.12 for setup, verified from a clean isolated install.
This commit is contained in:
75
.github/workflows/ci.yml
vendored
Normal file
75
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: tests (py${{ matrix.python-version }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install (with dev extras)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
- name: Run test suite
|
||||
run: pytest -q
|
||||
|
||||
smoke-install:
|
||||
name: clean-install smoke
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: Fresh install (no dev extras) and import
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install .
|
||||
# Catches undeclared runtime deps (e.g. #994 python-dotenv): a bare
|
||||
# install must import the package and the CLI module.
|
||||
python -c "import tradingagents, cli.main; print('clean-install import OK')"
|
||||
|
||||
lint:
|
||||
name: ruff (changed files, strict)
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: Install ruff
|
||||
run: pip install "ruff>=0.15"
|
||||
- name: Lint only the Python files this PR changes
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
run: |
|
||||
# Strict going-forward gate: the full-repo cleanup is deferred (see
|
||||
# worklog 03/01), so we lint only files this PR adds or modifies.
|
||||
files=$(git diff --name-only --diff-filter=ACM "$BASE_SHA"...HEAD -- '*.py' \
|
||||
| grep -vE '^(results|worklog)/' || true)
|
||||
if [ -z "$files" ]; then
|
||||
echo "No Python changes to lint."
|
||||
exit 0
|
||||
fi
|
||||
echo "Linting changed files:"
|
||||
echo "$files"
|
||||
ruff check $files
|
||||
Reference in New Issue
Block a user