Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GHA] run tests with numpy<2 #3190

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/scripts/override_constraints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2025 Intel Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import re
import sys
from pathlib import Path

CONSTRAINTS_FILE = "constraints.txt"


def main():
arg = sys.argv[1]
overrided_requirements = [r.strip() for r in arg.split(",")]

print("overrided_requirements: ", arg)

file = Path(CONSTRAINTS_FILE)
content = file.read_text()

for new_requirement in overrided_requirements:
new_requirement = new_requirement.strip()
package_name = new_requirement.split("==")[0]
content = re.sub(f"^{package_name}\s*[=><].*", "", content, flags=re.MULTILINE)
content += f"\n{new_requirement}"

print("New constraints:")
print(content)

file.write_text(content)


if __name__ == "__main__":
main()
49 changes: 41 additions & 8 deletions .github/workflows/call_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
type: boolean
default: false
required: true
override_requirements:
description: 'Override requirements'
default: ''
type: string
required: false

jobs:
common:
Expand All @@ -29,8 +34,12 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
cache: pip
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: make install-common-test
run: pip install . -r tests/common/requirements.txt
- name: Print installed modules
run: pip list
- name: Run common precommit test scope
Expand All @@ -51,8 +60,12 @@ jobs:
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ inputs.python_version }}
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: make install-onnx-test
run: pip install . -r tests/onnx/requirements.txt
- name: Print installed modules
run: pip list
- name: Run ONNX precommit test scope
Expand All @@ -74,8 +87,12 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
cache: pip
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: make install-openvino-test
run: pip install . -r tests/openvino/requirements.txt
- name: Print installed modules
run: pip list
- name: Run OV precommit test scope
Expand Down Expand Up @@ -108,8 +125,12 @@ jobs:
run: |
cat /etc/*release
cat /proc/cpuinfo
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: make install-torch-test
run: pip install . -r tests/torch/requirements.txt
- name: Print installed modules
run: pip list
- name: Run PyTorch precommit test scope
Expand Down Expand Up @@ -151,8 +172,12 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
cache: pip
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: make install-torch-test
run: pip install . -r tests/torch/requirements.txt
- name: Print installed modules
run: pip list
- name: Check CUDA
Expand Down Expand Up @@ -181,8 +206,12 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
cache: pip
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: make install-tensorflow-test
run: pip install . -r tests/tensorflow/requirements.txt
- name: Print installed modules
run: pip list
- name: Run TensorFlow precommit test scope
Expand All @@ -204,7 +233,7 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
cache: pip
- name: Install NNCF and test requirements
- name: Install test requirements
run: pip install -r tests/tools/requirements.txt
- name: Print installed modules
run: pip list
Expand All @@ -225,9 +254,13 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
cache: pip
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: |
pip install -r tests/torch2/requirements.txt -e .
pip install . -r tests/torch2/requirements.txt
- name: Print installed modules
run: pip list
- name: Run torch2 precommit test scope
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python_version: ["3.9", "3.11", "3.12"]
include:
- python_version: "3.9"
override_requirements: "numpy==1.24.0"
- python_version: "3.11"
- python_version: "3.12"
uses: ./.github/workflows/call_precommit.yml
with:
python_version: ${{ matrix.python_version }}
override_requirements: ${{ matrix.override_requirements || '' }}
gpu_enabled: false

macos:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies = [
"natsort>=7.1.0",
"networkx>=2.6, <=3.3",
"ninja>=1.10.0.post2, <1.12",
"numpy>=1.19.1, <2.2.0",
"numpy>=1.24.0, <2.2.0",
"openvino-telemetry>=2023.2.0",
"packaging>=20.0",
"pandas>=1.1.5,<2.3",
Expand Down