From 8f6db2db165b78ab0d22a6e447ac057e2c16e1d3 Mon Sep 17 00:00:00 2001 From: Roman Babenko Date: Sat, 30 Nov 2024 09:00:33 +0200 Subject: [PATCH] suppress userwarning in windows-latest & py3.12 --- .github/workflows/test.yml | 15 +++++++++++---- github-windows-py3_12.patch | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 github-windows-py3_12.patch diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e35e8676..7a90895e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,10 +26,11 @@ jobs: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - exclude: - # exclude py3.12 for windows latest due UserWarning: Unsupported Windows version (2022server). ONNX Runtime supports Windows 10 and above, only. - - os: windows-latest - python-version: "3.12" +# exclude: +# # exclude py3.12 for windows latest due UserWarning: Unsupported Windows version (2022server). ONNX Runtime supports Windows 10 and above, only. +# - os: windows-latest +# python-version: "3.12" + steps: - name: Harden Runner @@ -53,6 +54,12 @@ jobs: # windows requires update pip via python module python -m pip install --upgrade pip + - name: Patch onnxruntime warning + if: ${{ ("3.12" == matrix.python-version) && ("windows-latest" == matrix.os) }} + run: | + git apply github-windows-py3_12.patch + cat credsweeper/ml_model/ml_validator.py + - name: Install application run: | python -m pip install . diff --git a/github-windows-py3_12.patch b/github-windows-py3_12.patch new file mode 100644 index 000000000..f5b4ea66a --- /dev/null +++ b/github-windows-py3_12.patch @@ -0,0 +1,14 @@ +diff --git a/credsweeper/ml_model/ml_validator.py b/credsweeper/ml_model/ml_validator.py +index 589a4bb6..a3cab6fd 100644 +--- a/credsweeper/ml_model/ml_validator.py ++++ b/credsweeper/ml_model/ml_validator.py +@@ -3,7 +3,9 @@ import logging + import string + from pathlib import Path + from typing import List, Tuple, Union, Optional, Dict ++import warnings + ++warnings.filterwarnings("ignore", message="Unsupported Windows version (2022server). ONNX Runtime supports Windows 10 and above, only.", module="onnxruntime.capi.onnxruntime_validation") + import numpy as np + import onnxruntime as ort +