2121 outputs :
2222 related : ${{ steps.filter.outputs.related }}
2323 ragas : ${{ steps.filter.outputs.ragas }}
24+ ragas_experimental : ${{ steps.filter.outputs.ragas_experimental }}
2425 docs : ${{ steps.filter.outputs.docs }}
2526 steps :
2627 - uses : actions/checkout@v4
@@ -35,12 +36,16 @@ jobs:
3536 - codecov.yml
3637 - pyproject.toml
3738 - requirements/test.txt
39+ - Makefile
3840 ragas:
3941 - *related
4042 - "ragas/src/ragas/**"
4143 - "ragas/tests/**"
4244 ragas_experimental:
45+ - *related
4346 - "experimental/ragas_experimental/**"
47+ - "experimental/tests/**"
48+ - "experimental/pyproject.toml"
4449 docs:
4550 - *related
4651 - requirements/docs-requirements.txt
@@ -53,11 +58,24 @@ jobs:
5358 strategy :
5459 fail-fast : false
5560 matrix :
56- os : [ubuntu-latest, macos-latest, windows-latest]
57- python-version : ["3.9", "3.10", "3.11", "3.12"]
61+ include :
62+ # Critical path: Latest + oldest Python on Ubuntu (full test suite)
63+ - os : ubuntu-latest
64+ python-version : " 3.9"
65+ test-type : " full"
66+ - os : ubuntu-latest
67+ python-version : " 3.12"
68+ test-type : " full"
69+ # Cross-platform validation (essential tests only)
70+ - os : macos-latest
71+ python-version : " 3.11"
72+ test-type : " essential"
73+ - os : windows-latest
74+ python-version : " 3.10"
75+ test-type : " essential"
5876
5977 if : ${{ (github.event_name == 'pull_request' && needs.diff.outputs.ragas == 'true') || github.event_name == 'push' }}
60- name : python${{ matrix.python-version }}_unit_tests (${{ matrix.os }})
78+ name : python${{ matrix.python-version }}_unit_tests (${{ matrix.os }}, ${{ matrix.test-type }} )
6179 runs-on : ${{ matrix.os }}
6280
6381 steps :
@@ -71,80 +89,169 @@ jobs:
7189 python-version : ${{ matrix.python-version }}
7290 architecture : ${{ matrix.os == 'macos-latest' && 'arm64' || 'x64' }}
7391
92+ - name : Install uv
93+ uses : astral-sh/setup-uv@v4
94+
7495 - name : Get pip cache dir
7596 id : cache-dir
7697 run : |
7798 echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
7899
79- - name : Cache pip dependencies
80- uses : actions/cache@v3
81- id : cache-pip
100+ - name : Cache dependencies (UV cache)
101+ uses : actions/cache@v4
102+ id : cache-deps
82103 with :
83- path : ${{ steps.cache-dir.outputs.dir }}
84- key : ${{ runner.os }}-tests-${{ hashFiles('requirements/test.txt') }}
104+ path : |
105+ ${{ steps.cache-dir.outputs.dir }}
106+ ~/.cache/uv
107+ key : deps-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('ragas/pyproject.toml', 'requirements/*.txt') }}
108+ restore-keys : |
109+ deps-${{ runner.os }}-py${{ matrix.python-version }}-
110+ deps-${{ runner.os }}-py3.11-
111+ deps-${{ runner.os }}-
85112
86113 - name : Install dependencies
87114 run : |
88- pip install "./ragas"
89- pip install -r requirements/test.txt
90-
115+ # Use UV with system installation for CI (simpler and more reliable)
116+ uv pip install --system -e "./ragas[dev]" --cache-dir ~/.cache/uv
91117
92118 - name : Run unit tests
93119 run : |
94- # OPTS=(--cov-config pyproject.toml --cov=src/bentoml --cov-append)
120+ # Configure test options based on OS and test type
95121 if [ "${{ matrix.os }}" != 'windows-latest' ]; then
96- # we will use pytest-xdist to improve tests run-time.
122+ # Use pytest-xdist to improve test run-time on Linux/macOS
97123 OPTS=(--dist loadfile -n auto)
98124 fi
99- # Now run the unit tests
100- pytest --nbmake ragas/tests/unit "${OPTS[@]}"
125+
126+ # Run different test suites based on test type
127+ if [ "${{ matrix.test-type }}" = "full" ]; then
128+ # Full test suite with notebook tests
129+ cd ragas && pytest --nbmake tests/unit "${OPTS[@]}"
130+ else
131+ # Essential tests only (faster for cross-platform validation)
132+ cd ragas && pytest tests/unit -k "not slow" "${OPTS[@]}"
133+ fi
101134 env :
102135 __RAGAS_DEBUG_TRACKING : true
103136 RAGAS_DO_NOT_TRACK : true
104137
105- codestyle_check :
106- runs-on : ubuntu-latest
138+ experimental_tests :
107139 needs :
108140 - diff
109141
110- if : ${{ (github.event_name == 'pull_request' && needs.diff.outputs.ragas == 'true') || github.event_name == 'push' }}
142+ strategy :
143+ fail-fast : false
144+ matrix :
145+ include :
146+ # Focus on stable Python versions for experimental features
147+ - os : ubuntu-latest
148+ python-version : " 3.11"
149+ test-type : " full"
150+ - os : ubuntu-latest
151+ python-version : " 3.12"
152+ test-type : " full"
153+
154+ if : ${{ (github.event_name == 'pull_request' && needs.diff.outputs.ragas_experimental == 'true') || github.event_name == 'push' }}
155+ name : python${{ matrix.python-version }}_experimental_tests (${{ matrix.os }})
156+ runs-on : ${{ matrix.os }}
111157
112158 steps :
113159 - uses : actions/checkout@v4
160+ with :
161+ fetch-depth : 0 # fetch all tags and branches
114162
115163 - name : Setup python
116- uses : actions/setup-python@v4
164+ uses : actions/setup-python@v5
117165 with :
118- python-version : " 3.10.6 "
166+ python-version : ${{ matrix.python-version }}
119167 architecture : x64
120168
169+ - name : Install uv
170+ uses : astral-sh/setup-uv@v4
171+
121172 - name : Get pip cache dir
122173 id : cache-dir
123174 run : |
124175 echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
125176
126- - name : Fetch origin
127- run : git fetch origin "$GITHUB_BASE_REF"
177+ - name : Cache dependencies (UV cache)
178+ uses : actions/cache@v4
179+ id : cache-deps
180+ with :
181+ path : |
182+ ${{ steps.cache-dir.outputs.dir }}
183+ ~/.cache/uv
184+ key : deps-${{ runner.os }}-py${{ matrix.python-version }}-exp-${{ hashFiles('ragas/pyproject.toml', 'experimental/pyproject.toml') }}
185+ restore-keys : |
186+ deps-${{ runner.os }}-py${{ matrix.python-version }}-exp-
187+ deps-${{ runner.os }}-py${{ matrix.python-version }}-
188+ deps-${{ runner.os }}-py3.11-
189+ deps-${{ runner.os }}-
190+
191+ - name : Install dependencies
192+ run : |
193+ # Use UV with system installation for CI (simpler and more reliable)
194+ uv pip install --system -e "./ragas[dev]" --cache-dir ~/.cache/uv
195+ uv pip install --system -e "./experimental[dev]" --cache-dir ~/.cache/uv
196+
197+ - name : Run experimental tests
198+ run : |
199+ cd experimental && pytest -v --tb=short
200+ env :
201+ __RAGAS_DEBUG_TRACKING : true
202+ RAGAS_DO_NOT_TRACK : true
203+
204+ code_quality_check :
205+ runs-on : ubuntu-latest
206+ needs :
207+ - diff
208+
209+ if : ${{ (github.event_name == 'pull_request' && (needs.diff.outputs.ragas == 'true' || needs.diff.outputs.ragas_experimental == 'true')) || github.event_name == 'push' }}
210+
211+ steps :
212+ - uses : actions/checkout@v4
128213
129- - name : Setup node
130- uses : actions/setup-node@v3
214+ - name : Setup python
215+ uses : actions/setup-python@v5
131216 with :
132- node-version : " 17"
217+ python-version : " 3.11"
218+ architecture : x64
133219
134- - name : Cache pip dependencies
135- uses : actions/cache@v3
136- id : cache-pip
220+ - name : Install uv
221+ uses : astral-sh/setup-uv@v4
222+
223+ - name : Get pip cache dir
224+ id : cache-dir
225+ run : |
226+ echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
227+
228+ - name : Cache dependencies (UV cache)
229+ uses : actions/cache@v4
230+ id : cache-deps
137231 with :
138- path : ${{ steps.cache-dir.outputs.dir }}
139- key : codestyle-${{ hashFiles('requirements/dev.txt') }}
232+ path : |
233+ ${{ steps.cache-dir.outputs.dir }}
234+ ~/.cache/uv
235+ key : deps-ubuntu-py3.11-codestyle-${{ hashFiles('ragas/pyproject.toml', 'experimental/pyproject.toml', 'requirements/*.txt') }}
236+ restore-keys : |
237+ deps-ubuntu-py3.11-codestyle-
238+ deps-ubuntu-py3.11-
239+ deps-ubuntu-
140240
141241 - name : Install dependencies
142242 run : |
143- pip install ./ragas
144- pip install -r requirements/dev.txt
243+ # Use UV with system installation for CI (simpler and more reliable)
244+ uv pip install --system -e "./ragas[dev]" --cache-dir ~/.cache/uv
245+ uv pip install --system -e "./experimental[dev]" --cache-dir ~/.cache/uv
246+
247+ - name : Format check (dry run)
248+ run : |
249+ # Check if code is properly formatted (without making changes)
250+ echo "Checking ragas formatting..."
251+ black --check --config ragas/pyproject.toml ragas/src ragas/tests docs
252+ ruff check ragas/src docs ragas/tests
253+ echo "Checking experimental formatting..."
254+ cd experimental && black --check ragas_experimental && ruff check ragas_experimental
145255
146- - name : Lint check
147- run : make lint
148256 - name : Type check
149- if : ${{ github.event_name == 'pull_request' }}
150257 run : make type
0 commit comments