33 branches : [ master ]
44 pull_request :
55 branches : [ master ]
6+ workflow_dispatch :
7+
8+ concurrency :
9+ group : ci-${{ github.ref }}
10+ cancel-in-progress : true
611
712permissions :
813 contents : read
1217 runs-on : ${{ matrix.os }}
1318 timeout-minutes : 30
1419
20+ env :
21+ # deterministic dict/set iteration order run-to-run (guards against hash-order flakiness in CI)
22+ PYTHONHASHSEED : " 0"
23+
1524 strategy :
1625 matrix :
1726 include :
@@ -37,11 +46,89 @@ jobs:
3746 - name : Python sanity
3847 run : python -VV
3948
49+ - name : Pyflakes lint
50+ shell : bash
51+ run : |
52+ python - <<'PY'
53+ from __future__ import print_function
54+
55+ import subprocess
56+ import sys
57+
58+ subprocess.check_call([
59+ sys.executable, "-m", "pip", "install", "pyflakes"
60+ ])
61+
62+ files = subprocess.check_output(
63+ ["git", "ls-files", "*.py"]
64+ ).decode("utf-8").splitlines()
65+
66+ files = [
67+ f for f in files
68+ if not f.startswith("thirdparty/")
69+ ]
70+
71+ proc = subprocess.Popen(
72+ [sys.executable, "-m", "pyflakes"] + files,
73+ stdout=subprocess.PIPE,
74+ stderr=subprocess.STDOUT,
75+ )
76+ out, _ = proc.communicate()
77+
78+ text = out.decode("utf-8", "replace")
79+ lines = [
80+ line for line in text.splitlines()
81+ if " redefines " not in line
82+ ]
83+
84+ if lines:
85+ print("\n".join(lines))
86+ sys.exit(1)
87+
88+ if proc.returncode not in (0, 1):
89+ if text:
90+ print(text)
91+ print("pyflakes failed unexpectedly with status %s" % proc.returncode)
92+ sys.exit(proc.returncode or 1)
93+
94+ print("pyflakes: clean")
95+ PY
96+
4097 - name : Basic import test
4198 run : python -c "import sqlmap; import sqlmapapi"
4299
100+ - name : Install optional test deps (lxml, jinja2)
101+ # lxml has no PyPy-2.7 wheel and 5.x is Py3-only, so it cannot be pip-installed there. The
102+ # tests that use it (test_xpath's real-XPath checks, and the --xpath/--ssti vuln-test
103+ # endpoints) skip themselves when the engine is unavailable, so these deps are only needed
104+ # on the Py3 jobs.
105+ if : matrix.python-version != 'pypy-2.7'
106+ run : python -m pip install -q lxml jinja2
107+
108+ - name : Unit tests
109+ # -B: do not write .pyc files. On Python 2 / PyPy a cached .pyc makes a module's __file__
110+ # point at the .pyc, which would make the later --smoke getFileType(__file__) doctest see
111+ # 'binary' instead of 'text'. Keeping this step byte-compile-free leaves --smoke clean.
112+ run : python -B -m unittest discover -s tests -p "test_*.py"
113+
114+ - name : Coverage
115+ if : matrix.python-version != 'pypy-2.7'
116+ run : |
117+ python -m pip install coverage
118+ python -m coverage run --source=lib,plugins,tamper -m unittest discover -s tests -p "test_*.py"
119+ python -m coverage run -a --source=lib,plugins,tamper sqlmap.py --doc-test
120+ python -m coverage report --fail-under=50
121+
43122 - name : Smoke test
44- run : python sqlmap.py --smoke
123+ run : python sqlmap.py --smoke-test
124+
125+ - name : Payload lint
126+ # offline: emulates blind + UNION enumeration across all DBMSes and checks
127+ # every payload agent.py builds with lib/utils/sqllint (structural sanity)
128+ run : python sqlmap.py --payload-lint
45129
46130 - name : Vuln test
47- run : python sqlmap.py --vuln
131+ run : python sqlmap.py --vuln-test
132+
133+ - name : API test
134+ run : python sqlmap.py --api-test
0 commit comments