Skip to content

Commit b5c4829

Browse files
committed
Add snapshot tests workflow
This workflow only triggers when the auto-pr script or the snapshot test directory changes
1 parent 601ad76 commit b5c4829

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

.github/auto-pr-tests/test_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def compare(issue_json_path: Path, snapshot_path: Path) -> bool:
3838
print(f"{issue_json_path.name} matches snapshot.")
3939
return True
4040

41-
# to generate snapshot i use this command:
42-
# create or change the test_issue_xx file
43-
## `cat .github/auto-pr-tests/test_issue_XX.json | python3 scripts/auto-pr-helper.py 2&>/dev/null > .github/auto-pr-tests/test_issue_0XX.snapshot`
41+
# to generate snapshot:
42+
# create or change the test_issue_xx file and then use this command after replacing XX with your test number:
43+
## `cat .github/auto-pr-tests/test_issue_XX.json | uv run python scripts/auto-pr-helper.py 2&>/dev/null > .github/auto-pr-tests/test_issue_0XX.snapshot`
4444
tests = {
4545
"test_01": (
4646
Path(".github/auto-pr-tests/test_issue_01.json"),

.github/workflows/snapshot-ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Snapshot Tests for auto-pr
2+
3+
on:
4+
push:
5+
paths:
6+
- 'scripts/auto-pr-helper.py'
7+
- '.github/auto-pr-tests/**'
8+
workflow_dispatch: # also allow manual runs
9+
10+
jobs:
11+
snapshot-test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
shell: bash
19+
run: |
20+
curl -LsSf https://astral.sh/uv/install.sh | sh
21+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
22+
23+
- name: Run snapshot tests
24+
run: |
25+
uv run python .github/auto-pr-tests/test_runner.py

0 commit comments

Comments
 (0)