Skip to content

Commit 23ed1f6

Browse files
committed
Optimize CI workflow with caching and env vars
Adds environment variables for Python version and attempt count, implements caching for Python dependencies and Playwright browsers, and improves Playwright installation steps. These changes reduce redundant installs and speed up workflow execution.
1 parent 14a9dc8 commit 23ed1f6

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

.github/workflows/validate-test-generation-prompts.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

15+
env:
16+
PYTHON_VERSION: '3.12'
17+
ATTEMPTS: 3
18+
1519
jobs:
1620
validate-prompts:
1721
runs-on: ubuntu-latest
@@ -25,15 +29,38 @@ jobs:
2529
- name: Set up Python
2630
uses: actions/setup-python@v5
2731
with:
28-
python-version: '3.12'
32+
python-version: ${{ env.PYTHON_VERSION }}
33+
cache: 'pip'
34+
35+
- name: Cache Python dependencies
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.cache/pip
39+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', 'setup.py', 'pyproject.toml') }}
40+
restore-keys: |
41+
${{ runner.os }}-pip-
2942
3043
- name: Install dependencies
3144
run: |
45+
pip install --upgrade pip
3246
pip install -e ".[dev,test]"
3347
48+
- name: Cache Playwright browsers
49+
uses: actions/cache@v4
50+
id: playwright-cache
51+
with:
52+
path: ~/.cache/ms-playwright
53+
key: ${{ runner.os }}-playwright-${{ hashFiles('**/requirements*.txt', 'setup.py') }}
54+
3455
- name: Install Playwright browsers
35-
run: |
36-
playwright install
56+
if: steps.playwright-cache.outputs.cache-hit != 'true'
57+
run: playwright install --with-deps
58+
59+
- name: Install Playwright dependencies only
60+
if: steps.playwright-cache.outputs.cache-hit == 'true'
61+
run: playwright install-deps
62+
63+
3764

3865
- name: Run Evaluation and Tests 3 Times
3966
env:
@@ -106,6 +133,8 @@ jobs:
106133
exit 1
107134
fi
108135
136+
137+
109138
- name: Prepare Comment Body
110139
if: github.event_name == 'pull_request'
111140
run: |

0 commit comments

Comments
 (0)