[ci] Add a mypy lint check for code that uses it
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/ci/scripts/mypy.sh b/ci/scripts/mypy.sh
new file mode 100755
index 0000000..8a31952
--- /dev/null
+++ b/ci/scripts/mypy.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+# Run mypy to do Python linting on code that uses it
+
+set -e
+
+dirs_with_lint_makefile=(
+ hw/ip/otbn/dv/rig
+ hw/ip/otbn/dv/otbnsim
+ hw/ip/otbn/util
+)
+
+retcode=0
+for dir in "${dirs_with_lint_makefile[@]}"; do
+ make -C "$dir" lint || {
+ echo -n "##vso[task.logissue type=error]"
+ echo "Failed mypy check in ${dir}."
+ retcode=1
+ }
+done
+
+exit $retcode