-
Notifications
You must be signed in to change notification settings - Fork 411
132 lines (109 loc) · 3.44 KB
/
Copy pathtest.yml
File metadata and controls
132 lines (109 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
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/