Skip to content

Commit

Permalink
suppress userwarning in windows-latest & py3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Nov 30, 2024
1 parent 6e1381a commit 8f6db2d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 .
Expand Down
14 changes: 14 additions & 0 deletions github-windows-py3_12.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8f6db2d

Please sign in to comment.