-
Notifications
You must be signed in to change notification settings - Fork 2
118 lines (93 loc) · 2.87 KB
/
ci.yml
File metadata and controls
118 lines (93 loc) · 2.87 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
name: CI
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master]
jobs:
test:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
env:
PYTHONIOENCODING: utf-8
PYTHONUTF8: 1
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip --quiet
- name: Install package (editable)
run: pip install -e .
- name: Smoke test - import
run: python -c "import git_diff; print('Version:', git_diff.__version__)"
- name: Smoke test - CLI version
run: git-diff --version
- name: Smoke test - CLI help
run: git-diff --help
- name: Functional test - git data collection
shell: bash
run: |
python <<'PY'
from git_diff.git_data import get_repo_root, collect_all_data, parse_diff
root = get_repo_root(".")
print("Root:", root)
diff_text = """diff --git a/f.py b/f.py
index a..b 100644
--- a/f.py
+++ b/f.py
@@ -1,2 +1,3 @@
line1
-old
+new1
+new2
"""
r = parse_diff(diff_text)
assert r["total_files"] == 1
assert r["total_additions"] == 2
assert r["total_deletions"] == 1
print("parse_diff: OK")
data = collect_all_data(root)
assert "repo" in data
print("Repo:", data["repo"]["name"])
print("Commits:", len(data["commits"]))
print("Files:", len(data["file_tree"]))
print("All tests passed!")
PY
- name: Functional test - server imports
shell: bash
run: |
python <<'PY'
from git_diff.server import find_free_port
port = find_free_port()
print("Free port:", port)
assert 7433 <= port <= 7500
print("Server imports: OK")
PY
- name: Functional test - diff edge cases
shell: bash
run: |
python <<'PY'
from git_diff.git_data import parse_diff
r = parse_diff("")
assert r["total_files"] == 0
r = parse_diff("""diff --git a/n.py b/n.py
new file mode 100644
index 0000000..abc
--- /dev/null
+++ b/n.py
@@ -0,0 +1,2 @@
+a
+b
""")
assert r["files"][0]["is_new"] is True
assert r["total_additions"] == 2
print("Edge cases OK")
PY