Skip to main content

scripts: add my standard test runner

ID
751b5a6
date
2026-04-30 07:31:40+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
5201340
message
scripts: add my standard test runner
changed files
2 files, 24 additions, 11 deletions

Changed files

.github/workflows/test.yml (2304) → .github/workflows/test.yml (2129)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 38dcf0d..247b1a9 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -74,15 +74,5 @@ jobs:
     - name: Install WebKit
       run: playwright install webkit
 
-    - name: Check formatting
-      run: |
-        ruff check .
-        ruff format --check .
-
-    - name: Check types
-      run: mypy src tests
-
     - name: Run tests
-      run: |
-        coverage run -m pytest tests
-        coverage report
+      run: bash scripts/run_chives_tests.sh

scripts/run_chives_tests.sh (0) → scripts/run_chives_tests.sh (412)

diff --git a/scripts/run_chives_tests.sh b/scripts/run_chives_tests.sh
new file mode 100755
index 0000000..aabda75
--- /dev/null
+++ b/scripts/run_chives_tests.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+# Print a command in blue, then run the command
+run_command() {
+    echo ""
+    echo -e "\033[34m-> $@\033[0m"
+    bash -c "$@"
+}
+
+run_command 'ruff format'
+
+if [[ "${CI:-}" == "true" ]]
+then
+  run_command 'git diff --exit-code'
+fi
+
+run_command 'ruff check'
+run_command 'mypy src tests'
+run_command "coverage run -m pytest tests"
+run_command "coverage report"