Skip to content

[codex] refactor build context detection #2173

[codex] refactor build context detection

[codex] refactor build context detection #2173

Workflow file for this run

name: Tests
on:
pull_request:
branches:
- main
- release
push:
branches:
- main
workflow_dispatch: # Allow manual trigger
env:
UV_VERSION: "0.9.3"
jobs:
validate-env-locks:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
- name: Set up Python
run: uv python install 3.11
- name: Validate changed environment lockfiles
run: |
base_sha="${{ github.event.pull_request.base.sha }}"
head_sha="${{ github.sha }}"
mapfile -t env_dirs < <(
git diff --name-only "$base_sha" "$head_sha" \
| rg '^envs/[^/]+/(pyproject\.toml|uv\.lock)$' \
| xargs -r -n1 dirname \
| sort -u
)
if [ "${#env_dirs[@]}" -eq 0 ]; then
echo "No environment dependency files changed."
exit 0
fi
printf 'Validating %s\n' "${env_dirs[@]}"
for env_dir in "${env_dirs[@]}"; do
echo "::group::$env_dir"
(
cd "$env_dir"
uv sync --frozen --all-groups --all-extras --dry-run --no-install-project
)
echo "::endgroup::"
done
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv sync --all-extras
uv pip install pytest pytest-asyncio numpy nltk smolagents python-chess moonfish
- name: Run tests
run: |
uv run pytest tests/ \
--ignore=tests/envs/test_browsergym_environment.py \
--ignore=tests/envs/test_dipg_environment.py \
--ignore=tests/envs/test_websearch_environment.py \
-m "not integration and not network and not docker" \
-v \
--tb=short
env:
PYTHONPATH: src:envs
check-env-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Check environment stubs are in sync with READMEs
run: python scripts/sync_env_docs.py --check
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: |
uv sync --all-extras
uv pip install ruff usort
- name: Run import sort + format check
run: |
# Replicate the arc f pipeline: usort then ruff format
uv run usort format src/ tests/
uv run ruff format src/ tests/
# If any files changed, they weren't properly formatted
if [ -n "$(git diff --name-only -- '*.py')" ]; then
echo "ERROR: Files not properly formatted. Run:"
echo " uv run usort format src/ tests/ && uv run ruff format src/ tests/"
git diff --name-only -- '*.py'
exit 1
fi
- name: Run ruff lint check
run: uv run ruff check src/ tests/