summaryrefslogtreecommitdiffstats
path: root/tools/windows
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:49:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:49:10 +0000
commita85f3954a8fe112640c2c35da3228be29b17c97c (patch)
tree7ee43f79639ee53903e7ca389e548974e1497c3a /tools/windows
parentInitial commit. (diff)
downloadgitlint-upstream.tar.xz
gitlint-upstream.zip
Adding upstream version 0.18.0.upstream/0.18.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/windows')
-rw-r--r--tools/windows/create-test-repo.bat37
-rw-r--r--tools/windows/run_tests.bat15
2 files changed, 52 insertions, 0 deletions
diff --git a/tools/windows/create-test-repo.bat b/tools/windows/create-test-repo.bat
new file mode 100644
index 0000000..54cf146
--- /dev/null
+++ b/tools/windows/create-test-repo.bat
@@ -0,0 +1,37 @@
+
+:: Use pushd, so we can popd back at the end (directory changes are not contained inside batch file)
+PUSHD C:\Windows\Temp
+
+@echo off
+
+:: Determine unique git repo name
+:: We use Python to determine to get a datetime stamp since other workarounds in BATCH are locale dependent
+:: Note that we double escape the % in the format string to %%
+FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import datetime; print(datetime.datetime.now().strftime('%%Y-%%m-%%d_%%H-%%M-%%S'))"`) DO (
+SET datetime=%%F
+)
+echo %datetime%
+set Reponame=gitlint-test-%datetime%
+echo %Reponame%
+
+:: Create git repo
+git init --initial-branch main %Reponame%
+cd %Reponame%
+
+:: Do some basic config
+git config user.name gïtlint-test-user
+git config user.email gitlint@test.com
+git config core.quotePath false
+git config core.precomposeUnicode true
+
+:: Add a test commit
+echo "tëst 123" > test.txt
+git add test.txt
+git commit -m "test cömmit title" -m "test cömmit body that has a bit more text"
+
+:: echo. -> the dot allows us to print an empty line
+echo.
+echo Created C:\Windows\Temp\%Reponame%
+
+:: Move back to original dir
+POPD \ No newline at end of file
diff --git a/tools/windows/run_tests.bat b/tools/windows/run_tests.bat
new file mode 100644
index 0000000..16ebc8b
--- /dev/null
+++ b/tools/windows/run_tests.bat
@@ -0,0 +1,15 @@
+@echo off
+
+set arg1=%1
+
+IF "%arg1%"=="-p" (
+ echo Running flake8...
+ flake8 --extend-ignore=H307,H405,H803,H904,H802,H701 --max-line-length=120 --exclude="*settings.py,*.venv/*.py" gitlint qa examples
+) ELSE (
+ :: Run passed arg, or all unit tests if passed arg is empty
+ IF "%arg1%" == "" (
+ pytest -rw -s gitlint
+ ) ELSE (
+ pytest -rw -s %arg1%
+ )
+) \ No newline at end of file